Closed rybesh closed 3 years ago
What's happening is that when you define "records" with "@container": "@id"
, the frame looks like the object value should be an ID map, but it isn't Wrap the value in an array.
Recall that ID maps are an attribute of compaction, not framing, but as you've found, when used in a frame it may require you to conform to the shape required.
This is the frame I used:
{
"@context": {
"@base": "http://n2t.net/ark:/39333/ncg/place/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"ncv": "http://n2t.net/ark:/39333/ncg/vocab#",
"nct": "http://n2t.net/ark:/39333/ncg/type#",
"skos": "http://www.w3.org/2004/02/skos/core#",
"records": {
"@container": "@id",
"@type": "@id",
"@id": "rdfs:member"
},
"county": {
"@container": "@set",
"@type": "@id",
"@id": "ncv:county"
}
},
"@type": "rdf:Bag",
"records": [{
"@id": {},
"county": {
"@embed": "@always",
"@explicit": true,
"skos:label": {}
}
}]
}
And, you can load it in the playground here.
Perfect, thank you!
I would like to use framing to produce an id map, but this does not seem to work very well with the JSON-LD processors I’ve tried.
Take for example the following graph:
And this frame:
Which produces:
(See the above on the playground).
So far so good.
Now, I would like to change the
records
container from a@set
to an@id
map. But when I do that I get the errorjsonld.SyntaxError: Invalid JSON-LD syntax; a JSON-LD frame must be a single object.
(I’m not sure what that error means, since the frame is still a single object.)Should this work? I can’t find any mention of id maps in the framing spec. Some simpler examples seem to work, but I can’t get anything to work that involves specifying anything (property matches or processing directives) below the level of the id map.