0
我試圖從給出他的wikiPageID的dbpedia查詢某個特定人的數據。我試過這個SPARQL查詢來查詢邁克爾傑克遜:給定它的wikiPageID查詢Dbpedia資源不適用於某些ID
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbp: <http://dbpedia.org/property/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?name (SAMPLE (?photoLink) as ?photo) (SAMPLE (?occupation) as occup)
(SAMPLE (?spouse) as ?spouses) (SAMPLE (?spName) as ?sname)
(SAMPLE (?spOccupation) as ?spOccu) (SAMPLE (?deathPlace) as ?death)
(SAMPLE(?birthPlace) as ?birth) (SAMPLE(?deathDate) as ?dDate)
(SAMPLE(?birthDate) as ?bDate) {
VALUES ?wikiPageID { 14995351 }
?res a dbo:Person.
?res dbp:name ?name.
?res dbo:wikiPageID ?wikiPageID.
?res dbp:birthPlace ?birthPlace.
?res dbp:birthDate ?birthDate. OPTIONAL{?res dbo:occupation ?occupation}.
OPTIONAL{?res dbo:thumbnail ?photoLink}.
OPTIONAL{?res dbo:spouse ?spouse. ?spouse dbp:name ?spName.
?spouse dbo:occupation ?spOccupation}.
OPTIONAL{?res dbp:deathDate ?deathDate. ?res dbp:deathPlace ?deathPlace}.
}
GROUP BY (?name)
查詢返回空結果。但是,當我改變其他人的wikiPageID
(如託比馬奎爾 - 163228)它的作品。造成差異的原因是什麼?
DBpedia數據不完整,異質且嘈雜。永遠別忘了。 – AKSW
這還不清楚爲什麼你使用'dbp'作爲'birthDate'和'birthPlace'。爲什麼不用'rdfs:label'作爲名字。 – AKSW
爲什麼你按名稱而不是URI,即'?res'? – AKSW