get wikipedia id-page using wikidata id

为君一笑 提交于 2020-04-17 21:13:40

问题


Using the sparql query below, I successfully got some of soccer players informations, then I tried to retrieve wikipedia page-id with wikidata Item-id, but it returns an error (java.util.concurrent.TimeoutException):

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dbo: <http://dbpedia.org/ontology/>

SELECT ?Wikidata_id ?SoccerPlayerLabel ?Team ?TeamLabel ?numMatches ?numGoals ?startTime ?article ?wikipedia_id WHERE {
  ?Wikidata_id wdt:P106 wd:Q937857;
               p:P54 ?stmt.  
               ?stmt ps:P54 ?Team; 
               pq:P1350 ?numMatches; 
               pq:P1351 ?numGoals; 
               pq:P580 ?startTime .  
               filter not exists {?Wikidata_id p:P54/pq:P580 ?startTimeOther filter(?startTimeOther > ?startTime)} 
               FILTER(?startTime >= "2019-01-01T00:00:00Z"^^xsd:dateTime).
               OPTIONAL { ?article schema:about ?Wikidata_id . 
               ?article schema:isPartOf <https://en.wikipedia.org/> . }
               SERVICE <http://dbpedia.org/sparql> {?dbpedia_id owl:sameAs ?Wikidata_id .?dbpedia_id dbo:wikiPageID ?wikipedia_id.}
               SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".} }

来源:https://stackoverflow.com/questions/60514757/get-wikipedia-id-page-using-wikidata-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!