Query DBpedia to get abstract for different inputs

空扰寡人 提交于 2019-12-11 16:26:09

问题


I have a question I need to build a single query to DBpedia such that, If I give any one of these as input like a City name or a person name or a Institute name or a Instrument name can I get its abstract as a output??? For instance, New York- New York is a state in the Northeastern and Mid-Atlantic regions of the United States...... Mars- Mars is the fourth planet from the Sun and the second smallest planet in the Solar System.... Michael Jackson- Michael Joseph Jackson was an American singer, songwriter, dancer, and actor......

I have tried but its not working for all.

 SELECT ?abstract WHERE { 
 <http://dbpedia.org/resource/New_York> 
 <http://dbpedia.org/ontology/abstract> 
 ?abstract
 FILTER langMatches(lang(?abstract), "en")
 }

回答1:


If you intend to get the abstract for multiple things, supply those multiple things within a VALUES block. I found that matching by ?name worked sufficiently well for name-based searches.

SELECT DISTINCT ?abstract WHERE { 
  [ rdfs:label ?name
  ; dbpedia-owl:abstract ?abstract
  ] .
  FILTER langMatches(lang(?abstract),"en")
  VALUES ?name { "New York"@en }
}
LIMIT 10


来源:https://stackoverflow.com/questions/25920496/query-dbpedia-to-get-abstract-for-different-inputs

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