You've got an interactive webservice in front of you, and one of the most useful things that you can do is generalize your query into one that should return a superset of the results you're looking for, as a sort of sanity check. In this case, it's useful to see what happens if you ask for all properties and values of dbpedia:Cupertino
.
select ?p ?o where {
dbpedia:Cupertino ?p ?o
}
SPARQL results
p o
http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Thing
http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://dbpedia.org/ontology/Place
http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://dbpedia.org/ontology/PopulatedPlace
http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://dbpedia.org/ontology/Settlement
http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://schema.org/Place
http://dbpedia.org/ontology/wikiPageID 337802
http://dbpedia.org/ontology/wikiPageRevisionID 16202923
http://www.w3.org/2000/01/rdf-schema#label "Cupertino"@en
http://dbpedia.org/ontology/wikiPageRedirects http://dbpedia.org/resource/Cupertino,_California
http://xmlns.com/foaf/0.1/isPrimaryTopicOf http://en.wikipedia.org/wiki/Cupertino
http://www.w3.org/ns/prov#wasDerivedFrom http://en.wikipedia.org/wiki/Cupertino?oldid=16202923
In this case, that dbpedia-owl:wikiPageRedirects
is very important. When you type in dbpedia:Cupertino
or the full URI, http://dbpedia.org/resource/Cupertino, into a web browser, look carefully at where you end up. You end up at http://dbpedia.org/page/Cupertino,_California, which means that the resource you're actually asking about is http://dbpedia.org/resource/Cupertino,_California (when you retrieve them in a browser, you're redirected from /resource/
to /page/
, but the naming convention is still the same.
To use dbpedia:Cupertino
in a query, you'd need to add the redirect information. Thus, you could use the following query to get the results that you're looking for:
select ?type where {
dbpedia:Cupertino dbpedia-owl:wikiPageRedirects*/dbpedia-owl:type ?type
}
SPARQL results
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…