GeezerVison is showing github.com — omit doesn't work for multiple objects · Issue #316 · jsonld-java/jsonld-java
omit doesn't work for multiple objects #316DescriptionI'm getting back following even though I've specified to omit graph
{
"@context" : [ "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary/ClassConcept", "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary/PrimaryKey", "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary/MetadataDictionary" ],
"@graph" : [ {
"uri" : "http://test1",
"type" : "metaframe:MetadataDictionary",
"metaDataConcepts" : {
"uri" : "http://testc1",
"type" : "metaframe:ClassConcept",
"primaryKey" : [ {
"uri" : "http://pk1",
"type" : "metaframe:PrimaryKey",
"priority" : "5"
}, {
"uri" : "http://pk2",
"type" : "metaframe:PrimaryKey",
"priority" : "6"
} ]
},
"title" : "test1"
}, {
"uri" : "http://test2",
"type" : "metaframe:MetadataDictionary",
"title" : "test2"
} ]
}
I see
2.3.4 Omit graph flag
The omit graph flag determines if framed output containing a single node object is contained within @graph, or not. The initial value for the omit graph flag is set using the omitGraph option, or based on the processing mode; if processing mode is json-ld-1.0, the output always includes a @graph member, otherwise, the @graph member is used only to describe multiple node objects, consistent with compaction. See § 4.2.2 Framing Algorithm for a further discussion.
which seems to indicate "@graph member is used only to describe multiple node".. But what do I do if I want no graph at all and I just want a list of the objects? Activityacka47 commented on Jun 8, 2021 I see several reasons the data couldn't be processed as you wish:
- It is not valid JSON-LD: The
@context links do not point to valid JSON-LD context files (see also the JSON-LD playground)
- You use
uri instead of the JSON-LD keyword @id to indicate the URI of a node.
- However, if I use a valid context (like https://schema.org for testing purpose) and
@id you won't get rid of the @graph anyway because you have two distinct nodes (http://test1 and http://test2) which are not linked to each other so that one description can not be embedded in the other and @graph becomes necessary.
Here is some correct JSON-LD for testing:
{
"@context":"https://schema.org",
"@graph":[
{
"@id":"http://test1",
"type":"metaframe:MetadataDictionary",
"metaDataConcepts":{
"@id":"http://testc1",
"type":"metaframe:ClassConcept",
"primaryKey":[
{
"@id":"http://pk1",
"type":"metaframe:PrimaryKey",
"priority":"5"
},
{
"@id":"http://pk2",
"type":"metaframe:PrimaryKey",
"priority":"6"
}
]
},
"title":"test1"
},
{
"@id":"http://test2",
"type":"metaframe:MetadataDictionary",
"title":"test2"
}
]
}
When I put this in the playground and add a JSON-LD frame with the node of type metaframe:MetadataDictionary as root object and @embed": "@always", there will still be two separate nodes that need a @graph around them to be represented as JSON-LD. See https://tinyurl.com/246b6sfp. dr0i commented on Jun 15, 2021 @acka47 thx for clarification/explanation! Very detailed :)
@garpinc is this helpful to solve your problem?
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|