i'm querying dbpedia types in sparql (http://dbpedia.org/sparql) resource's label
prefix owl: <http://www.w3.org/2002/07/owl#> prefix xsd: <http://www.w3.org/2001/xmlschema#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix foaf: <http://xmlns.com/foaf/0.1/> prefix dc: <http://purl.org/dc/elements/1.1/> prefix skos: <http://www.w3.org/2004/02/skos/core#> prefix : <http://dbpedia.org/resource/> prefix ru: <http://ru.dbpedia.org/resource/> prefix dbpedia2: <http://dbpedia.org/property/> prefix dbpedia: <http://dbpedia.org/> prefix dbo: <http://dbpedia.org/ontology/> select ?type ?supertype { { ?res rdfs:label "harrypotter"@en. } union { ?redir dbo:wikipageredirects ?res . ?redir rdfs:label "harrypotter"@en . } ?res rdf:type ?type . optional { ?type rdfs:subclassof ?supertype . } }
but if know exact resource - http://dbpedia.org/page/harry_potter? tried like:
?res :harry_potter.
but not work.
how query dbpedia types , supertypes if know resource uri? can't figure out property or operator should use (e.g., rdfs:resource
, a
, etc., not work)
when write
?res :harry_potter.
it doesn't work, because means "a resource, of type :harry_potter". equivalent to
?res rdf:type :harry_potter.
:harry_potter
identifies resource , not type, should used in place of ?res
.
also think mean harry_potter_(character)
, because actual identifier , not redirect.
you query simple as
select ?type ?supertype { # give me ?type of resource <http://dbpedia.org/resource/harry_potter_(character)> rdf:type ?type . # give me ?supertypes of ?type optional { ?type rdfs:subclassof ?supertype . } }
Comments
Post a Comment