我有以下查询:
# 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
?