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();
model.write(System.out);

 


Questions:

- Is the source to change ?
- OntModelSpec.OWL_DL_MEM oder OntModelSpec.OWL_MEM ?
- What rules for example can define ?

Thank you.


greeting
Michael

 

Reply via email to