JESS: Semantic Web Applications, OWL and Jess Rules

View: New views
7 Messages — Rating Filter:   Alert me  

JESS: Semantic Web Applications, OWL and Jess Rules

by John Chrysakis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello to all jess users,

I am developing an semantic web application where we have a knowledge base
(ontology) in OWL.

I am interested in using rules such that, when they are activated our
knowledge base changes accordingly (add, remove statements, triples etc).

My questions:

1. Do you thing jess can support this type of rules?

2. Is it preferable to transform all the OWL ontology in jess like
http://www.cs.cmu.edu/~sadeh/MyCampusMirror/OWLEngine.html or to use
an API like protege-owl to load and manipulate the ontology and just
having jess only for the rules? Of course the performance and the flexible
programming use are surely two critical parameters to this question...

3. I think that it could be possible that some jess rules by
adding/removing statements in the OWL ontology would cause incosistency.
To prevent this problem, I have to create rules which are not making
conficts or other incosistent situations, or to use a special
reasoner like Pellet for this purpose. Any ideas,suggestions to this?

Thanks in advance,

-----------------------------------------------------
John Chrysakis
R&D Engineer,
Institute of Computer Science (ICS),
Foundation for Research and Technology-Hellas (FORTH)
Heraklion, Crete, Greece.
-----------------------------------------------------



--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


Re: JESS: Semantic Web Applications, OWL and Jess Rules

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Mar 31, 2008, at 9:15 AM, John Chrysakis wrote:

>
> Hello to all jess users,
>
> I am developing an semantic web application where we have a  
> knowledge base
> (ontology) in OWL.
>
> I am interested in using rules such that, when they are activated our
> knowledge base changes accordingly (add, remove statements, triples  
> etc).
>
> My questions:
>
> 1. Do you thing jess can support this type of rules?


Yes.

>
> 2. Is it preferable to transform all the OWL ontology in jess like
> http://www.cs.cmu.edu/~sadeh/MyCampusMirror/OWLEngine.html or to use
> an API like protege-owl to load and manipulate the ontology and just
> having jess only for the rules? Of course the performance and the  
> flexible
> programming use are surely two critical parameters to this question...
>

Depends on what the long-term goal is; either approach works.


> 3. I think that it could be possible that some jess rules by
> adding/removing statements in the OWL ontology would cause  
> incosistency.
> To prevent this problem, I have to create rules which are not making
> conficts or other incosistent situations, or to use a special
> reasoner like Pellet for this purpose. Any ideas,suggestions to this?
>

Generally you use a separate reasoner to post-process additions to  
the knowledge base. Your other choice is to write rules which are  
themselves consistent with the knowledge base, but that pretty much  
defeats the whole purpose of using OWL in the first place, doesn't it?

If you're using something like the "OwlEngine" above, I think (not  
sure, but I *think*) that pretty much takes care of it; i.e., Jess  
itself is the reasoner.


> Thanks in advance,
>
> -----------------------------------------------------
> John Chrysakis
> R&D Engineer,
> Institute of Computer Science (ICS),
> Foundation for Research and Technology-Hellas (FORTH)
> Heraklion, Crete, Greece.
> -----------------------------------------------------
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users  
> you@...'
> in the BODY of a message to majordomo@..., NOT to the list
> (use your own address!) List problems? Notify owner-jess-
> users@....
> --------------------------------------------------------------------

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 ejfried@...
Livermore, CA 94550                 http://www.jessrules.com




--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


Re: JESS: Semantic Web Applications, OWL and Jess Rules

by John Chrysakis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Continuing my 1st question it should be preferable to have my owl ontology
(knowledge base) updated. Thus in each triggered event which fires some
rules the changes in knowledge base must be appeared without running again
the jess engine. Could you provide me an example of doing this (I guess by
using runUntilHalt and Threads)?

Also following my 2nd question I would like to share your experience about
using Jess in practice. Is it preferable all the control logic which does
the required jobs to be in Jess facts and rules or in programming java
methods? In which way we gain better performance?

Thanks for your support.

-----------------------------------------------------
John Chrysakis
R&D Engineer,
Institute of Computer Science (ICS),
Foundation for Research and Technology-Hellas (FORTH)
Heraklion, Crete, Greece.
-----------------------------------------------------


On Mon, 31 Mar 2008, Ernest Friedman-Hill wrote:

>
> On Mar 31, 2008, at 9:15 AM, John Chrysakis wrote:
>
> >
> > Hello to all jess users,
> >
> > I am developing an semantic web application where we have a
> > knowledge base
> > (ontology) in OWL.
> >
> > I am interested in using rules such that, when they are activated our
> > knowledge base changes accordingly (add, remove statements, triples
> > etc).
> >
> > My questions:
> >
> > 1. Do you thing jess can support this type of rules?
>
>
> Yes.
>
> >
> > 2. Is it preferable to transform all the OWL ontology in jess like
> > http://www.cs.cmu.edu/~sadeh/MyCampusMirror/OWLEngine.html or to use
> > an API like protege-owl to load and manipulate the ontology and just
> > having jess only for the rules? Of course the performance and the
> > flexible
> > programming use are surely two critical parameters to this question...
> >
>
> Depends on what the long-term goal is; either approach works.
>
>
> > 3. I think that it could be possible that some jess rules by
> > adding/removing statements in the OWL ontology would cause
> > incosistency.
> > To prevent this problem, I have to create rules which are not making
> > conficts or other incosistent situations, or to use a special
> > reasoner like Pellet for this purpose. Any ideas,suggestions to this?
> >
>
> Generally you use a separate reasoner to post-process additions to
> the knowledge base. Your other choice is to write rules which are
> themselves consistent with the knowledge base, but that pretty much
> defeats the whole purpose of using OWL in the first place, doesn't it?
>
> If you're using something like the "OwlEngine" above, I think (not
> sure, but I *think*) that pretty much takes care of it; i.e., Jess
> itself is the reasoner.
>
>
> > Thanks in advance,
> >
> > -----------------------------------------------------
> > John Chrysakis
> > R&D Engineer,
> > Institute of Computer Science (ICS),
> > Foundation for Research and Technology-Hellas (FORTH)
> > Heraklion, Crete, Greece.
> > -----------------------------------------------------
> >
> >
> >
> > --------------------------------------------------------------------
> > To unsubscribe, send the words 'unsubscribe jess-users
> > you@...'
> > in the BODY of a message to majordomo@..., NOT to the list
> > (use your own address!) List problems? Notify owner-jess-
> > users@....
> > --------------------------------------------------------------------
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Informatics & Decision Sciences          Phone: (925) 294-2154
> Sandia National Labs                FAX:   (925) 294-2234
> PO Box 969, MS 9012                 ejfried@...
> Livermore, CA 94550                 http://www.jessrules.com
>
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users you@...'
> in the BODY of a message to majordomo@..., NOT to the list
> (use your own address!) List problems? Notify owner-jess-users@....
> --------------------------------------------------------------------
>
>


--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


JESS: Embedding Jess in JAVA -- Example Question??

by John Chrysakis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I am quite newbie in Jess and I hava some questions on embedding
jess in java applications.

I have one java class called Ontology where I manipulate an OWL ontology.
I have implemented methods for get/set properties and classes of the
ontology.

I need to apply rules of the form:

