Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with framing (flattening) and @reverse in @context. #198

Closed
gnoric opened this issue Dec 4, 2021 · 1 comment · Fixed by #199
Closed

Issue with framing (flattening) and @reverse in @context. #198

gnoric opened this issue Dec 4, 2021 · 1 comment · Fixed by #199
Labels
bug Something isn't working
Milestone

Comments

@gnoric
Copy link

gnoric commented Dec 4, 2021

Describe the bug
When using @reverse in a top level property context, lower node's relations are created to that root node, not their parent node. This issue can already be seen after flattening occurs so framing context is not required, however it has been added here to explain the full process.

To Reproduce

JSONLD
can be loaded from [http://adidas.devxt.de/example/dev.short.json]

{
  "@context" : "http://adidas.devxt.de/example/dev.short.context.json",
  "data": {
    "allFactSheets": {
      "edges": [
        {
          "node": {
            "id": "ec254751-86be-4b7d-82b8-b716bedb87ce",
            "displayName": "#MYBEST",
            "type": "Application",
            "qualitySeal": "APPROVED",
            "relApplicationToDataObject": {
              "edges": [
                {
                  "node": {
                    "type": "RelApplicationToDataObject",
                    "id": "9a8fb137-0a53-4c95-adbb-d9f8bd27b2bc",
                    "factSheet": {
                      "id": "338b1d1d-617d-4ee4-b79f-dee72e265831",
                      "displayName": "IT Landscape Meta Data",
                      "type": "DataObject"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  },
  "errors": null
}

Context
can be loaded from [http://adidas.devxt.de/example/dev.short.context.json]

{
  "@context":{
    "@base":"http://leanix.net/",
    "col":"https://adidas-dev.collibra.com/",
    "type":"@type",
    "id":"@id",
    "data":"col:ignore",
    "allFactSheets":{
      "@reverse":"col:assets_in_domain_relation",
      "@container":"@index"
    },
    "edges":"@nest",
    "displayName":{
      "@id":"col:displayname",
      "@type":"xsd:string"
    },

    "DataObject":"col:00000000-0000-0000-0000-000000031026",

    "node" : "@nest",
    "relApplicationToDataObject" : {
      "@id" : "col:relates",
      "@container" : "@index",
      "@context" : {
        "factSheet" : "col:to",
        "RelApplicationToDataObject" : "col:1099a85a-48c4-4d34-996e-07f63bc0034e"
      }   
    }
  }
}

Frame
Can be loaded from [http://adidas.devxt.de/example/dev.short.frame.json]. Frame is not needed for understanding the issue, as it happens during the flattening (e.g. when using an empty frame)

{
  "@context":{
    "@base":"http://leanix.net/",
    "col":"https://adidas-dev.collibra.com/",
    "type":"@type",
    "id":"@id",
    "data":"col:ignore",
    "allFactSheets":{
      "@reverse":"col:assets_in_domain_relation"
    },
    "displayName":{
      "@id":"col:displayname",
      "@type":"xsd:string"
    },
    
    "DataObject":"col:00000000-0000-0000-0000-000000031026",
    
    "relation" : "col:relates",
    "from" : "col:from",
    "to" : "col:to"
  },
  "data":{
    "type" : {"@default" : "col:2cc7d681-42bd-4a1d-ab85-7b5386f0c71a"},
    "allFactSheets":{}
  }
}

Expected behavior
As viewable in the playground. Important parts are bold.

{
  "@graph": [
    {
      "@id": "_:b0",
      "https://adidas-dev.collibra.com/ignore": {
        "@id": "_:b1"
      }
    },
    {
      "@id": "http://leanix.net/338b1d1d-617d-4ee4-b79f-dee72e265831",
      "@type": "https://adidas-dev.collibra.com/00000000-0000-0000-0000-000000031026",
      "https://adidas-dev.collibra.com/displayname": {
        "@type": "xsd:string",
        "@value": "IT Landscape Meta Data"
      }
    },
    {
      "@id": "http://leanix.net/9a8fb137-0a53-4c95-adbb-d9f8bd27b2bc",
      "@index": "edges",
      "@type": "https://adidas-dev.collibra.com/1099a85a-48c4-4d34-996e-07f63bc0034e",
      "https://adidas-dev.collibra.com/to": {
        "@id": "http://leanix.net/338b1d1d-617d-4ee4-b79f-dee72e265831"
      }
    },
    {
      "@id": "http://leanix.net/ec254751-86be-4b7d-82b8-b716bedb87ce",
      "@index": "edges",
      "@type": "http://leanix.net/Application",
      "https://adidas-dev.collibra.com/assets_in_domain_relation": {
        "@id": "_:b1"
      },
      "https://adidas-dev.collibra.com/displayname": {
        "@type": "xsd:string",
        "@value": "#MYBEST"
      },
      "https://adidas-dev.collibra.com/relates": {
        "@id": "http://leanix.net/9a8fb137-0a53-4c95-adbb-d9f8bd27b2bc"
      }
    }
  ]
}

Titanium behavior
Important parts are bold.

{
    "@graph": [
        {
            "https://adidas-dev.collibra.com/ignore": {
                "@id": "_:b1"
            }
        },
        {
            "@id": "_:b1"
        },
        {
            "@id": "http://leanix.net/338b1d1d-617d-4ee4-b79f-dee72e265831",
            "@type": "https://adidas-dev.collibra.com/00000000-0000-0000-0000-000000031026",
            "https://adidas-dev.collibra.com/displayname": {
                "@type": "xsd:string",
                "@value": "IT Landscape Meta Data"
            },
            "https://adidas-dev.collibra.com/to": {
                "@id": "_:b1"
	   }
        },
        {
            "@id": "http://leanix.net/9a8fb137-0a53-4c95-adbb-d9f8bd27b2bc",
            "@index": "edges",
            "@type": "https://adidas-dev.collibra.com/1099a85a-48c4-4d34-996e-07f63bc0034e",
	    "https://adidas-dev.collibra.com/relates": {
                "@id": "_:b1"
            }
        },
        {
            "@id": "http://leanix.net/ec254751-86be-4b7d-82b8-b716bedb87ce",
            "@index": "edges",
            "@type": "http://leanix.net/Application",
            "https://adidas-dev.collibra.com/assets_in_domain_relation": {
                "@id": "_:b1"
            },
            "https://adidas-dev.collibra.com/displayname": {
                "@type": "xsd:string",
                "@value": "#MYBEST"
            }
        }
    ]
}

Expected behavior
The relations should be resolved correctly, to the parent node, not to the root of the @reversed property.

Additional context
The sample is a subset of in-use data. We receive the data in that specific format and have no way to preformat it. Resolving in playground seems to work fine.

Main questions

  • Is there any workaround to get titanium to work as playground / spec?
  • Is there a chance that this can be fixed with priority?

Please let me know if anything is unclear. Thank you for your work!

filip26 added a commit that referenced this issue Dec 12, 2021
@filip26 filip26 added the bug Something isn't working label Dec 12, 2021
@filip26 filip26 linked a pull request Dec 12, 2021 that will close this issue
@filip26
Copy link
Owner

filip26 commented Dec 12, 2021

Hi @gnoric ,
thank you for reporting the issue. Should be fixed by PR #199. Please feel to re-open.

There is no public JSON-LD playground using titanium as an engine. Good idea!

filip26 added a commit that referenced this issue Dec 12, 2021
@filip26 filip26 added this to the 1.2.0 milestone Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants