Hi again,
Ok when I added this fact directly to the document myfamily.clp (where there
are the rules), and then I run it, it works!
But I don't know why it's not working when i'm trying to add the fact from my
java appli.
in java:
Rete r = new Rete();
String factstr = " (triple ( predicate...............) // all the fact
r.batch("myfamily.clp");
Fact f = new Fact("myfact1", r);
f=r.assertString(factstr);
r.run();
it doesn't seem to add the fact to the rete, it doesn't take it into account .
it gives me :
run-single:
f-0 (MAIN::initial-fact)
For a total of 1 facts in module MAIN.
f-0 (MAIN::initial-fact)
For a total of 1 facts in module MAIN.
Jess reported an error in routine Jesp.parseFuncall.
Message: Unexpected EOF at token 'EOF'.
BUILD SUCCESSFUL (total time: 1 second)
Where is the problem ??!
Thank u
[EMAIL PROTECTED] wrote:
OAV triples. *Shudder.*
Well, anyway, even at this level, there are various things you could
do with these. But let's take the very simple view that John is just a
symbol. After those rules are defined, the following code will deduce
that Mary is John's daughter:
;; John has a child Mary
(assert (triple (predicate "http://a.com/ontology#hasChild")
(subject John)
(object Mary)))
;; Mary is a Woman
(assert (triple (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type")
(subject Mary)
(object "http://a.com/ontology#Woman")))
;; Run the rule engine; the rule will fire
(run)
You can then use the "(facts)" function in Jess to check that the
hasDaughter fact has been asserted.
I think ahmad Sayed wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hello,
> After transforming the SWRL from the ontologie to jess rules, I've obtained a
> rule list that looks like that :
>
> (defrule rule-6
>
> (triple
> (predicate "http://a.com/ontology#hasChild")
> (subject ?x)
> (object ?y)
> )
>
> (triple
> (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type")
> (subject ?y)
> (object "http://a.com/ontology#Woman")
> )
>
> =>
> (assert
> (triple
> (predicate "http://a.com/ontology#hasDaughter")
> (subject ?x)
> (object ?y)
> )
>
>
> Well, now how can I describe in java the following fact :
> "John has a child , and the child is a woman " ???
>
> so that when I run the rete engine it can tells me that john has a daughter...
>
> If someone can write me a sample code, i'd be very gratefull.
> thank u
>
> [EMAIL PROTECTED] wrote:
> I think ahmad Sayed wrote:
> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > Hi there,
> >
> > After building my OWL ontology with its SWRL rules, I've transformed this
> > knowledge base to jess in order to make some inferences over ontology
> > individuals. So now i've got my 2 files ontology.jess and ontology.clp that
> > I have to exploit them in a java application. However, I've hard time using
> > them. Could someone bring me just a simple code on how to start over?
> > (loading these files, parsing rules, and doing some simple inferences )
> >
> > My Knowledge base looked like that (in SWRL, before converting it to jess)
> > :
> >
> > SWRL rule-1: hasparent(?x, ?y) ^ hasbrother(?y,?z) -->hasuncle(?x,?z)
> >
> > I need to make inferences like :
> > hasparent(john,?y) ^ hasbrother (?y, michael) --> hasuncle (john, michael )
> >
> > How can I do that?
> >
>
> I don't know the SWRL syntax, specifically, but I'm assuming that this
> just says if someone has a parent, and the parent has a brother, that
> the brother is that someone's uncle. I don't know what you mean about
> your two files *.jess and *.clp; maybe one contains rules and the
> other contains facts? My answer to how you would "make these
> inferences" obviously depends strongly on what the rules and facts
> look like, but basically, you'd just assert facts that represented
> john, john's father, michael, and their known relationships, and run
> the engine. Presumably your rules would create new facts to represent
> their derived relationships, but again, that depends entirely on what
> you've got for rules. Then you might use a defquery to extract all the
> facts regarding john's relationships.
>
>
>
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Advanced Software Research Phone: (925) 294-2154
> Sandia National Labs FAX: (925) 294-2234
> PO Box 969, MS 9012 [EMAIL PROTECTED]
> Livermore, CA 94550 http://herzberg.ca.sandia.gov
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]