RE: Java - CompoundTerm - Variable

From: josh singer <josh.singer_at_parc-technologies.com>
Date: Wed 12 Dec 2001 02:50:32 PM GMT
Message-ID: <0B9686DD2E83D411B67200508B9A9DA255F785@LON-SRV2>
Hi Olivier,

If you would like to call a goal using rpc and you would like your goal to
contain multiple occurences of a variable, this is not directly possible
using the variant of rpc which takes a CompoundTerm as a parameter. 

This is because only anonymous variables can be represented, using null. 

If you want to have multiple occurrences of a variable in your goal you have
several options:

1. define a different predicate which only has one variable occurence, but
which calls a goal where the variable occurs more than once.

For example, if you want to call foo(X,X) from java, instead you define

bar(X):-
	foo(X, X).

and then call rpc(new CompoundTermImpl("bar", null)) in Java. 

This is suitable for most cases. 

2. use the variant of rpc which takes a String goal

e.g. in the above case, you can just call rpc("foo(X,X)");

This approach is quick and dirty (Strings aren't very clean to work with as
goals), but often suitable for simple goals.

3. use some other unique object which can occur mutliple times, to represent
the variable, then on the Eclipse side, replace occurences of this object
with the variable, before calling the goal. 

This is a bit trickier to implement, but once you have done so, it is very
flexible.

Hope this helps.

josh

Developer, Parc Technologies Limited
josh.singer@parc-technologies.com
http://www.parc-technologies.com

This e-mail message is for the sole use of the intended recipient(s)
-its contents are the property of Parc Technologies Limited (or its
licensors) and are confidential. Please do not copy, review, use
(except for the intended purposes), disclose or distribute the e-mail
or its contents (or allow anyone else to do so) without our prior
permission. Parc Technologies Limited does not guarantee that this
e-mail has not been intercepted and amended nor that it is
virus-free. You should carry out your own virus checks before opening
any attachment.  Any opinions expressed in this e-mail message are
those of the author and not necessarily Parc Technologies Limited.


-----Original Message-----
From: Olivier Thirifay [mailto:olithiri@hotmail.com]
Sent: Wednesday, December 12, 2001 12:28 PM
To: eclipse-users@icparc.ic.ac.uk
Subject: [eclipse-users] Java - CompoundTerm - Variable


Hello,

Is there no possibilities to represent a term with multiple occurences to 
return it to Java ?
>
>Variables
>Using CompoundTerm you cannot represent a term with multiple occurrences of

>a single variable.

Thanks

Olivier

_________________________________________________________________
Rejoignez le plus grand service de messagerie au monde avec MSN Hotmail. 
http://www.hotmail.com/fr
Received on Wed Dec 12 14:50:39 2001

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:12 PM GMT GMT