2016-07-15 6 views
1

Ich lerne, mit JSON-LD zu arbeiten, und ich stecke auf dieses Problem fest. Dies ist mein Dokument ...Falsche Erweiterung von 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" 
}]} 

Dann, wenn ich es zu einem JSON-LD zu GIF-Dienst (oder alles andere) einfügen ich, dass die Spieler sind "player_of":"domainOfTheValidator/italy" statt "player_of":"http://dbpedia.org/resource/Italy_national_football_team" Warum ist das passiert? Offensichtlich, wenn ich "player_of": "dbr:Italy_national_football_team" statt "player_of": "italy" setze, funktioniert es ... Ich werde verrückt.

Antwort

0

Ein compact IRI besteht aus einem Präfix, gefolgt von :, gefolgt von einem Suffix.

Mit "italy": "dbr:Italy_national_football_team" definieren Sie das Präfix (italy). Wenn Sie es in einem Wert verwenden möchten, müssen Sie den Doppelpunkt (:) gefolgt von einem Suffix (das in Ihrem Fall leer ist) verwenden.

Also statt

"player_of": "italy", 

würden Sie

"player_of": "italy:", 
+0

Randnotiz verwenden: Ist Ihnen bewusst, dass zum Beispiel 'http: // dbpedia.org/resource/Italien_national_football_team/Buffon' existiert nicht? Du meinst wahrscheinlich "http: // dbpedia.org/resource/Gianluigi_Buffon". – unor

+0

Ja, jetzt habe ich verstanden! Vielen Dank, du hast meinen Tag gemacht! – Riccardo