I try to write a query in SPARQL in DBpedia to return all the info for high schools in a certain country. I run the query on snorql here link, but it returns "no results". I cannot find any error on my query. Can anyone help?
SELECT ?school
WHERE {
?school a owl:school.
?school owl:location ?city.
?city owl:isPartOf ?state.
?state owl:country <http://dbpedia.org/resource/United_States>.
}
Edit:
You seem to be mistaken about the ontologies you should be using. You are using various identifiers from the namespace mapped to the prefix owl
, namely:
owl:school
owl:location
owl:isPartOf
owl:country
However, as you do not specify a custom prefix mapping, the default mapping is used, according to which owl
is mapped to http://www.w3.org/2002/07/owl#
, which is OWL 2. OWL 2 does not contain any definitions for the listed identifiers, and DBpedia accordingly does not use these identifiers.
DBpedia does use the identifiers School
, location
, isPartOf
and country
from the namespace http://dbpedia.org/ontology/
, which is mapped to the prefix dbpedia-owl
. Therefore, in your query, just use the prefix for the ontology you actually want to use. Furthermore, note that the class dbpedia-owl:School
is capitalized, dbpedia-owl:school
with a small s is a property.
SELECT ?school
WHERE {
?school a dbpedia-owl:School.
?school dbpedia-owl:location ?city.
?city dbpedia-owl:isPartOf ?state.
?state dbpedia-owl:country <http://dbpedia.org/resource/United_States>.
}