I have the following graph for a SKOS term. I have created a SKOS ontology, and a data property assertion "definition" to add definitions to terms, in addition to another data property as a subProperty of skos:altLabel
(address), How can I create a SPARQL query which select a prefLabel
, address
and the definition
of terms?
<skos:concept rdf:about="&Ontology129;Zoology">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&owl;Thing"/>
<skos:altlabel xml:lang="en">animal biology</skos:altlabel>
<definition xml:lang="en">the branch of biology that studies animals</definition>
<Address rdf:datatype="&xsd;long">123</Address>
<skos:altlabel xml:lang="en">zoological science</skos:altlabel> <skos:preflabel
xml:lang="en">zoology</skos:preflabel>
<skos:broader rdf:resource="&Ontology129;Biology"/>
<skos:inscheme rdf:resource="&Ontology129;ScientificDisciplines"/>
</skos:concept>
Bad Data
You haven't provided a complete RDF/XML document, so it's hard to tell exactly what's going on, but some of your RDF/XML looks very questionable. For the types in:
do not look right. I think you're trying to say that some resource identified by an IRI ending in
Zoology
is anowl:Thing
and anowl:NamedIndividual
, but those would be the the IRIsbut you're using the (not quite) IRIs
You've also got some relative IRIs (unless you've specified an
xml:base
in your document but, again, you didn't post a whole document):A SPARQL query
I think you wanted data that is something more like:
It's often helpful to look at data in Turtle format when you're writing a SPARQL query, because the SPARQL pattern language and the Turtle syntax are very similar. The data in Turtle is:
The SPARQL query looks a lot like the data:
The results are: