[我具有如下结构,我目前正在寻求通过SPARQL查询获得这样的JSON响应,我已经尝试了一些类似concat和str的事情,但是dint对我来说很好,它在第三级变得很复杂
我现在添加了我尝试使用JSON-LD进行帧划分的2个帧,它提供了正确的输出,直到第二级的第一级未能扩展数据为止
:Reference xx1:timestamp "12/15/2020" .
:Reference xx2:logs xxx:log1 .
:log1 rdf:type xxx:Logs .
:log1 xx1:approver "xxx:bob" .
:log1 xx1:requester "xxx:daisy" .
:log1 xx1:timestamp "12/15/2020" .
:log1 xx1:name "log1" .
:log2 rdf:type xxx:Logs .
:log2 xx1:approver "xxx:bob" .
:log2 xx1:requester "xxx.daisy" .
:log2 xx1:timestamp "18/15/2020" .
:log2 xx1:name "log2" .
:bob rdf:type xxx:User .
:bob xx1:name "bob" .
:daisy rdf:type xxx:User .
:daisy xx1:name "daisy" .```
Required Response with SPARQL (3 Levels)
[
{
"timestamp": "12/15/2020",
"logs": [
{ "name": "log1", "timestamp": "12/15/2020" "approver" : {name: bob },"requester" : {name: bob }},
{ "name": "log2", "timestamp": "12/15/2020" "approver" : {name: bob },"requester" : {name: bob }},
]
}
]
JSON-LD FRAMING
FRAME 1
{
"@context":{
"XXX":"http://ABC"
},
"@type":"xxx:Reference",
"contains":{
"@type":"xxx:Log",
"contains":{
"@type":"xxx:User"
}
}
}
FRAME 2
{
"@context":{
"XXX":"http://ABC"
},
"@type":"xxx:Reference",
"contains":{
"@type":"xxx:Log",
"hasApprover" :{"@type":"xxx:User"},
"hasRequester" :{"@type":"xxx:User"}
}
}
The output that I get is
Reference [Log 1 {User is expnded}, Log2{User is not expanded}]
What I need is
Reference [Log 1 {User is expanded}, Log2{User is expanded}]
"@context":{
"XXX":"http://ABC"
},
"@type":"xxx:Reference",
"contains":{
"@type":"xxx:Log",
"hasApprover" :{"@type":"xxx:User","@embed": "@always"},
"hasRequester" :{"@type":"xxx:User","@embed": "@always"}
}
}