通过Wikidata的SPARQL查询获取婚姻地点

huangapple go评论44阅读模式
英文:

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 .
}

huangapple
  • 本文由 发表于 2023年6月21日 22:54:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76524633.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定