查询DBpedia以获取不同输入的摘要 [英] Query DBpedia to get abstract for different inputs
问题描述
我有一个问题,我需要对DBpedia建立一个查询,这样,如果我输入其中任何一个作为输入,例如城市名称或人名,研究所名称或乐器名称,我可以得到其摘要为输出??? 例如, 纽约州-纽约州是美国东北和中大西洋地区的州... 火星-火星是距太阳第四的行星,也是太阳系中第二小的行星. 迈克尔·杰克逊(Michael Jackson)-迈克尔·约瑟夫·杰克逊(Michael Joseph Jackson)是美国歌手,词曲作者,舞蹈演员和演员...
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")
}
推荐答案
如果要获取多个事物的摘要,请在VALUES
块中提供这些多个事物.我发现?name
的匹配对于基于名称的搜索足够有效.
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
这篇关于查询DBpedia以获取不同输入的摘要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!