开发者

OWLS Grounding document parsing with Jena

开发者 https://www.devze.com 2023-03-14 00:37 出处:网络
I\'ve got a problem while parsing a OWLS Document (RDF) with Jena. The document is the OWLS Grounding, there are a piece of code of my interest:

I've got a problem while parsing a OWLS Document (RDF) with Jena.

The document is the OWLS Grounding, there are a piece of code of my interest:

<grounding:WsdlAtomicProcessGrounding rdf:ID="wsdl_Grounding">  
 <grounding:owlsProcess rdf:resource="process"/>                             
  <grounding:wsdlOperation>    
   <grounding:WsdlOperationRef>
     <grounding:portType rdf:datatype="&xsd;#anyURI">&WSDL;#operationPort</grounding:portType>
     <grounding:operation rdf:datatype="&xsd;#anyURI">&WSDL;#operationPort</grounding:operation>
   </grounding:WsdlOperationRef>        
  </grounding:wsdlOperation>
  ...(the OWLS Grounding continues)

I want to get the "portType" value, but if I try with the next SPARQL code I've got no results.

PREFIX grounding: "http://www.daml.org/services/owl-s/1.2/Grounding.owl"
SELECT ?x y? 
WHERE  {
           ?x grounding:hasAtomicProcessGrounding/grounding:wsdlOperation/grounding:WsdlOperationRef/grounding:portType ?y
       };

All the queries I build works except this kind of query, which have chained prope开发者_如何学运维rties, in my case the chained properties are; wsdlOperation, WsdlOperationRef, and portType.

Thanks in advance ;)


You need to ensure that you are using SPARQL 1.1 syntax. The default is SPARQL 1.0, which does not support property paths. Use the API calls which accept a com.hp.hpl.jena.query.Syntax parameter, and pass the syntaxSPARQL_11 constant.


Are you sure chained properties work? What if you try spell out the intermediate concepts:

PREFIX grounding: "http://www.daml.org/services/owl-s/1.2/Grounding.owl"
SELECT ?x y? 
WHERE
{
  ?x grounding:hasAtomicProcessGrounding ?apg .
  ?apg grounding:wsdlOperation ?op .
  ?op grounding:WsdlOperationRef ?or .
  ?or grounding:portType ?y .
}


Thanks to all but I've found the solution.

I've try the solution of RobV, but It doesn't work, so I started to repeat the query with less conditions, and I've found that with the following query Jena returns _:b0.

PREFIX grounding: "http://www.daml.org/services/owl-s/1.2/Grounding.owl" SELECT ?op WHERE { ?x grounding:hasAtomicProcessGrounding ?apg . ?apg grounding:wsdlOperation ?op }

And I see that Jena use that value for the next part of the query ?op grounding:WsdlOperationRef ?or . (with ?op == _:b0) and don't find the next property.

But the problem was that when I ask for "grounding:wsdlOperation" Jena returns a reference for the "grounding:WsdlOperationRef" object acting "_:b0" as a subject for the next part of the failed query, so I can't ask for "grounding:WsdlOperationRef" because this element was the subject reference I've obtained before.

So the solution is the next one (without the "WsdlOperationRef" property):

PREFIX grounding: "http://www.daml.org/services/owl-s/1.2/Grounding.owl" SELECT ?x y? WHERE { ?x grounding:hasAtomicProcessGrounding ?apg . ?apg grounding:wsdlOperation ?op. ?op grounding:portType ?y . }

0

精彩评论

暂无评论...
验证码 换一张
取 消