Hi,
I don't think that it's a string or symbols problem. It's not even taking my .clp file into account! i've tried this :
 
r.batch("ontologie-sein.clp");
Fact f = new Fact("fact1", r);
f.setSlotValue("predicate",  new Value("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", RU.SYMBOL));
f.setSlotValue("subject",  new Value("Anomalie1", RU.SYMBOL));
f.setSlotValue("object",new Value("Opacité1", RU.SYMBOL) );
r.assertFact(f);
 r.run();
 
in the ontologie-sein.clp file there's the deftemplates and defrules and everything :
 
(deftemplate triple "Template representing a triple"
 (slot predicate (default ""))
 (slot subject   (default ""))
 (slot object    (default ""))
)

(open "testRel.txt" test "w")
 
(defrule rule-1
     
       
         
  (triple
    (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type")
    (subject    ?x1)
    (object   "http://www.owl-ontologies.com/mammonto.owl#Anomalie")
  )
...............................
 
and it's giving me :
 
run:
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 Fact.findSlot.
  Message: No slot predicate in deftemplate  MAIN::fact1.excpetionnn
 
I find this very strange !! I'm still stuck here ..

ahmad Sayed <[EMAIL PROTECTED]> wrote:
Well from what i've seen, the JessDE will make editing jess code easier. However, i'm building an end-user application where users would just enter informations with less possible effort (checkboxes etc...) and the application will transform everything to facts to be inferred. Moreover, I don't realy need to create rules directly in jess. I'm creating them in SWRL and then transforming them to jess. So I don't think that the JessDE will be very usefull for me. So that's why I need to call everything from java so that when the user enter his informations, he can obtain the deduced facts without dealing with jess itself.
By the way, the executecommand(factstr) fonction is still not working after all my very long attempts !
Thank u


Robert Kildare <[EMAIL PROTECTED]>wrote:
In support of ej:
When I read that writing to file and setting Jess to work on it was the
best way, although tempted to make "rule" and "fact" objects that were
jess objects, I stuck with the advice.

I made my classes as vectors of strings or vectors of vectors which
reflected the "rules" "conditions" and "consequents" stored in a database
to my own specification. I create a simple file writer, build the
deftemplate Strings, build the deffact Strings, build the rule strings
and stream them out. (Perhaps I am solving a simpler problem).

Consequently most of this list's involvement with JESS API has gone
sailing over my head and left me in awe of the contributors' skills. But
my program is working very nicely. And interfacing with Jess has been a breeze.
Rob
==============Original message text===============
On Thu, 09 Mar 2006 12:36:34 +1000 [EMAIL PROTECTED] wrote:


OK, let me say two things first:

1) People *always* want to embed Jess code into Java, rather than
putting it into a separate file. I don't know why it's so important to
people to do this, because it's *extremely* hard to embed code in any
language into text strings in another language without making
mistakes. This is why, for example, scriptlets in JSPs are a
maintenance nightmare. People act as though this is very important,
but I've never understood why. Put Jess code into its own files,
folks! The JessDE makes this impossibly easy!

2) The Semantic Web and all its children may never succeed because of
this obsession with using URLs to identify everything. I certainly
understand the concept, but URLs are a) long and b) contain too many
special characters. As a result, they're hard to work with in any
language, and a String containing lots of URLs is a beast, no matter
how you look at it.

OK, now, given all the other problems that we've reported with your code,
here's another one: your embedding of the assert function call into a String
contains a bunch of stray semicolon (";") characters, which is a comment
delimiter in Jess and other Lisp derivatives. I don't know why the semicolons
are there. I went back and cut and pasted your Java code into a Java file and
changed it to print the resulting String, and here's what I get (with
non-ASCII characters removed). It's all one line:

