2017-06-26 37 views
-1
SELECT ?name ?birth ?person ?subject 

WHERE {  ?person dbo:birthPlace :London .  ?person 

dbo:birthDate ?birth .  ?person foaf:name ?name . 

?person dct:subject :English_rock_singers. ?person dct:subject ? 

subject. } ORDER BY ?name 

此查询仅在删除“主题”时有效。 有没有办法用类别查询dbpedia?查询SPARQL不适用于“dct:subject”

+1

是[此输出(https://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT+%3Fname+%3Fbirth++%3Fperson+% 3Fsubject%0D%0A%0D%0AWHERE +%7B%0D%0A%3Fperson + DBO%3AbirthPlace + DBR%3ALondon +。%0D%0A%3Fperson + DBO%3AbirthDate +%3Fbirth +。%0D%0A%3Fperson + FOAF%3Aname +% 3Fname + ++。%0D%0A%0D%0A%3Fperson + DCT%3Asubject + DBC%3AEnglish_rock_singers。%0D%0A%3Fperson + DCT%3Asubject +%3Fsubject。+++%7D%0D%0AORDER + BY +%3Fname% 0D%0A&format = text%2Fhtml&CXML_redir_for_subjs = 121&CXML_redir_for_hrefs =&timeout = 30000&debug = on)你想要什么? –

回答

0

虽然你的问题并不清楚,但我认为你的问题是格式化查询和定义前缀。这应该工作:

PREFIX dbo: <http://dbpedia.org/ontology/> 
PREFIX foaf: <http://xmlns.com/foaf/0.1/> 
PREFIX dct: <http://purl.org/dc/terms/> 
PREFIX dbr: <http://dbpedia.org/resource/> 
PREFIX dbc: <http://dbpedia.org/resource/Category:> 

SELECT ?name ?birth ?person ?subject WHERE { 

    ?person dbo:birthPlace dbr:London. 
    ?person dbo:birthDate ?birth.  
    ?person foaf:name ?name. 
    ?person dct:subject dbc:English_rock_singers. 
    ?person dct:subject ?subject. 
} 
ORDER BY ?name