英文:
Get marriage place through a Wikidata SPARQL query
问题
I'm trying desperately via a sparql query to get some info about Megan Markle's weddings like the location of the wedding, but I can't get it. Could you help me? This is what I tried to do:
我正在尝试通过SPARQL查询获取有关Megan Markle的婚礼信息,例如婚礼的地点,但我无法获取到。你能帮助我吗?以下是我尝试的内容:
SELECT ?place
WHERE
{
wd:Q152316 wdt:P26 [wdt:P2842 ?place].
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
英文:
I'm trying desperately via a sparql query to get some info about Megan Markle's weddings like the location of the wedding, but I can't get it. Could you help me? This is what I tried to do:
SELECT ?place
WHERE
{
wd:Q152316 wdt:P26 [wdt:P2842 ?place].
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
答案1
得分: 1
wdt:
用于指代简单的三元组。要访问限定词,您需要使用前缀 p:
和 pq:
。
在您的情况下,查询如下:
SELECT ?date ?place
WHERE {
wd:Q152316 p:P26 [
pq:P580 ?date;
pq:P2842 ?place
] .
}
查看此资源以深入了解这个主题。
额外信息:您可以在专门的项目中找到有关这个婚姻的更多数据(即 Q43890449,通过 P805 限定词可访问)。
因此,另一种查询如下:
SELECT ?date ?place
WHERE {
wd:Q152316 p:P26/pq:P805 ?marriage .
?marriage wdt:P585 ?date ;
wdt:P276 ?place .
}
英文:
wdt:
is used for referring to simple triples. You need prefixes p:
and pq:
to access a qualifier.
In your case, the query is the following one:
SELECT ?date ?place
WHERE {
wd:Q152316 p:P26 [
pq:P580 ?date;
pq:P2842 ?place
] .
}
Take a look at this resource for deepening the topic.
Extra info: you can find more data about this marriage in a dedicated item (i.e., Q43890449, which is accessible through the P805 qualifier).
Hence an alternative query is the following one:
SELECT ?date ?place
WHERE {
wd:Q152316 p:P26/pq:P805 ?marriage .
?marriage wdt:P585 ?date ;
wdt:P276 ?place .
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论