[Pellet-users] pellet with jena rule engine
Evren Sirin
evren at clarkparsia.com
Thu Mar 1 22:36:17 UTC 2007
When you try to load an inference model to a Pellet-backed model it will
just load the base model. The reason is InfModels backed by Jena
reasoners typically contains the built-in RDF and RDF-S vocabulary
(which are of course not in OWL-DL) and this causes a problem. I think
in your example there wouldn't be any problem loading the InfModel but
Pellet is being overly cautious. You might try to materlize the
inferences of the rule reasoner in a default model and load it to Pellet.
If you want to try the DL-safe support of Pellet (is this what you mean
by loadRule?) the latest version at the SVN supports reading SWRL rules
from Jena directly. The steps you need to do:
1) Create a file family.swrl and turn your rule into SWRL syntax (you
can put the SWRL rule inside family.owl, too)
2) Create a Pellet model as you do below
3) Read both files into the model
That should be enough. when you query the model you should see the
inferences coming from rules.
Hope this helps,
Evren
On 2/26/07 7:13 AM, Teresa Gianna wrote:
> Hi to all
>
> I don't undenstand how use in Jena Pellet with a rule reasoner .
> I report below the code :
>
> private static String ns = "http://a.com/ontology#
> <http://a.com/ontology#>";
>
> public static void main(String[] args) {
> OntModel m = createRuleModel();
> m.read("file:/D:/family.owl");
> ....... //operations
> m.close();
> }
>
> public static OntModel createRuleModel(){
> PrintUtil.registerPrefix("family", ns);
> String rules = "[rule1: (?z,family:hasChild,?y)
> (?z,family:hasConsort,?x)->(?x,family:hasChild,?y)]";
> Reasoner ruleReasoner = new
> GenericRuleReasoner(Rule.parseRules(rules));
> ruleReasoner.setDerivationLogging(true);
> OntModelSpec spec = new
> OntModelSpec(OntModelSpec.OWL_DL_MEM_RULE_INF);
> spec.setReasoner(ruleReasoner);
> OntModel base = ModelFactory.createOntologyModel(spec);
> OntModelSpec pelletSpec = PelletReasonerFactory.THE_SPEC;
> OntModel m = ModelFactory.createOntologyModel( pelletSpec );
> m.addSubModel(base, true);
> return m;
> }
>
>
> I have read that method 'add' delete old model instead of add hit. I
> have also read that exist a method 'loadRule' but I don't understand
> how use it in above code. Somebody can help me ?
>
>
> Thanks in advantace
> ------------------------------------------------------------------------
>
> _______________________________________________
> Pellet-users mailing list
> Pellet-users at lists.owldl.com
> http://lists.owldl.com/mailman/listinfo/pellet-users
> _______________________________________________
>
> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/
More information about the Pellet-users
mailing list