dbpedia中的Wikidata查询等效项

时间:2019-01-15 09:39:36

标签: sparql dbpedia

我正在尝试将SPARQL查询从Wikidata转换为DBpedia(仅出于教育目的),但是它不起作用。有人可以帮助我,告诉我我做错了什么吗?谢谢!

http://query.wikidata.org

SELECT ?musician ?musicianLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    ?musician wdt:P31 wd:Q5 .
    ?musician wdt:P136 ?genre .
    FILTER(?genre IN (wd:Q383982, wd:Q206159))
}
GROUP BY ?musician ?musicianLabel
ORDER BY ASC(?musicianLabel)

工作

...和http://lod.openlinksw.com/sparql

SELECT ?musician WHERE {
    ?musician a <http://dbpedia.org/resource/Person> .
    ?musician <http://dbpedia.org/resource/Genre> <http://dbpedia.org/resource/Genre> .
    FILTER(<http://dbpedia.org/resource/Genre> IN (<http://dbpedia.org/resource/Psychedelic_Pop>, <http://dbpedia.org/resource/Psychedelic_Rock>))
}
GROUP BY ?musician
ORDER BY ASC(?musician)

不起作用

1 个答案:

答案 0 :(得分:1)

我不确定您为什么从适应的查询中删除了标签...请尝试thisresults

SELECT DISTINCT ?musician ?musicianlabel 
WHERE
 { ?musician a <http://dbpedia.org/ontology/Person> . 
   ?musician <http://dbpedia.org/ontology/genre> ?genre .
   OPTIONAL { ?musician <http://www.w3.org/2000/01/rdf-schema#label> ?musicianlabel . 
              FILTER ( LANGMATCHES ( LANG ( ?musicianlabel ), 'en' ) ) 
            }
   FILTER (?genre IN ( <http://dbpedia.org/resource/Psychedelic_pop> , 
                       <http://dbpedia.org/resource/Psychedelic_rock>
                     )
          )
 } 
ORDER BY ASC ( ?musician )