-1

这个好像比较简单,查询巴拉克奥巴马的出生日期,为什么在https://query.wikidata.org/上要这么长时间才超时?只有大约 3 个实体带有 Barack Obama 的标签,还有大约 2 个带有“出生日期”的标签

SELECT DISTINCT ?ent ?wdtProperty ?val ?valLabel WHERE { 
  
  ?ent rdfs:label|skos:altLabel "Barack Obama"@en. 
  ?wdProperty1 rdfs:label|skos:altLabel "date of birth"@en; 
  wikibase:directClaim ?wdtProperty1. 
  ?ent ?wdtProperty1 ?val . 
                                                         
} LIMIT 10
4

1 回答 1

-1

这个问题的正确答案是

SELECT DISTINCT ?ent ?wdtProperty1 ?val
WITH
{
  SELECT ?wdtProperty1
  WHERE
  {
    [] rdfs:label|skos:altLabel "date of birth"@en; 
       wikibase:directClaim ?wdtProperty1. 
  }
} AS %get_predicate
WITH
{
  SELECT ?ent
  WHERE
  {
    ?ent rdfs:label|skos:altLabel "Barack Obama"@en. 
  }
} AS %get_subject
WHERE
{ 
  INCLUDE %get_predicate
  INCLUDE %get_subject
  ?ent ?wdtProperty1 ?val .
}

感谢https://www.wikidata.org/wiki/Wikidata:Request_a_query#Slow_query_on_label

于 2020-11-13T12:50:35.577 回答