How do I write a SPARQL query? [closed]
How would I make a SPARQL query about rivers that flow into the Rhine, that are longer than 50 kilometers?
Using DBpedia you could do something like this...
SELECT ?river ?riverName ?length
WHERE {
?river <http://dbpedia.org/ontology/riverMouth> <http://dbpedia.org/resource/Rhine> .
?river <http://dbpedia.org/ontology/length> ?length .
FILTER (?length > 50000)
?river <http://www.w3.org/2000/01/rdf-schema#label> ?riverName .
FILTER (lang(?riverName) = "en")
}
ORDER BY ?riverName
I'm assuming the length property in DBpedia uses meters, but you should check. You can test the query at http://dbpedia.org/sparql.
If this was homework and I just gave you the answer, I'd encourage you browse around at http://dbpedia.org/page/Rhine to see how I came up with it :)
精彩评论