On Tue, 2011-02-22 at 00:00 +0100, Burkert, Michael wrote: 
> Hello !
> 
> 
> A question.
> 
> How to use owl-reasoner with jena ?
> practical
> 
>  
> 
> owl model:  ("beatle eat tree")
> 
> <?xml version="1.0"?>
> <rdf:RDF
>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
>     xmlns:owl="http://www.w3.org/2002/07/owl#";
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema#";
>     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
>     xmlns="http://www.Test.com/Test1#";
>   xml:base="http://www.Test.com/Test1";>
>   <owl:Ontology rdf:about=""/>
>   <owl:Class rdf:ID="insect"/>
>   <owl:Class rdf:ID="plant"/>
>   <owl:ObjectProperty rdf:ID="insectEatPlant">
>     <rdfs:domain rdf:resource="#insect"/>
>     <rdfs:range rdf:resource="#plant"/>
>   </owl:ObjectProperty>
>   <insect rdf:ID="beatle">
>     <insectEatPlant>
>       <plant rdf:ID="tree"/>
>     </insectEatPlant>
>   </insect>
> </rdf:RDF>
> 
>  
> 
> 
> 
> 
> source: (OK ?)
> 
> String fileOnto = "C:\\data\\test.owl"; 
> String fileRules = "demo.rules"; 
> 
> OntModelSpec spec = new OntModelSpec(OntModelSpec.OWL_DL_MEM);
> Resource configuration = modelRes.createResource();
> configuration.addProperty(ReasonerVocabulary.PROPruleMode, "hybrid");
> configuration.addProperty(ReasonerVocabulary.PROPruleSet, "demo.rules");
> GenericRuleReasoner reasoner = (GenericRuleReasoner)
> GenericRuleReasonerFactory.theInstance().create(configuration);
> spec.setReasoner(reasoner);
> OntModel model = ModelFactory.createOntologyModel(spec);
> model.read( in, fileOnto );
> model.prepare();

[Aside: this does no harm but is not required, prepare is implicitly
called anytime you ask for something from the model.]

> model.write(System.out);

Your message talks about the OWL reasoner but your code is using your
own rules. Which are you trying to do?

If you want to add your own rules but build then on the OWL rules then
you need to enable some more parameters in the GenericRuleReasoner, see:
http://jena.sourceforge.net/inference/index.html#RDFSPlusRules


> Questions:
> 
> - Is the source to change ?

?

> - OntModelSpec.OWL_DL_MEM oder OntModelSpec.OWL_MEM ?

Either. It makes no difference to the inference and only a very slight
different to the profile of API operations. Since the rule-based
reasoners are all OWL/Full I tend to use OWL_MEM as the OntModelSpec.

> - What rules for example can define ?

What's the question?

Dave


Reply via email to