ashutosh
ashutosh

Reputation: 1

unable to get results while performing sparql query

I am trying a sparql query to fetch the tracking_note instance,object properties and datatype properties value.

<Tracking_Note rdf:about="#tracking_note1">
  <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
  <rdf:type>
    <owl:Restriction>
      <owl:onProperty 
rdf:resource="#Tracking_NotedependsonFailure_Snippet"/>
      <owl:hasValue rdf:resource="#failure_snippet1"/>
    </owl:Restriction>
  </rdf:type>
  <rdf:type>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#Tracking_NotedependsonModule"/>
      <owl:hasValue rdf:resource="#module1"/>
    </owl:Restriction>
  </rdf:type>
  <rdf:type>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#Tracking_NoteBelongsToModule"/>
      <owl:hasValue rdf:resource="#module1"/>
    </owl:Restriction>
  </rdf:type>
  <hasTracking_Note 
    rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Rerun 
    candidate</hasTracking_Note>
</Tracking_Note>

Sparql query I tried is:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX log: <D:/Spyder_Workspace/Generic_Implementation/project1.owl#>
PREFIX rlog: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog#>

SELECT ?tn ?fs ?value
WHERE {
?tn log:hasTracking_Note ?value ;
owl:onProperty log:Tracking_NotedependsonFailure_Snippet ;
 owl:hasValue ?fs  

}   

but I am not getting any values.

Upvotes: 0

Views: 37

Answers (1)

UninformedUser
UninformedUser

Reputation: 8465

The values you want are wrapped in a property restriction construct, thus, you need one more step in your SPARQL query.

The query should be something like (untested due to missing Turtle data):

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX log: <D:/Spyder_Workspace/Generic_Implementation/project1.owl#>

SELECT ?tn ?fs ?value
WHERE {
?tn log:hasTracking_Note ?value ;
    a [owl:onProperty log:Tracking_NotedependsonFailure_Snippet ;
       owl:hasValue ?fs
      ]  
}  

Minor comment: Look at your data in N-Triples or Turtle syntax. Those are much closer to the SPARQL query triple pattern syntax. RDF/XML is more or less made for tools but not for humans.

Upvotes: 1

Related Questions