I'm trying to create a frame to include every children inside an array, so Detail (see the example) must contain all the other nodes inside itself.
This is an example of the data I'm using, in expanded JSON-LD:
[
{
"@id": "A",
"http://ontology.ayvu.net/#Person": [
{
"@value": "101023",
"@type": "http://www.w3.org/2001/XMLSchema#integer"
}
],
"http://ontology.ayvu.net/#Detail": [
{
"@id": "_:g70157685738360"
},
{
"@id": "_:g70157685722960"
}
]
},
{
"@id": "_:g70157685722960",
"http://ontology.ayvu.net/#Deuda": [
{
"@value": "OFICINA"
}
],
"http://ontology.ayvu.net/#Detalle": [
{
"@value": "100"
"@type": "http://www.w3.org/2001/XMLSchema#decimal"
}
]
},
{
"@id": "_:g70157685738360",
"http://ontology.ayvu.net/#Deuda": [
{
"@value": "3573.04",
"@type": "http://www.w3.org/2001/XMLSchema#decimal"
}
],
"http://ontology.ayvu.net/#Detalle": [
{
"@value": "AUTOMOTORES"
}
]
}
]
The following frame does that (and sets the default vocabulary to http://ontology.ayvu.net/#
so that those long URLs disappear):
{
"@context": {
"@vocab": "http://ontology.ayvu.net/#"
},
"Detail": {}
}
The frame ensures that the top-level object contains a Detail
property so that you get the right root object. The children are then automatically moved down the JSON tree.
The result will look as follows:
{
"@context": {
"@vocab": "http://ontology.ayvu.net/#"
},
"@graph": [
{
"@id": "A",
"Person": {
"@value": "101023"
"@type": "http://www.w3.org/2001/XMLSchema#integer",
},
"Detail": [
{
"@id": "_:b0",
"Detalle": "AUTOMOTORES",
"Deuda": {
"@value": "3573.04"
"@type": "http://www.w3.org/2001/XMLSchema#decimal",
}
},
{
"@id": "_:b1",
"Detalle": {
"@value": "100"
"@type": "http://www.w3.org/2001/XMLSchema#decimal",
},
"Deuda": "OFICINA"
}
]
}
]
}
Or live in the JSON-LD playground: http://tinyurl.com/q844vkd