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]
--------------------------------------------------------------------

Reply via email to