If (Mode == "string value" && activity == 'int value) call a java
userdefined class

Can you help me of how I am supposed to write a suitable rule?
What Mode needs to be? How?
How can I declare the equality of  objects (== is true?)
How can I declare the equality of int values?


If you find it easier here is the sample rule to be filled:
The LHS is surely true, but I don't know how to write the RHS
of the rule

(import owl.*)
(deftemplate Ontology (declare (from-class Ontology )))

(load-function JessCaller)


(defrule testRule
    "Testing the rule."
     (Ontology  { Mode  == "Indoor_MainRoom_AmbientPresentation" && mode_actice == 0 } () )=> (printout t "Reactive Rule ReportsLock: " ?value
crlf)(calling MyUserFunction)
)

Thanks in advance!

-----------------------------------------------------
John Chrysakis
R&D Engineer,
Institute of Computer Science (ICS),
Foundation for Research and Technology-Hellas (FORTH)
Heraklion, Crete, Greece.
-----------------------------------------------------


On Tue, 1 Apr 2008, John Chrysakis wrote:

>
> Continuing my 1st question it should be preferable to have my owl ontology
> (knowledge base) updated. Thus in each triggered event which fires some
> rules the changes in knowledge base must be appeared without running again
> the jess engine. Could you provide me an example of doing this (I guess by
> using runUntilHalt and Threads)?
>
> Also following my 2nd question I would like to share your experience about
> using Jess in practice. Is it preferable all the control logic which does
> the required jobs to be in Jess facts and rules or in programming java
> methods? In which way we gain better performance?
>
> Thanks for your support.
>
> -----------------------------------------------------
> John Chrysakis
> R&D Engineer,
> Institute of Computer Science (ICS),
> Foundation for Research and Technology-Hellas (FORTH)
> Heraklion, Crete, Greece.
> -----------------------------------------------------
>
>
> On Mon, 31 Mar 2008, Ernest Friedman-Hill wrote:
>
> >
> > On Mar 31, 2008, at 9:15 AM, John Chrysakis wrote:
> >
> > >
> > > Hello to all jess users,
> > >
> > > I am developing an semantic web application where we have a
> > > knowledge base
> > > (ontology) in OWL.
> > >
> > > I am interested in using rules such that, when they are activated our
> > > knowledge base changes accordingly (add, remove statements, triples
> > > etc).
> > >
> > > My questions:
> > >
> > > 1. Do you thing jess can support this type of rules?
> >
> >
> > Yes.
> >
> > >
> > > 2. Is it preferable to transform all the OWL ontology in jess like
> > > http://www.cs.cmu.edu/~sadeh/MyCampusMirror/OWLEngine.html or to use
> > > an API like protege-owl to load and manipulate the ontology and just
> > > having jess only for the rules? Of course the performance and the
> > > flexible
> > > programming use are surely two critical parameters to this question...
> > >
> >
> > Depends on what the long-term goal is; either approach works.
> >
> >
> > > 3. I think that it could be possible that some jess rules by
> > > adding/removing statements in the OWL ontology would cause
> > > incosistency.
> > > To prevent this problem, I have to create rules which are not making
> > > conficts or other incosistent situations, or to use a special
> > > reasoner like Pellet for this purpose. Any ideas,suggestions to this?
> > >
> >
> > Generally you use a separate reasoner to post-process additions to
> > the knowledge base. Your other choice is to write rules which are
> > themselves consistent with the knowledge base, but that pretty much
> > defeats the whole purpose of using OWL in the first place, doesn't it?
> >
> > If you're using something like the "OwlEngine" above, I think (not
> > sure, but I *think*) that pretty much takes care of it; i.e., Jess
> > itself is the reasoner.
> >
> >
> > > Thanks in advance,
> > >
> > > -----------------------------------------------------
> > > John Chrysakis
> > > R&D Engineer,
> > > Institute of Computer Science (ICS),
> > > Foundation for Research and Technology-Hellas (FORTH)
> > > Heraklion, Crete, Greece.
> > > -----------------------------------------------------
> > >
> > >
> > >
> > > --------------------------------------------------------------------
> > > To unsubscribe, send the words 'unsubscribe jess-users
> > > you@...'
> > > in the BODY of a message to majordomo@..., NOT to the list
> > > (use your own address!) List problems? Notify owner-jess-
> > > users@....
> > > --------------------------------------------------------------------
> >
> > ---------------------------------------------------------
> > Ernest Friedman-Hill
> > Informatics & Decision Sciences          Phone: (925) 294-2154
> > Sandia National Labs                FAX:   (925) 294-2234
> > PO Box 969, MS 9012                 ejfried@...
> > Livermore, CA 94550                 http://www.jessrules.com
> >
> >
> >
> >
> > --------------------------------------------------------------------
> > To unsubscribe, send the words 'unsubscribe jess-users you@...'
> > in the BODY of a message to majordomo@..., NOT to the list
> > (use your own address!) List problems? Notify owner-jess-users@....
> > --------------------------------------------------------------------
> >
> >
>


--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


Re: JESS: Embedding Jess in JAVA -- Example Question??

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On May 5, 2008, at 5:51 AM, John Chrysakis wrote:

>
> If (Mode == "string value" && activity == 'int value) call a java
> userdefined class
>
> Can you help me of how I am supposed to write a suitable rule?
> What Mode needs to be? How?
> How can I declare the equality of  objects (== is true?)
> How can I declare the equality of int values?

I don't really understand these questions in light of the fact that  
the LHS of your strawman rule, below, looks to be correct.
>

> The LHS is surely true, but I don't know how to write the RHS
> of the rule
>
> (import owl.*)
> (deftemplate Ontology (declare (from-class Ontology )))
>
> (load-function JessCaller)
>
>
> (defrule testRule
>    "Testing the rule."
>     (Ontology  { Mode  == "Indoor_MainRoom_AmbientPresentation" &&  
> mode_actice == 0 } )
>      =>
>      (printout t "Reactive Rule ReportsLock: " ?value crlf)
>      (calling MyUserFunction)
> )

(I reformatted your rule to make it a bit easier to see; I also  
removed an empty set of parentheses from the LHS -- don't know what  
those were for.)

How you call a function depends on what kind of a function it is. This  
section of the manual talks abot calling functions in general:

http://www.jessrules.com/jess/docs/71/basics.html#functions

This section talks about calling the methods of Java objects:

http://www.jessrules.com/jess/docs/71/java.html#reflection

This part shows how to write new Jess functions in Java, how to load  
and call them from Jess:

http://www.jessrules.com/jess/docs/71/extending.html#extensions

Finally, this section describes the OBJECT slot, which you could use  
to get access to your "Ontology" object from the RHS of the rule:

http://www.jessrules.com/jess/docs/71/memory.html#shadow_instances












---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 ejfried@...
Livermore, CA 94550                 http://www.jessrules.com




--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


Re: JESS: Embedding Jess in JAVA -- Example Question??

by John Chrysakis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ernest,

Thanx first of all for your reply,

I would be more precise in my question.

Let's assume the rule which is appeared in clp file:

(defrule testRule1
    "Testing the rule."
     (Ontology  { reportsLock == TRUE })=> (calling MyFunction)
)


I have a private boolean reportsLock variable and the method:

public boolean isReportsLock(){
        return reportsLock;
    }
Both appear in my class Ontology. The testRule1 is correct and is fired
when I batch the specific clp file and call add(ont), while
Ontology ont = new Ontology.

BUT, If I want to compare values between strings or integers I don't have
the know how. For example the rule is not correct since string MODE is not
recognized:

(defrule testRule1
    "Testing the rule."
     (Ontology  { MODE == "Something" })=> (calling MyFunction)
)


I have defined in Ontology:

private String Mode = "Something";

and

public String getMode(){
        return Mode;

But in Jess Editor an error appears in mode: No such slot Mode in template
MAIN::Ontology at token 'Mode'.

What it is going wrong?

Thanks in advance!
-----------------------------------------------------
John Chrysakis
R&D Engineer,
Institute of Computer Science (ICS),
Foundation for Research and Technology-Hellas (FORTH)
Heraklion, Crete, Greece.
-----------------------------------------------------


On Mon, 5 May 2008, Ernest Friedman-Hill wrote:

> On May 5, 2008, at 5:51 AM, John Chrysakis wrote:
>
> >
> > If (Mode == "string value" && activity == 'int value) call a java
> > userdefined class
> >
> > Can you help me of how I am supposed to write a suitable rule?
> > What Mode needs to be? How?
> > How can I declare the equality of  objects (== is true?)
> > How can I declare the equality of int values?
>
> I don't really understand these questions in light of the fact that
> the LHS of your strawman rule, below, looks to be correct.
> >
>
> > The LHS is surely true, but I don't know how to write the RHS
> > of the rule
> >
> > (import owl.*)
> > (deftemplate Ontology (declare (from-class Ontology )))
> >
> > (load-function JessCaller)
> >
> >
> > (defrule testRule
> >    "Testing the rule."
> >     (Ontology  { Mode  == "Indoor_MainRoom_AmbientPresentation" &&
> > mode_actice == 0 } )
> >      =>
> >      (printout t "Reactive Rule ReportsLock: " ?value crlf)
> >      (calling MyUserFunction)
> > )
>
> (I reformatted your rule to make it a bit easier to see; I also
> removed an empty set of parentheses from the LHS -- don't know what
> those were for.)
>
> How you call a function depends on what kind of a function it is. This
> section of the manual talks abot calling functions in general:
>
> http://www.jessrules.com/jess/docs/71/basics.html#functions
>
> This section talks about calling the methods of Java objects:
>
> http://www.jessrules.com/jess/docs/71/java.html#reflection
>
> This part shows how to write new Jess functions in Java, how to load
> and call them from Jess:
>
> http://www.jessrules.com/jess/docs/71/extending.html#extensions
>
> Finally, this section describes the OBJECT slot, which you could use
> to get access to your "Ontology" object from the RHS of the rule:
>
> http://www.jessrules.com/jess/docs/71/memory.html#shadow_instances
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Informatics & Decision Sciences          Phone: (925) 294-2154
> Sandia National Labs                FAX:   (925) 294-2234
> PO Box 969, MS 9012                 ejfried@...
> Livermore, CA 94550                 http://www.jessrules.com
>
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users you@...'
> in the BODY of a message to majordomo@..., NOT to the list
> (use your own address!) List problems? Notify owner-jess-users@....
> --------------------------------------------------------------------
>
>


--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


Re: JESS: Embedding Jess in JAVA -- Example Question??

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On May 6, 2008, at 6:40 AM, John Chrysakis wrote:

>
> BUT, If I want to compare values between strings or integers I don't  
> have
> the know how. For example the rule is not correct since string MODE  
> is not
> recognized:
>
> (defrule testRule1
>    "Testing the rule."
>     (Ontology  { MODE == "Something" })=> (calling MyFunction)
> )
>
>
> I have defined in Ontology:
>
> private String Mode = "Something";
>
> and
>
> public String getMode(){
>        return Mode;
>
> But in Jess Editor an error appears in mode: No such slot Mode in  
> template
> MAIN::Ontology at token 'Mode'.
>
> What it is going wrong?
>


Jess, like Java, is case-sensitive. Jess uses the standard JavaBeans  
conventions to derive property names from getter method names, so the  
method getMode() gives rise to a property named "mode", all in lower-
case. Therefore just


(defrule testRule1
    "Testing the rule."
     (Ontology  { mode == "Something" })=> ...

should work fine,

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 ejfried@...
Livermore, CA 94550                 http://www.jessrules.com




--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------