Quantcast

Creating defrule in JessTab Protege 3.4.8

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Creating defrule in JessTab Protege 3.4.8

Monstruletz
Hi,

I'm trying to create an ontology in Protege. I'm following the following article https://protege.stanford.edu/conference/2003/Henrik_Eriksson_JessTabProtegeWS.pdf .
I have created a class (the one in the example)  (defclass Person (is-a :THING)
(slot name (type string))
(slot age (type integer))) , an instance (make-instance john of Person (name "John") (age 20)) , and mapped the class (mapclass Person). The problem is when I try to add a Jess rule  (defrule
twentyone
(object (is-a Person)
(name ?n) (age ?a&:(>= ?a 21)))
=>
(printout t "The person " ?n
" is 21 or older" crlf))

the following message appears:
Jess reported an error in routine Jesp.parsePattern.
  Message: No such slot name in template MAIN::object at token 'name'.
  Program text: ( defrule twentyone ( object ( is-a Person ) ( name  at line 13.
Jess> Jess reported an error in routine Context.getReturn.
  Message: No such variable n.
  Program text: ?n  at line 13.
Jess> Jess reported an error in routine Jesp.parseExpression.
  Message: Expected a '(', constant, or global variable at token ')'.
  Program text: )  at line 13.
Jess> Jess reported an error in routine Funcall.execute
        while executing (age ?a "&" : (>= ?a 21)).
  Message: Undefined function age.
  Program text: ( age ?a & : ( >= ?a 21 ) )  at line 13.
Jess> Jess reported an error in routine Jesp.parseExpression.
  Message: Expected a '(', constant, or global variable at token ')'.
  Program text: )  at line 13.
Jess> Jess reported an error in routine Jesp.parseExpression.
  Message: Expected a '(', constant, or global variable at token '='.
  Program text: =  at line 13.
Jess> >
Jess> Jess reported an error in routine Context.getReturn
        while executing (printout t "The person " ?n " is 21 or older" crlf).
  Message: No such variable n.
  Program text: ( printout t "The person " ?n " is 21 or older" crlf )  at line 13.
Jess> Jess reported an error in routine Jesp.parseExpression.
  Message: Expected a '(', constant, or global variable at token ')'.
  Program text: )  at line 13.