(assert (triple (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";) (subject Anomalie1) (object "http://www.owl-ontologies.com/mammonto.owl#Anomalie";))(triple (predicate "http://www.owl-ontologies.com/mammonto.owl#contient_opacit";) (subject Anomalie1) (object Opacit1))(triple (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";)(subject Ronde1) (object "http://www.owl-ontologies.com/mammonto.owl#Ronde";) ) (triple (predicate "http://www.owl-ontologies.com/mammonto.owl#
Right after the first URL, just after the close quotes, is a semicolon.
That makes the rest of the line into a comment. So really, this comes out to

(assert (triple (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
and nothing more. No wonder it doesn't work!

Now, is it *REALLY* so important to embed this Jess code into Java Strings?
People have driven themselves mad over less!


I think ahmad Sayed wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Well i've tried that before, it gaves me :
> run:
> 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.
> BUILD SUCCESSFUL (total time: 1 second)
>
> So it doesn't realy take the rules present on "ontologie-sein.clp"
into account.
> In that file, I have list of rules that looks like this:
>
> ;;; Declaring the triple template ---------------------------------
> (deftemplate triple "Template representing a triple"
> (slot predicate (default ""))
> (slot subject (default ""))
> (slot object (default ""))
> )
>
> (open "testRel.txt" test "w")
>
> (defrule rule-1
>
> (triple
> (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type")> (subject ?x1)
> (object "http://www.owl-ontologies.com/mammonto.owl#Anomalie")> )
>
> (triple
> (predicate "http://www.owl-ontologies.com/mammonto.owl#contient_opacit_")> (subject ?x1)
> (object ?x2)
> )
> (triple
> (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type")> (subject ?x3)
> (object "http://www.owl-ontologies.com/mammonto.owl#Ronde")> )
>
> (triple
> (predicate "http://www.owl-ontologies.com/mammonto.owl#__forme")> (subject ?x2)
> (object ?x3)
> )
>
> =>
> (assert
>
> (triple
> (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type")> (subject ?x1)
> (object "http://www.owl-ontologies.com/mammonto.owl#ACR2")> )
>
> )
> )
>
> When I tried to to put the following fact directly in the .clp file
like this :
>
> (deffacts fact1
>
> (triple
> (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type")> (subject Anomalie1)
> (object "http://www.owl-ontologies.com/mammonto.owl#Anomalie")> )
>
> (triple
> (predicate "http://www.owl-ontologies.com/mammonto.owl#contient_opacit_")> (subject Anomalie1)
> (object Opacit_1)
> )
>
> (triple
> (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type")> (subject Ovale1)
> (object "http://www.owl-ontologies.com/mammonto.owl#Ovale")> )
>
>
>
> (triple
> (predicate "http://www.owl-ontologies.com/mammonto.owl#__forme")> (subject Opacit_1)
> (object Ovale1)
> )
>
> so when I batch it and run it from java, it works properly, it gives me :
>
> compile:
> run:
> f-0 (MAIN::initial-fact)
> f-1 (MAIN::triple (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") (subject Anomalie1) (object "http://www.owl-ontologies.com/mammonto.owl#Anomalie"))> f-2 (MAIN::triple (predicate "http://www.owl-ontologies.com/mammonto.owl#contient_opacit_") (subject Anomalie1) (object Opacit_1))> f-3 (MAIN::triple (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") (subject Ovale1) (object "http://www.owl-ontologies.com/mammonto.owl#Ovale"))> f-4 (MAIN::triple (predicate "http://www.owl-ontologies.com/mammonto.owl#__forme") (subject Opacit_1) (object Ovale1))> For a total of 5 facts in module MAIN.
>
> f-0 (MAIN::initial-fact)
> f-1 (MAIN::triple (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") (subject Anomalie1) (object "http://www.owl-ontologies.com/mammonto.owl#Anomalie"))> f-2 (MAIN::triple (predicate "http://www.owl-ontologies.com/mammonto.owl#contient_opacit_") (subject Anomalie1) (object Opacit_1))> f-3 (MAIN::triple (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") (subject Ovale1) (object "http://www.owl-ontologies.com/mammonto.owl#Ovale"))> f-4 (MAIN::triple (predicate "http://www.owl-ontologies.com/mammonto.owl#__forme") (subject Opacit_1) (object Ovale1))> f-5 (MAIN::triple (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") (subject Anomalie1) (object "http://www.owl-ontologies.com/mammonto.owl#ACR3"))> For a total of 6 facts in module MAIN.
>
> BUILD SUCCESSFUL (total time: 1 second)
>
> That's what i'd like to reach by adding facts from java.
> in the string factstr, Instead of assert (triple...) i've tried to
put also: (deffacts fact1 (..........) ) like i've done in the .clp but
it gaves me the same above error. I dunno what's wrong !
> Thanx a lot for ur help,
>
>
>
>
>
>
> [EMAIL PROTECTED] wrote:
> I think ahmad Sayed wrote:
> >
> > For a total of 1 facts in module MAIN.
> > Jess reported an error in routine Funcall.execute
> > while executing (triple (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") ....................................etc...>
> OK, sorry, I didn't look closely at your code the first time. Let's
> look at three lines of your Java code:
>
> This first one creates an ordered fact of type "myfact1". Not sure
> what this is for, but it doesn't hurt anything.
> > Fact f = new Fact("myfact1", r);
>
> This next one is where the error is occurring; the message "while
> executing (triple..." is a hint that your facts are being interpreted
> as function calls. That's because in the following line, you pass the
> text of an "assert" function call to "assertString". assertString
> wants the text of a single fact; you've instead sent it the text of a
> function call that asserts two facts, and so it throws the exception.
> > f=r.assertString(factstr);
>
> If the previous line *had* succeeded, there would be no need to assert
> "f" here, as the assertString call would have asserted it, so this
> line would have no effect.
> > r.assertFact(f);
>
> Replace all three of these lines with
>
> r.executeCommand(factstr);
>
> and you should be in good shape.
>
>
>
>
>
>
>
> ---------------------------------------------------------
> 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]


Yahoo! Mail
Use Photomail to share photos without annoying attachments.

Reply via email to