JESS: making str-cat correctly interpret \" signs

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

JESS: making str-cat correctly interpret \" signs

by Chirag Vesuvala :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I'm trying to retract a fact via the retract-string method.  I need to use the str-cat method to assemble my fact.  The problem is that the slot values of my fact have " " (double quotations) around them.  str-cat is not detecting that my \" should be interpreted as a " only.

How do I make str-cat concatenate a string which already has "" marks in it, so that it doesn't include the extra \ sign?  See the example below if this is way too confusing to understand. 

Yes, i am importing a .owl file developed in protege.

(retract-string (str-cat
    "(triple
    (predicate \"http://www.semanticweb.org/ontologies/ImageEditor.owl#Pickable\")
    (subject \" " ?tool "\")  <----------- notice the 2 \" on this line
    (object \"false\"))"
                     )
)

The fact in the working set looks like this:
(triple
    (predicate "http://www.semanticweb.org/ontologies/ImageEditor.owl#Pickable")
    (subject "myTool")   <---------  This is how it should look.  No \" should be there.
    (object "false")
)


Thanks,
Chirag

Re: JESS: making str-cat correctly interpret \" signs

by Chirag Vesuvala :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Nevermind, I seem to have figured it out.

I dont know what I did wrong, but this line works:

(retract-string (str-cat "(MAIN::triple (predicate " "\"http://www.semanticweb.org/ontologies/ImageEditor.owl#Pickable\"" ") (subject \"" ?tool1 "\") (object " "\"true\"" "))"))

Perhaps I messed up some brackets or inverted commas before....or maybe it was the missing "MAIN::" in the head of my fact that I needed...

Problem solved.

/Chirag

On 31/03/2008, Chirag Vesuvala <chiragvesuvala@...> wrote:
Hi all,

I'm trying to retract a fact via the retract-string method.  I need to use the str-cat method to assemble my fact.  The problem is that the slot values of my fact have " " (double quotations) around them.  str-cat is not detecting that my \" should be interpreted as a " only.

How do I make str-cat concatenate a string which already has "" marks in it, so that it doesn't include the extra \ sign?  See the example below if this is way too confusing to understand. 

Yes, i am importing a .owl file developed in protege.

(retract-string (str-cat
    "(triple
    (predicate \"http://www.semanticweb.org/ontologies/ImageEditor.owl#Pickable\")
    (subject \" " ?tool "\")  <----------- notice the 2 \" on this line
    (object \"false\"))"
                     )
)

The fact in the working set looks like this:
(triple
    (predicate "http://www.semanticweb.org/ontologies/ImageEditor.owl#Pickable")
    (subject "myTool")   <---------  This is how it should look.  No \" should be there.
    (object "false")
)


Thanks,
Chirag


Re: JESS: making str-cat correctly interpret \" signs

by Win Carus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Chirag.

You might consider using the much richer and more flexible (format)
function with a nil router instead of (str-cat).

If ?predicate, ?subject, and ?object are all strings:

(retract-string
    (format nil "(triple (predicate \"%s\") (subject \"%s\") (object
\"%s\"))" ?predicate ?subject ?object))

Regards,

Win

Chirag Vesuvala wrote:

> Hi all,
>
> I'm trying to retract a fact via the retract-string method.  I need to
> use the str-cat method to assemble my fact.  The problem is that the
> slot values of my fact have " " (double quotations) around them.
> str-cat is not detecting that my \" should be interpreted as a " only.
>
> How do I make str-cat concatenate a string which already has "" marks
> in it, so that it doesn't include the extra \ sign?  See the example
> below if this is way too confusing to understand.
>
> Yes, i am importing a .owl file developed in protege.
>
> (retract-string (str-cat
>     "(triple
>     (predicate
> \"http://www.semanticweb.org/ontologies/ImageEditor.owl#Pickable\
> <http://www.semanticweb.org/ontologies/ImageEditor.owl#Pickable%5C>")
>     (subject \" " ?tool "\")  <----------- notice the 2 \" on this line
>     (object \"false\"))"
>                      )
> )
>
> The fact in the working set looks like this:
> (triple
>     (predicate
> "http://www.semanticweb.org/ontologies/ImageEditor.owl#Pickable")
>     (subject "myTool")   <---------  This is how it should look.  No
> \" should be there.
>     (object "false")
> )
>
>
> Thanks,
> Chirag

begin:vcard
fn:Win Carus
n:Carus;Win
org:Information Extraction Systems, Inc. (tm)
adr:;;20 East Quinobequin Road;Waban;MA;02468;USA
email;internet:Win.Carus@...
title:President
tel;work:(617) 244-5068
tel;fax:(617) 244-5068
note;quoted-printable:=E2=80=9CInformation Extraction Systems=E2=80=9D, =E2=80=9CInfoExtract=E2=
        =80=9D, and =E2=80=9CIEBuilder=E2=80=9D are trademarks or registered trad=
        emarks owned by Information Extraction Systems, Inc.
x-mozilla-html:FALSE
url:http://www.InfoExtract.com
version:2.1
end:vcard