我有以下查询:
# endpoint used: https://query.wikidata.org/
#
# PREFIX wd: <http://www.wikidata.org/entity/>
# PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbp: <http://dbpedia.org/resource/>
SELECT DISTINCT ?musicianLabel
WHERE {
{
# *** dbpedia ***
SERVICE <http://dbpedia.org/sparql> {
#SERVICE <http://lod.openlinksw.com/sparql> {
?musician a dbo:Person .
{
# person, who has musical genre xy
?musician dbo:genre ?genre .
} UNION {
# the member (person) of a band, which has musical genre xy
?musician dbo:member|wdt:associatedBand ?band .
?band dbo:genre ?genre .
}
OPTIONAL {
?musician <http://www.w3.org/2000/01/rdf-schema#label> ?musicianLabel .
FILTER ( LANGMATCHES ( LANG ( ?musicianLabel ), 'en' ) )
}
FILTER ( ?genre IN (
dbp:Psychedelic_pop,
dbp:Psychedelic_rock,
#dbp:Psychedelic_Rock,
dbp:Acid_rock,
dbp:Psychedelic_folk,
dbp:Neo-psychedelia,
dbp:Space_rock,
dbp:Dream_pop
) )
}
} UNION {
# *** wikidata ***
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?musician wdt:P31 wd:Q5 ;
{
?musician wdt:P136 ?genre .
} UNION {
?musician wdt:P361|wdt:P463 ?band .
?band wdt:P136 ?genre .
}
FILTER ( ?genre IN (
wd:Q383982,
wd:Q206159,
wd:Q236932,
wd:Q1500364,
wd:Q703778,
wd:Q236913,
wd:Q592330
) )
}
}
GROUP BY ?musicianLabel
ORDER BY ASC(?musicianLabel)
我的问题是:
如何更改查询以使用http://lod.openlinksw.com/sparql而不是http://dbpedia.org/sparql以获得更多结果?
即使我使用DISTINCT和GROUP BY,结果列表中仍然出现不止一次的人(即“ Anton Newcombe”)。为什么?
在dbpedia中,资源可以具有多个URI,其中一些重定向到另一个。即dbp:Psychedelic_Rock
已附加资源,但重定向到dbp:Psychedelic_rock
,实际上似乎是一个人应该使用的URI。如何在查询中解决此问题,而不必首先手动使用DESCRIBE dbp:Psychedelic_Rock
查找?大概是dbo:wikiPageRedirects
左右?