The fact for the john instance is:
(MAIN::object (is-a http://www.owl-ontologies.com/Ontology1494134122.owl#Person) (is-a-name "http://www.owl-ontologies.com/Ontology1494134122.owl#Person") (OBJECT <Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual>) (http://www.w3.org/2002/07/owl#differentFrom ) (http://www.w3.org/2002/07/owl#sameAs ) (http://www.w3.org/2002/07/owl#versionInfo ) (http://www.w3.org/1999/02/22-rdf-syntax-ns#type <Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLNamedClass>) (http://www.w3.org/1999/02/22-rdf-syntax-ns#value ) (http://www.w3.org/2000/01/rdf-schema#comment ) (http://www.w3.org/2000/01/rdf-schema#isDefinedBy ) (http://www.w3.org/2000/01/rdf-schema#label ) (http://www.w3.org/2000/01/rdf-schema#member ) (http://www.w3.org/2000/01/rdf-schema#seeAlso ) (http://protege.stanford.edu/plugins/owl/protege#SLOT-CONSTRAINTS ) (http://www.w3.org/2003/11/swrl#body ) (http://www.w3.org/2003/11/swrl#head ) (http://www.w3.org/2003/11/swrl#arguments ) (http://www.w3.org/2003/11/swrl#builtin ) (http://www.w3.org/2003/11/swrl#argument1 ) (http://www.w3.org/2003/11/swrl#classPredicate ) (http://www.w3.org/2003/11/swrl#propertyPredicate ) (http://www.w3.org/2003/11/swrl#dataRange ) (http://www.w3.org/2003/11/swrlb#args ) (http://www.w3.org/2003/11/swrlb#minArgs ) (http://www.w3.org/2003/11/swrlb#maxArgs ) (http://www.w3.org/2003/11/swrl#argument2 ) (http://www.owl-ontologies.com/Ontology1494134122.owl#name "John") (http://www.owl-ontologies.com/Ontology1494134122.owl#age 21))

What am I doing wrong?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating defrule in JessTab Protege 3.4.8

samsontu
Hi,

I am not sure what happened in your case. I had no problem running the rule:

Jess> (defclass Person (is-a :THING) (slot name (type string)) (slot age (type integer)))
TRUE
Jess> (make-instance john of Person (name "John") (age 20))
<Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance>
Jess> (mapclass Person)
Person
Jess> (facts)
f-0   (MAIN::object (is-a Person) (is-a-name "Person") (OBJECT <Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance>) (name "John") (age 20))
For a total of 1 facts in module MAIN.
Jess> (defrule twentyone (object (is-a Person) (name ?n) (age ?a&:(>= ?a 21))) => (printout t "The person " ?n " is 21 or older" crlf))
TRUE
Jess> (reset)
TRUE
Jess> (run)
0
**** I changed the age of John to 21 in Protege ***
Jess> (reset)
TRUE
Jess> (run)
The person John is 21 or older
1
Jess> (facts)
f-0   (MAIN::initial-fact)
f-1   (MAIN::object (is-a Person) (is-a-name "Person") (OBJECT <Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance>) (name "John") (age 22))
For a total of 2 facts in module MAIN.

After you defined your class, did you get the “TRUE” response from Jess?

I copied and pasted your rule, so the syntax of the rule is correct. There is something wrong with the class definition.

Can you copy and paste the sequence of JessTab interactions (as I did) and post it?

Also, when you created your project, did specify “.pont and pins” as the file formats? The JessTab tutorial predates OWL.

With best regards,
Samson



On May 7, 2017, at 1:17 PM, Monstruletz <[hidden email]> wrote:

Hi,

I'm trying to create an ontology in Protege. I'm following the following
article
https://protege.stanford.edu/conference/2003/Henrik_Eriksson_JessTabProtegeWS.pdf
.
I have created a class (the one in the example)  (defclass Person (is-a
:THING)
(slot name (type string))
(slot age (type integer))) , an instance (make-instance john of Person (name
"John") (age 20)) , and mapped the class (mapclass Person). The problem is
when I try to add a Jess rule  (defrule
twentyone
(object (is-a Person)
(name ?n) (age ?a&:(>= ?a 21)))
=>
(printout t "The person " ?n
" is 21 or older" crlf))

the following message appears:
Jess reported an error in routine Jesp.parsePattern.
 Message: No such slot name in template MAIN::object at token 'name'.
 Program text: ( defrule twentyone ( object ( is-a Person ) ( name  at line
13.
Jess> Jess reported an error in routine Context.getReturn.
 Message: No such variable n.
 Program text: ?n  at line 13.
Jess> Jess reported an error in routine Jesp.parseExpression.
 Message: Expected a '(', constant, or global variable at token ')'.
 Program text: )  at line 13.
Jess> Jess reported an error in routine Funcall.execute
while executing (age ?a "&" : (>= ?a 21)).
 Message: Undefined function age.
 Program text: ( age ?a & : ( >= ?a 21 ) )  at line 13.
Jess> Jess reported an error in routine Jesp.parseExpression.
 Message: Expected a '(', constant, or global variable at token ')'.
 Program text: )  at line 13.
Jess> Jess reported an error in routine Jesp.parseExpression.
 Message: Expected a '(', constant, or global variable at token '='.
 Program text: =  at line 13.
Jess> >
Jess> Jess reported an error in routine Context.getReturn
while executing (printout t "The person " ?n " is 21 or older" crlf).
 Message: No such variable n.
 Program text: ( printout t "The person " ?n " is 21 or older" crlf )  at
line 13.
Jess> Jess reported an error in routine Jesp.parseExpression.
 Message: Expected a '(', constant, or global variable at token ')'.
 Program text: )  at line 13.

The fact for the john instance is:
(MAIN::object (is-a
http://www.owl-ontologies.com/Ontology1494134122.owl#Person) (is-a-name
"http://www.owl-ontologies.com/Ontology1494134122.owl#Person") (OBJECT
<Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual>)
(http://www.w3.org/2002/07/owl#differentFrom )
(http://www.w3.org/2002/07/owl#sameAs )
(http://www.w3.org/2002/07/owl#versionInfo )
(http://www.w3.org/1999/02/22-rdf-syntax-ns#type
<Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLNamedClass>)
(http://www.w3.org/1999/02/22-rdf-syntax-ns#value )
(http://www.w3.org/2000/01/rdf-schema#comment )
(http://www.w3.org/2000/01/rdf-schema#isDefinedBy )
(http://www.w3.org/2000/01/rdf-schema#label )
(http://www.w3.org/2000/01/rdf-schema#member )
(http://www.w3.org/2000/01/rdf-schema#seeAlso )
(http://protege.stanford.edu/plugins/owl/protege#SLOT-CONSTRAINTS )
(http://www.w3.org/2003/11/swrl#body ) (http://www.w3.org/2003/11/swrl#head
) (http://www.w3.org/2003/11/swrl#arguments )
(http://www.w3.org/2003/11/swrl#builtin )
(http://www.w3.org/2003/11/swrl#argument1 )
(http://www.w3.org/2003/11/swrl#classPredicate )
(http://www.w3.org/2003/11/swrl#propertyPredicate )
(http://www.w3.org/2003/11/swrl#dataRange )
(http://www.w3.org/2003/11/swrlb#args )
(http://www.w3.org/2003/11/swrlb#minArgs )
(http://www.w3.org/2003/11/swrlb#maxArgs )
(http://www.w3.org/2003/11/swrl#argument2 )
(http://www.owl-ontologies.com/Ontology1494134122.owl#name "John")
(http://www.owl-ontologies.com/Ontology1494134122.owl#age 21))

What am I doing wrong?





--
View this message in context: http://protege-project.136.n4.nabble.com/Creating-defrule-in-JessTab-Protege-3-4-8-tp4668401.html
Sent from the Protege User mailing list archive at Nabble.com.
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

-- 
Samson Tu                                                      email: [hidden email]
Senior Research Engineer                              web: www.stanford.edu/~swt/
Center for Biomedical Informatics Research  phone: 1-650-725-3391
Stanford University                                          fax: 1-650-725-7944




_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating defrule in JessTab Protege 3.4.8

samsontu
One slight correction:

On May 8, 2017, at 10:52 AM, Samson Tu <[hidden email]> wrote:

Hi,

I am not sure what happened in your case. I had no problem running the rule:

Jess> (defclass Person (is-a :THING) (slot name (type string)) (slot age (type integer)))
TRUE
Jess> (make-instance john of Person (name "John") (age 20))
<Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance>
Jess> (mapclass Person)
Person
Jess> (facts)
f-0   (MAIN::object (is-a Person) (is-a-name "Person") (OBJECT <Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance>) (name "John") (age 20))
For a total of 1 facts in module MAIN.
Jess> (defrule twentyone (object (is-a Person) (name ?n) (age ?a&:(>= ?a 21))) => (printout t "The person " ?n " is 21 or older" crlf))
TRUE
Jess> (reset)
TRUE
Jess> (run)
0
**** I changed the age of John to 21 in Protege ***


**** I changed the age of John to 22 in Protege ***



Jess> (reset)
TRUE
Jess> (run)
The person John is 21 or older
1
Jess> (facts)
f-0   (MAIN::initial-fact)
f-1   (MAIN::object (is-a Person) (is-a-name "Person") (OBJECT <Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance>) (name "John") (age 22))
For a total of 2 facts in module MAIN.

After you defined your class, did you get the “TRUE” response from Jess?

I copied and pasted your rule, so the syntax of the rule is correct. There is something wrong with the class definition.

Can you copy and paste the sequence of JessTab interactions (as I did) and post it?

Also, when you created your project, did specify “.pont and pins” as the file formats? The JessTab tutorial predates OWL.

With best regards,
Samson



On May 7, 2017, at 1:17 PM, Monstruletz <[hidden email]> wrote:

Hi,

I'm trying to create an ontology in Protege. I'm following the following
article
https://protege.stanford.edu/conference/2003/Henrik_Eriksson_JessTabProtegeWS.pdf
.
I have created a class (the one in the example)  (defclass Person (is-a
:THING)
(slot name (type string))
(slot age (type integer))) , an instance (make-instance john of Person (name
"John") (age 20)) , and mapped the class (mapclass Person). The problem is
when I try to add a Jess rule  (defrule
twentyone
(object (is-a Person)
(name ?n) (age ?a&:(>= ?a 21)))
=>
(printout t "The person " ?n
" is 21 or older" crlf))

the following message appears:
Jess reported an error in routine Jesp.parsePattern.
 Message: No such slot name in template MAIN::object at token 'name'.
 Program text: ( defrule twentyone ( object ( is-a Person ) ( name  at line
13.
Jess> Jess reported an error in routine Context.getReturn.
 Message: No such variable n.
 Program text: ?n  at line 13.
Jess> Jess reported an error in routine Jesp.parseExpression.
 Message: Expected a '(', constant, or global variable at token ')'.
 Program text: )  at line 13.
Jess> Jess reported an error in routine Funcall.execute
while executing (age ?a "&" : (>= ?a 21)).
 Message: Undefined function age.
 Program text: ( age ?a & : ( >= ?a 21 ) )  at line 13.
Jess> Jess reported an error in routine Jesp.parseExpression.
 Message: Expected a '(', constant, or global variable at token ')'.
 Program text: )  at line 13.
Jess> Jess reported an error in routine Jesp.parseExpression.
 Message: Expected a '(', constant, or global variable at token '='.
 Program text: =  at line 13.
Jess> >
Jess> Jess reported an error in routine Context.getReturn
while executing (printout t "The person " ?n " is 21 or older" crlf).
 Message: No such variable n.
 Program text: ( printout t "The person " ?n " is 21 or older" crlf )  at
line 13.
Jess> Jess reported an error in routine Jesp.parseExpression.
 Message: Expected a '(', constant, or global variable at token ')'.
 Program text: )  at line 13.

The fact for the john instance is:
(MAIN::object (is-a
http://www.owl-ontologies.com/Ontology1494134122.owl#Person) (is-a-name
"http://www.owl-ontologies.com/Ontology1494134122.owl#Person") (OBJECT
<Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual>)
(http://www.w3.org/2002/07/owl#differentFrom )
(http://www.w3.org/2002/07/owl#sameAs )
(http://www.w3.org/2002/07/owl#versionInfo )
(http://www.w3.org/1999/02/22-rdf-syntax-ns#type
<Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLNamedClass>)
(http://www.w3.org/1999/02/22-rdf-syntax-ns#value )
(http://www.w3.org/2000/01/rdf-schema#comment )
(http://www.w3.org/2000/01/rdf-schema#isDefinedBy )
(http://www.w3.org/2000/01/rdf-schema#label )
(http://www.w3.org/2000/01/rdf-schema#member )
(http://www.w3.org/2000/01/rdf-schema#seeAlso )
(http://protege.stanford.edu/plugins/owl/protege#SLOT-CONSTRAINTS )
(http://www.w3.org/2003/11/swrl#body ) (http://www.w3.org/2003/11/swrl#head
) (http://www.w3.org/2003/11/swrl#arguments )
(http://www.w3.org/2003/11/swrl#builtin )
(http://www.w3.org/2003/11/swrl#argument1 )
(http://www.w3.org/2003/11/swrl#classPredicate )
(http://www.w3.org/2003/11/swrl#propertyPredicate )
(http://www.w3.org/2003/11/swrl#dataRange )
(http://www.w3.org/2003/11/swrlb#args )
(http://www.w3.org/2003/11/swrlb#minArgs )
(http://www.w3.org/2003/11/swrlb#maxArgs )
(http://www.w3.org/2003/11/swrl#argument2 )
(http://www.owl-ontologies.com/Ontology1494134122.owl#name "John")
(http://www.owl-ontologies.com/Ontology1494134122.owl#age 21))

What am I doing wrong?





--
View this message in context: http://protege-project.136.n4.nabble.com/Creating-defrule-in-JessTab-Protege-3-4-8-tp4668401.html
Sent from the Protege User mailing list archive at Nabble.com.
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

-- 
Samson Tu                                                      email: [hidden email]
Senior Research Engineer                              web: www.stanford.edu/~swt/
Center for Biomedical Informatics Research  phone: 1-650-725-3391
Stanford University                                          fax: 1-650-725-7944




-- 
Samson Tu                                                      email: [hidden email]
Senior Research Engineer                              web: www.stanford.edu/~swt/
Center for Biomedical Informatics Research  phone: 1-650-725-3391
Stanford University                                          fax: 1-650-725-7944




_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating defrule in JessTab Protege 3.4.8

Monstruletz
Hello,

Thank you for your reply. I have created a new project choosing project type to be OWL/RDF Files and Language profile OWL DL. Now, the (facts) is giving me an error.

Jess>  (defclass Person (is-a :THING) (slot name (type string)) (slot age (type integer)))
TRUE
Jess> (make-instance john of Person (name "John") (age 20))
<Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual>
Jess>  (mapclass Person)
http://www.owl-ontologies.com/Ontology1494219947.owl#Person
Jess> (facts)
Jess reported an error in routine facts
        while executing (facts).
  Message: Error during execution.
  Program text: ( facts )  at line 6.
f-0  
Nested exception is:
Method called on closed knowledgeBase: KB_237838
Jess>
Jess>  (defrule twentyone (object (is-a Person) (name ?n) (age ?a&:(>= ?a 21))) => (printout t "The person " ?n " is 21 or older" crlf))
Jess reported an error in routine Jesp.parsePattern.
  Message: No such slot name in template MAIN::object at token 'name'.
  Program text: ( defrule twentyone ( object ( is-a Person ) ( name  at line 5.
Jess> Jess reported an error in routine Context.getReturn.
  Message: No such variable n.
  Program text: ?n  at line 5.
Jess> Jess reported an error in routine Jesp.parseExpression.
  Message: Expected a '(', constant, or global variable at token ')'.
  Program text: )  at line 5.
Jess> Jess reported an error in routine Funcall.execute
        while executing (age ?a "&" : (>= ?a 21)).
  Message: Undefined function age.
  Program text: ( age ?a & : ( >= ?a 21 ) )  at line 5.
Jess> Jess reported an error in routine Jesp.parseExpression.
  Message: Expected a '(', constant, or global variable at token ')'.
  Program text: )  at line 5.
Jess> Jess reported an error in routine Jesp.parseExpression.
  Message: Expected a '(', constant, or global variable at token '='.
  Program text: =  at line 5.
Jess> >
Jess> Jess reported an error in routine Context.getReturn
        while executing (printout t "The person " ?n " is 21 or older" crlf).
  Message: No such variable n.
  Program text: ( printout t "The person " ?n " is 21 or older" crlf )  at line 5.
Jess> Jess reported an error in routine Jesp.parseExpression.
  Message: Expected a '(', constant, or global variable at token ')'.
  Program text: )  at line 5.
Jess>

I have installed Protege 3.4.8, Jess 7.0p2 on Windows 8, 64-bit and JVM 7.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating defrule in JessTab Protege 3.4.8

Monstruletz
In reply to this post by samsontu
I have installed Jess 7.1p2. (facts) now works.

Jess> (facts)
For a total of 0 facts in module MAIN.
Jess> (defclass Person (is-a :THING) (slot name (type string)) (slot age (type integer)))
TRUE
Jess> (make-instance john of Person (name "John") (age 20))
<Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual>
Jess>  (mapclass Person)
http://www.owl-ontologies.com/Ontology1494220656.owl#Person
Jess> (facts)
f-0   (MAIN::object (is-a http://www.owl-ontologies.com/Ontology1494220656.owl#Person) (is-a-name "http://www.owl-ontologies.com/Ontology1494220656.owl#Person") (OBJECT <Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual>) (http://www.w3.org/2002/07/owl#differentFrom ) (http://www.w3.org/2002/07/owl#sameAs ) (http://www.w3.org/2002/07/owl#versionInfo ) (http://www.w3.org/1999/02/22-rdf-syntax-ns#type <Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLNamedClass>) (http://www.w3.org/1999/02/22-rdf-syntax-ns#value ) (http://www.w3.org/2000/01/rdf-schema#comment ) (http://www.w3.org/2000/01/rdf-schema#isDefinedBy ) (http://www.w3.org/2000/01/rdf-schema#label ) (http://www.w3.org/2000/01/rdf-schema#member ) (http://www.w3.org/2000/01/rdf-schema#seeAlso ) (http://protege.stanford.edu/plugins/owl/protege#SLOT-CONSTRAINTS ) (http://www.w3.org/2003/11/swrl#body ) (http://www.w3.org/2003/11/swrl#head ) (http://www.w3.org/2003/11/swrl#arguments ) (http://www.w3.org/2003/11/swrl#builtin ) (http://www.w3.org/2003/11/swrl#argument1 ) (http://www.w3.org/2003/11/swrl#classPredicate ) (http://www.w3.org/2003/11/swrl#propertyPredicate ) (http://www.w3.org/2003/11/swrl#dataRange ) (http://www.w3.org/2003/11/swrlb#args ) (http://www.w3.org/2003/11/swrlb#minArgs ) (http://www.w3.org/2003/11/swrlb#maxArgs ) (http://www.w3.org/2003/11/swrl#argument2 ) (http://www.owl-ontologies.com/Ontology1494220656.owl#name "John") (http://www.owl-ontologies.com/Ontology1494220656.owl#age 20))
For a total of 1 facts in module MAIN.
Jess>  (defrule twentyone (object (is-a Person) (name ?n) (age ?a&:(>= ?a 21))) => (printout t "The person " ?n " is 21 or older" crlf))
Jess reported an error in routine Jesp.parsePattern.
  Message: No such slot name in template MAIN::object at token 'name'.
  Program text: ( defrule twentyone ( object ( is-a Person ) ( name  at line 6.
Jess> Jess reported an error in routine Context.getVariable.
  Message: No such variable n.
  Program text: ?n  at line 6.
Jess> Jess reported an error in routine Jesp.parseExpression.
  Message: Expected a '(', constant, or global variable at token ')'.
  Program text: )  at line 6.
Jess> Jess reported an error in routine Funcall.execute
        while executing (age ?a "&" : (>= ?a 21)).
  Message: Undefined function age.
  Program text: ( age ?a & : ( >= ?a 21 ) )  at line 6.
Jess> Jess reported an error in routine Jesp.parseExpression.
  Message: Expected a '(', constant, or global variable at token ')'.
  Program text: )  at line 6.
Jess> Jess reported an error in routine Jesp.parseExpression.
  Message: Expected a '(', constant, or global variable at token '='.
  Program text: =  at line 6.
Jess> >
Jess> Jess reported an error in routine Context.getVariable
        while executing (printout t "The person " ?n " is 21 or older" crlf).
  Message: No such variable n.
  Program text: ( printout t "The person " ?n " is 21 or older" crlf )  at line 6.
Jess> Jess reported an error in routine Jesp.parseExpression.
  Message: Expected a '(', constant, or global variable at token ')'.
  Program text: )  at line 6.
Jess>

I see that when creating an instance the type for my instance is (OBJECT <Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual>) , but in your case is  (OBJECT <Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance>).
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating defrule in JessTab Protege 3.4.8

samsontu
Hi,

You have an OWL ontology. OWL entities have IRIs. You need to enter the IRIs explicitly, and not just the short names, because that’s how Jess references OWL entities.

Instead of

(defrule twentyone (object (is-a Person) (name ?n) (age ?a&:(>= ?a 21))) => (printout t "The person " ?n " is 21 or older" crlf))

you need to use

(defrule twentyone (object is-a
http://www.owl-ontologies.com/Ontology1494220656.owl#Person (http://www.owl-ontologies.com/Ontology1494220656.owl#name ?n) (http://www.owl-ontologies.com/Ontology1494220656.owl#age ?a&:(>= ?a 21))) => (printout t "The person " ?n " is 21 or older" crlf))

Choose a nice short ontology IRI to make the rules less ugly.

With best regards,
Samson



On May 7, 2017, at 10:10 PM, Monstruletz <[hidden email]> wrote:

I have installed Jess 7.1p2. (facts) now works.

Jess> (facts)
For a total of 0 facts in module MAIN.
Jess> (defclass Person (is-a :THING) (slot name (type string)) (slot age
(type integer)))
TRUE
Jess> (make-instance john of Person (name "John") (age 20))
<Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual>
Jess>  (mapclass Person)
http://www.owl-ontologies.com/Ontology1494220656.owl#Person
Jess> (facts)
f-0   (MAIN::object (is-a
http://www.owl-ontologies.com/Ontology1494220656.owl#Person) (is-a-name
"http://www.owl-ontologies.com/Ontology1494220656.owl#Person") (OBJECT
<Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual>)
(http://www.w3.org/2002/07/owl#differentFrom )
(http://www.w3.org/2002/07/owl#sameAs )
(http://www.w3.org/2002/07/owl#versionInfo )
(http://www.w3.org/1999/02/22-rdf-syntax-ns#type
<Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLNamedClass>)
(http://www.w3.org/1999/02/22-rdf-syntax-ns#value )
(http://www.w3.org/2000/01/rdf-schema#comment )
(http://www.w3.org/2000/01/rdf-schema#isDefinedBy )
(http://www.w3.org/2000/01/rdf-schema#label )
(http://www.w3.org/2000/01/rdf-schema#member )
(http://www.w3.org/2000/01/rdf-schema#seeAlso )
(http://protege.stanford.edu/plugins/owl/protege#SLOT-CONSTRAINTS )
(http://www.w3.org/2003/11/swrl#body ) (http://www.w3.org/2003/11/swrl#head
) (http://www.w3.org/2003/11/swrl#arguments )
(http://www.w3.org/2003/11/swrl#builtin )
(http://www.w3.org/2003/11/swrl#argument1 )
(http://www.w3.org/2003/11/swrl#classPredicate )
(http://www.w3.org/2003/11/swrl#propertyPredicate )
(http://www.w3.org/2003/11/swrl#dataRange )
(http://www.w3.org/2003/11/swrlb#args )
(http://www.w3.org/2003/11/swrlb#minArgs )
(http://www.w3.org/2003/11/swrlb#maxArgs )
(http://www.w3.org/2003/11/swrl#argument2 )
(http://www.owl-ontologies.com/Ontology1494220656.owl#name "John")
(http://www.owl-ontologies.com/Ontology1494220656.owl#age 20))
For a total of 1 facts in module MAIN.
Jess>  (defrule twentyone (object (is-a Person) (name ?n) (age ?a&:(>= ?a
21))) => (printout t "The person " ?n " is 21 or older" crlf))
Jess reported an error in routine Jesp.parsePattern.
 Message: No such slot name in template MAIN::object at token 'name'.
 Program text: ( defrule twentyone ( object ( is-a Person ) ( name  at line
6.
Jess> Jess reported an error in routine Context.getVariable.
 Message: No such variable n.
 Program text: ?n  at line 6.
Jess> Jess reported an error in routine Jesp.parseExpression.
 Message: Expected a '(', constant, or global variable at token ')'.
 Program text: )  at line 6.
Jess> Jess reported an error in routine Funcall.execute
while executing (age ?a "&" : (>= ?a 21)).
 Message: Undefined function age.
 Program text: ( age ?a & : ( >= ?a 21 ) )  at line 6.
Jess> Jess reported an error in routine Jesp.parseExpression.
 Message: Expected a '(', constant, or global variable at token ')'.
 Program text: )  at line 6.
Jess> Jess reported an error in routine Jesp.parseExpression.
 Message: Expected a '(', constant, or global variable at token '='.
 Program text: =  at line 6.
Jess> >
Jess> Jess reported an error in routine Context.getVariable
while executing (printout t "The person " ?n " is 21 or older" crlf).
 Message: No such variable n.
 Program text: ( printout t "The person " ?n " is 21 or older" crlf )  at
line 6.
Jess> Jess reported an error in routine Jesp.parseExpression.
 Message: Expected a '(', constant, or global variable at token ')'.
 Program text: )  at line 6.
Jess>

I see that when creating an instance the type for my instance is (OBJECT
<Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual>)
, but in your case is  (OBJECT
<Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance>).



-- 
Samson Tu                                                      email: [hidden email]
Senior Research Engineer                              web: www.stanford.edu/~swt/
Center for Biomedical Informatics Research  phone: 1-650-725-3391
Stanford University                                          fax: 1-650-725-7944




_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating defrule in JessTab Protege 3.4.8

Monstruletz
Hi,

Thank you very much for your help. I understand what you are saying and I will try these as soon as I can.
I am just curious, what are the differences between Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual and Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance and from where it appears? And it's ok that I continue with this kind of ontology, yes?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

from owl to sql

Riccardo.Grosso

 Dear Protege Community,

 

sorry for a probably old question, but could you address me to a solution for the problem in object of this email ?

 

It is possible to transform an owl to ddl sql ?

 

Only data structure, not data.

 

Thanks and best regards

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating defrule in JessTab Protege 3.4.8

samsontu
In reply to this post by Monstruletz

On May 7, 2017, at 11:39 PM, Monstruletz <[hidden email]> wrote:
...
I am just curious, what are the differences between
Java-Object:edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual
and Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance and
from where it appears? And it's ok that I continue with this kind of
ontology, yes?


Protege 3.x supports frame representation and OWL representation. Instances in the frame representation are implemented as Java edu.stanford.smi.protege.model.DefaultSimpleInstance, and OWL individuals are implemented as Java instances of edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIndividual.

Frames (including properties) are named by string identifiers. That’s why you can write rules like
(defrule twentyone (object (is-a Person) (name ?n) …)) in the frame presentation. “Person” and “name” are class and property identifiers in the frame representation. OWL entities are identified by IRIs and you need to use IRIs to reference OWL entities in a rule.

You can continue to use Jess with OWL ontologies. Just be aware that running Jess rules is like running external programs that make modifications to the ontology. It has the potential to make the ontology inconsistent (just as using Protege to edit an ontology has the potential to make the ontology inconsistent).

With best regards,
Samson

-- 
Samson Tu                                                      email: [hidden email]
Senior Research Engineer                              web: www.stanford.edu/~swt/
Center for Biomedical Informatics Research  phone: 1-650-725-3391
Stanford University                                          fax: 1-650-725-7944




_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: from owl to sql

Josef Hardi
In reply to this post by Riccardo.Grosso
Yes, it is possible to transform OWL (esp. OWL-DL) to DDL SQL (or ER diagram or UML class diagram). Take a look here:


tl;dr
You might want to skip the theoretical aspect in the slides (but feel free to jump in!). Look immediately at the examples (slide #71 onward) and study the DL encoding. The idea is to run the transformation pipeline from OWL —> DL —> UML. Note that only the OWL-DL subset ontologies will work fully in the pipeline.

The mapping between OWL-DL to DL can be found in slide #62 and #63 or the complete list is here: https://www.obitko.com/tutorials/ontologies-semantic-web/owl-dl-semantics.html

Best,
Josef


On May 8, 2017, at 12:43 AM, Riccardo Grosso <[hidden email]> wrote:

 Dear Protege Community,

 

sorry for a probably old question, but could you address me to a solution for the problem in object of this email ?

 

It is possible to transform an owl to ddl sql ?

 

Only data structure, not data.

 

Thanks and best regards

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: from owl to sql

Riccardo.Grosso

 Thanks

 >  _________________________________________________________________________

 >  

 >  

Il 8 maggio 2017 alle 19.06 Josef Hardi <[hidden email]> ha scritto:

 >  

 >   Yes, it is possible to transform OWL (esp. OWL-DL) to DDL SQL (or ER diagram or UML class diagram). Take a look here:

 
 
tl;dr
You might want to skip the theoretical aspect in the slides (but feel free to jump in!). Look immediately at the examples (slide #71 onward) and study the DL encoding. The idea is to run the transformation pipeline from OWL —> DL —> UML. Note that only the OWL-DL subset ontologies will work fully in the pipeline.
 
The mapping between OWL-DL to DL can be found in slide #62 and #63 or the complete list is here: https://www.obitko.com/tutorials/ontologies-semantic-web/owl-dl-semantics.html
 
Best,
Josef
 

On May 8, 2017, at 12:43 AM, Riccardo Grosso <[hidden email]> wrote:

 Dear Protege Community,

 

sorry for a probably old question, but could you address me to a solution for the problem in object of this email ?

 

It is possible to transform an owl to ddl sql ?

 

Only data structure, not data.

 

Thanks and best regards

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

 >   

_______________________________________________

 >  protege-user mailing list

 >  [hidden email]

 >  https://mailman.stanford.edu/mailman/listinfo/protege-user

 >  

 >   


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Loading...