我的图如下:
[Natasha]--- knows--> [Bob]
[Bob]--- brother of--> [Alice]
[Alice]--- play with--> [Natasha]
如何将其嵌入JSON-LD?
我当前无法使用的解决方案:
{
"@context" : {
"Natasha" : "http://names.example.org/resource/name/Natasha",
"Bob" : "http://names.example.org/resource/name/Bob",
"Alice" : "http://names.example.org/resource/name/Alice",
"knows" : "http://example.com/knows",
"brother-of" : "http://example.com/brother-of",
"play-with" : "http://example.com/play-with"
},
"@id" : "Natasha",
"knows" :
{ "@id" : "Bob",
"brother-of" : {
"@id" : "Alice",
"play-with" : "Natasha"
}
}
}
答案 0 :(得分:5)
此值被解释为纯文本,而不是URI:
"play-with" : "Natasha"
要将其解释为URI,可以在上下文中定义它:
"@context": {
"play-with": {
"@id": "http://example.com/play-with",
"@type": "@id"
}
}
或者您可以在提供值时将其明确显示(例如您已经为brother-of
做过):
"play-with" : {"@id": "Natasha"}