[Pellet-users] Inference problem
Role Francois
francois.role at univ-paris5.fr
Tue Sep 25 17:09:23 UTC 2007
> Recheck your Java code and I think you will find that Pellet gave you
> exactly what you asked it for about Pierre. :)
Sorry. I indeed mistook parent for uncle... Thanks. It works now.
> You may already be aware of this and simply testing rules, but your
> second rule (A Boy is a Person) is expressible in plain OWL withou
Yes I wanted to mimic subsomption using rules.
François
>
> -Brandon :)
>
>
>> -----Original Message-----
>> From: pellet-users-bounces at lists.owldl.com
>> [mailto:pellet-users-bounces at lists.owldl.com] On Behalf Of
>> Role Francois
>> Sent: Monday, September 24, 2007 5:55 AM
>> To: pellet-users at lists.owldl.com
>> Subject: [Pellet-users] Inference problem
>>
>> Hi,
>>
>>
>>
>> Thanks for your previous reply.
>> I am now starting to write and run two simple swrl rules,
>> using a slightly
>> modified version of Rulesexample.java (source and rules below).
>>
>>
>>
>> I want the Reasoner to infer :
>>
>>
>>
>> - that Luc is a person (given that he is a Boy = BoyRule)
>> = it works
>>
>> - that Jacques is Pierre's uncle (standard UncleRule) = it
>> does not work
>>
>>
>>
>> The call to "printPropertyValues( Pierre, uncle );"
>> prints "Pierre
>> has parent(s): Paul" ??
>>
>> There are also some "Consistency not" messages in the output,
>> that worry me.
>>
>>
>>
>> run:
>>
>> .................................
>>
>> 2 Properties: 3 Individuals: 4 Strategy: RuleStrategy
>>
>> [java] INFO [main] (ABox.java:1530) - ABox consistency for 0
>> individuals
>>
>> [java] INFO [main] (ABox.java:1619) - Consistent: true
>> Tree depth: 5
>> Tree
>>
>> size: 16 Time: 47
>>
>> [java] Pierre has parent(s): Paul
>>
>> [java] INFO [main] (ABox.java:1532) - Consistency
>> not(http://localhost/ess
>>
>> ai.owl#Person) for 0 individuals []
>>
>> [java] INFO [main] (ABox.java:1619) - Consistent: true
>> Tree depth: 1
>> Tree
>>
>> size: 1 Time: 15
>>
>> [java] INFO [main] (ABox.java:1532) - Consistency
>> http://localhost/essai.o
>>
>> wl#Person for 0 individuals []
>>
>> [java] INFO [main] (ABox.java:1619) - Consistent: true
>> Tree depth: 4
>> Tree
>>
>> size: 4 Time: 0
>>
>> [java] INFO [main] (ABox.java:1532) - Consistency
>> not(http://localhost/ess
>>
>> ai.owl#Person) for 4 individuals [http://localhost/essai.owl#Luc,
>> http://localho
>>
>> st/essai.owl#Paul, http://localhost/essai.owl#Jacques,
>> http://localhost/essai.ow
>>
>> l#Pierre]
>>
>> [java] INFO [main] (ABox.java:1619) - Consistent: false
>> Tree depth:
>> 0 Tree
>>
>> size: 16 Time: 16
>>
>> [java] INFO [main] (ABox.java:1532) - Consistency
>> not(http://localhost/ess
>>
>> ai.owl#Person) for 2 individuals [http://localhost/essai.owl#Luc,
>> http://localho
>>
>> st/essai.owl#Paul]
>>
>> [java] INFO [main] (ABox.java:1619) - Consistent: false
>> Tree depth:
>> 0 Tree
>>
>> size: 16 Time: 31
>>
>> [java] INFO [main] (ABox.java:1532) - Consistency
>> not(http://localhost/ess
>>
>> ai.owl#Person) for 2 individuals [http://localhost/essai.owl#Jacques,
>> http://loc
>>
>> alhost/essai.owl#Pierre]
>>
>> [java] INFO [main] (ABox.java:1619) - Consistent: false
>> Tree depth:
>> 0 Tree
>>
>> size: 16 Time: 0
>>
>> [java] Person instances: Luc, Paul, Jacques, Pierre
>>
>>
>>
>>
>>
>>
>>
>> JAVA CODE
>>
>> ===========
>>
>>
>>
>> public class RulesExample {
>>
>> public static void main(String[] args) {
>>
>> String ont = "http://localhost/essai.owl";
>>
>> OntModel model = ModelFactory.createOntologyModel(
>> PelletReasonerFactory.THE_SPEC, null ) ;
>>
>> model.read( ont );
>>
>> ObjectProperty uncle = model.getObjectProperty( ont + "#parent" );
>>
>> OntClass Person = model.getOntClass( ont + "#Person" );
>>
>> Individual Pierre = model.getIndividual( ont + "#Pierre" );
>>
>> Individual Paul = model.getIndividual( ont + "#Paul" );
>>
>> Individual Jacques = model.getIndividual( ont + "#Jacques" );
>>
>> model.prepare();
>>
>> printPropertyValues( Pierre, uncle ); // should display
>> Jacques not OK
>>
>> printInstances( Person); // should include Luc OK
>>
>> }
>>
>>
>>
>>
>>
>> SWRL FILE
>>
>> ==========
>>
>>
>>
>> <!-- ******************************* Classes
>> ********************************************* -->
>>
>>
>>
>> <owl:Class rdf:about="#Person">
>>
>> <rdfs:subClassOf>
>>
>> <owl:Restriction>
>>
>> <owl:onProperty
>> rdf:resource="#parent" />
>>
>> <owl:someValuesFrom
>> rdf:resource="#Person" />
>>
>> </owl:Restriction>
>>
>> </rdfs:subClassOf>
>>
>> </owl:Class>
>>
>>
>>
>> <owl:Class rdf:about="#Boy" />
>>
>>
>>
>>
>>
>> <!-- ******************************* Properties
>> ********************************************* -->
>>
>>
>>
>> <owl:ObjectProperty rdf:about="#uncle" />
>>
>> <owl:ObjectProperty rdf:about="#parent" />
>>
>> <owl:ObjectProperty rdf:about="#brother" />
>>
>>
>>
>>
>>
>> <!-- ******************************* Instances
>> ********************************************* -->
>>
>>
>>
>> <dl-safe:Person rdf:about="#Pierre">
>>
>> <dl-safe:parent rdf:resource="#Paul" />
>>
>> </dl-safe:Person>
>>
>>
>>
>> <dl-safe:Person rdf:about="#Paul">
>>
>> <dl-safe:brother rdf:resource="#Jacques" />
>>
>> </dl-safe:Person>
>>
>>
>>
>> <dl-safe:Person rdf:about="#Jacques" />
>>
>>
>>
>> <dl-safe:Boy rdf:about="#Luc" />
>>
>>
>>
>>
>>
>>
>>
>> <!-- So Jacques is Pierre's uncle -->
>>
>>
>>
>> <!-- ******************************* Rules
>> ********************************************* -->
>>
>>
>>
>> <swrl:Variable rdf:about="#a" />
>>
>> <swrl:Variable rdf:about="#b" />
>>
>> <swrl:Variable rdf:about="#c" />
>>
>>
>>
>>
>>
>> <swrl:Imp rdf:about="#UncleRule">
>>
>> <swrl:head rdf:parseType="Collection">
>>
>> <swrl:IndividualPropertyAtom>
>>
>> <swrl:propertyPredicate
>> rdf:resource="#uncle" />
>>
>> <swrl:argument1 rdf:resource="#a" />
>>
>> <swrl:argument2 rdf:resource="#c" />
>>
>> </swrl:IndividualPropertyAtom>
>>
>> </swrl:head>
>>
>> <swrl:body rdf:parseType="Collection">
>>
>> <swrl:IndividualPropertyAtom>
>>
>> <swrl:propertyPredicate
>> rdf:resource="#parent" />
>>
>> <swrl:argument1 rdf:resource="#a" />
>>
>> <swrl:argument2 rdf:resource="#b" />
>>
>> </swrl:IndividualPropertyAtom>
>>
>> <swrl:IndividualPropertyAtom>
>>
>> <swrl:propertyPredicate
>> rdf:resource="#brother" />
>>
>> <swrl:argument1 rdf:resource="#b" />
>>
>> <swrl:argument2 rdf:resource="#c" />
>>
>> </swrl:IndividualPropertyAtom>
>>
>> </swrl:body>
>>
>> </swrl:Imp>
>>
>>
>>
>>
>>
>> <!-- a boy is a person -->
>>
>>
>>
>> <swrl:Imp rdf:about="#BoyRule">
>>
>> <swrl:head rdf:parseType="Collection">
>>
>> <swrl:ClassAtom>
>>
>> <swrl:classPredicate
>> rdf:resource="#Person" />
>>
>> <swrl:argument1 rdf:resource="#a" />
>>
>> </swrl:ClassAtom>
>>
>>
>>
>> </swrl:head>
>>
>> <swrl:body rdf:parseType="Collection">
>>
>> <swrl:ClassAtom>
>>
>> <swrl:classPredicate
>> rdf:resource="#Boy" />
>>
>> <swrl:argument1 rdf:resource="#a" />
>>
>> </swrl:ClassAtom>
>>
>>
>>
>> </swrl:body>
>>
>> </swrl:Imp>
>>
>>
>>
>> _______________________________________________
>> 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