Hello !
Thanks for the infos so far.
What is the goal ?
So far we solve owl datas with jena-SPARQL. That was fine.
No, reasoner is required. No we must solve owl datas with reasoner.
The reasoner and the rules must return values like SPARQL.
So I try so implement owl-reasoner with jena.
No I change source and rules:
Owl model:
Classes Individuals
- insect insect1, insect2, insect3
- bush bush1
- tree tree1
Insect1 eats bush1.
Insect2 eats tree1.
Insect3 eats bush1 and tree1.
<?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="bush"/>
<owl:Class rdf:ID="tree"/>
<owl:Class rdf:ID="insect"/>
<owl:ObjectProperty rdf:ID="insectEatBush">
<rdfs:domain rdf:resource="#insect"/>
<rdfs:range rdf:resource="#bush"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:ID="insectEatTree">
<rdfs:range rdf:resource="#tree"/>
<rdfs:domain rdf:resource="#insect"/>
</owl:ObjectProperty>
<insect rdf:ID="insect2">
<insectEatTree>
<tree rdf:ID="tree1"/>
</insectEatTree>
</insect>
<insect rdf:ID="insect3">
<insectEatTree rdf:resource="#tree1"/>
<insectEatBush>
<bush rdf:ID="bush1"/>
</insectEatBush>
</insect>
<insect rdf:ID="insect1">
<insectEatBush rdf:resource="#bush1"/>
</insect>
</rdf:RDF>
<!-- Created with Protege (with OWL Plugin 3.4.3, Build 572)
http://protege.stanford.edu -->
Rules (so far unknown):
Rule 1: Return all insects who eats trees and bushes.
Rule 2: Return all insects who eats tree1 and bush1.
How to describe ?
The Source:
Model modelRes = ModelFactory.createDefaultModel();
//.createOntologyModel(OntModelSpec..OWL_MEM,null);
String fileOnto = "F:\\Projekte\\data\\Tiere.owl";
String fileRules = "demo.rules";
File merged = new File( fileOnto );
InputStream in = new FileInputStream( merged );
modelRes.read(in, fileOnto);
List<Rule> rules = Rule.rulesFromURL(fileRules);
GenericRuleReasoner reasoner = new GenericRuleReasoner(rules);
reasoner.setOWLTranslation(true);
reasoner.setTransitiveClosureCaching(true);
InfModel infModel = ModelFactory.createInfModel(reasoner, modelRes);
infModel.prepare();
infModel.write(System.out);
Greeting
Michael
P.S.
Is it possible to answer directly in
http://mail-archives.apache.org/mod_mbox/incubator-jena-users/201102.mbo
x/%3C1298386790.2594.33.camel@dave-desktop%3E ?