问题
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