JSON-LD的错误展开
Wrong expansion of JSON-LD
我正在学习使用 JSON-LD,但我被这个问题困住了。这是我的文档...
{
"@context": {
"dbr": "http://dbpedia.org/resource/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"italy": "dbr:Italy_national_football_team",
"ita_player_base_url": "italy:/",
"foaf": "http://xmlns.com/foaf/0.1/",
"team": "foaf:Organization",
"player": "foaf:Person",
"player_of": {
"@id": "foaf:member",
"@type": "@id"
},
"plays_with": {
"@id": "foaf:knows",
"@type": "@id"
},
"name": {
"@id": "foaf:name",
"@type": "xsd:string"
},
"number": {
"@id": "foaf:status",
"@type": "xsd:positiveInteger"
}
},
"@graph": [{
"name": "Buffon",
"number": "1",
"@type": "player",
"player_of": "italy",
"@id": "ita_player_base_url:Buffon"
}, {
"name": "Insigne",
"number": "20",
"@type": "player",
"player_of": "italy",
"@id": "ita_player_base_url:Insigne",
"plays_with": "ita_player_base_url:Buffon"
}]}
然后,如果我将其粘贴到 JSON-LD 到 GIF 服务(或其他所有内容),我会发现播放器是 "player_of":"domainOfTheValidator/italy"
而不是 "player_of":"http://dbpedia.org/resource/Italy_national_football_team"
为什么会这样?显然,如果我把 "player_of": "dbr:Italy_national_football_team"
而不是 "player_of": "italy"
就可以了……我快疯了。
A compact IRI 由一个前缀、后跟 :
、后跟一个后缀组成。
使用 "italy": "dbr:Italy_national_football_team"
定义前缀 (italy
)。当你想在一个值中使用它时,你必须使用冒号 (:
) 后跟一个后缀(在你的例子中是空的)。
所以
"player_of": "italy",
你必须使用
"player_of": "italy:",
我正在学习使用 JSON-LD,但我被这个问题困住了。这是我的文档...
{
"@context": {
"dbr": "http://dbpedia.org/resource/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"italy": "dbr:Italy_national_football_team",
"ita_player_base_url": "italy:/",
"foaf": "http://xmlns.com/foaf/0.1/",
"team": "foaf:Organization",
"player": "foaf:Person",
"player_of": {
"@id": "foaf:member",
"@type": "@id"
},
"plays_with": {
"@id": "foaf:knows",
"@type": "@id"
},
"name": {
"@id": "foaf:name",
"@type": "xsd:string"
},
"number": {
"@id": "foaf:status",
"@type": "xsd:positiveInteger"
}
},
"@graph": [{
"name": "Buffon",
"number": "1",
"@type": "player",
"player_of": "italy",
"@id": "ita_player_base_url:Buffon"
}, {
"name": "Insigne",
"number": "20",
"@type": "player",
"player_of": "italy",
"@id": "ita_player_base_url:Insigne",
"plays_with": "ita_player_base_url:Buffon"
}]}
然后,如果我将其粘贴到 JSON-LD 到 GIF 服务(或其他所有内容),我会发现播放器是 "player_of":"domainOfTheValidator/italy"
而不是 "player_of":"http://dbpedia.org/resource/Italy_national_football_team"
为什么会这样?显然,如果我把 "player_of": "dbr:Italy_national_football_team"
而不是 "player_of": "italy"
就可以了……我快疯了。
A compact IRI 由一个前缀、后跟 :
、后跟一个后缀组成。
使用 "italy": "dbr:Italy_national_football_team"
定义前缀 (italy
)。当你想在一个值中使用它时,你必须使用冒号 (:
) 后跟一个后缀(在你的例子中是空的)。
所以
"player_of": "italy",
你必须使用
"player_of": "italy:",