AMANI M ALHARBI
AMANI M ALHARBI

Reputation: 11

Can SPARQL be used to query owl axioms?

I want to represent scientific sources and confident information for all relationships in my ontology using protégé editor. To do this, I created an annotation property (hasScientificevidence) that relates each RDFstatment (subject, predicate, object) in my ontology to its scientific source. Now I want to make a SPARQL query and retrieve the scientific evidence that I was asserted. For example:

###  http://www.owl-ontologies.com/DPDAPO#Boron_Deficiency
dp:Boron_Deficiency rdf:type owl:NamedIndividual ,
                             dp:Micronutrient_Deficiency .

[ rdf:type owl:Axiom ;
   owl:annotatedSource dp:Boron_Deficiency ;
   owl:annotatedProperty rdf:type ;
   owl:annotatedTarget dp:Micronutrient_Deficiency ;
   dp:hasScientificevidence dp:Scientific_Evidence_7
 ] .

Here I want to make a SPARQL query to find out the type of Boron_Deficiency and what is the Scientific evidence for that. I tried to do this SPARQL query to get the result but it didn't work:

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dp: <http://www.owl-ontologies.com/DPDAPO#>
 
SELECT  ?x  ?Scientificevidence
WHERE { dp:Boron_Deficiency rdf:type  ?x;
           dp:hasScientificevidence ?Scientificevidence.}
   

If there is any way to get the correct result, or another way to add the source information other than the method I used, please provide it to me.

Thank you.

Upvotes: 1

Views: 260

Answers (1)

IS4
IS4

Reputation: 13187

Your query can be easily fixed to match the RDF data you provided. The query you tried looks for dp:Boron_Deficiency dp:hasScientificevidence ?Scientificevidence, but you need to look for the owl:Axiom about it:

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dp: <http://www.owl-ontologies.com/DPDAPO#>
 
SELECT ?x ?Scientificevidence
WHERE {
  dp:Boron_Deficiency rdf:type ?x .
  OPTIONAL {
    ?axiom a owl:Axiom ;
      owl:annotatedSource dp:Boron_Deficiency ;
      owl:annotatedProperty rdf:type ;
      owl:annotatedTarget ?x ;
    ?axiom dp:hasScientificevidence ?Scientificevidence .
  }
}

Upvotes: 0

Related Questions