Object passing

Issue #14 new
Brendan McCarthy created an issue

Hello,

A few questions:

(1) Is there a way to create a Term wrapping an arbitrary Java object in order to pass to Prolog? The examples all involve the runtime creating the $obj_n terms automagically from the method signature or by calling new. I can workaround with some effort, but just wondering if there is an easier way.

(2) Is there a way to pass a java object back from Prolog to java? It seems when I try this I only the the "$obj_n" string.

Thanks in advance,

/brendan

Comments (1)

  1. Philipp Kraus

    i'm trying to integrate tuProlog in my AI platform http://lightjason.org and I'm using native / pure Java objects in my term structure, I have taken a look into the code and imho an idea to solve the problem is to build a new term-type e.g.

    public Raw extends Term
    {
    }
    

    and the term class must be extend with a method to determine if a term is a raw object and returning the raw data

    public boolean isRaw();
    public <T> T raw();
    

    and the TermVisitor class must be extend to a visit method to catch the data

    public void visit( final Raw p_value );
    

    Is this a possible enhancment?

  2. Log in to comment