Re: Powerloom API

Rera <[email protected]> Mon, 10 Dec 2007 06:43:32 -0800 (PST)
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>


Thomas Russ wrote:
> 
> 
> On Oct 31, 2007, at 3:04 AM, Andrea Poli wrote:
> 
>> Thomas Russ ha scritto:
>>> On Oct 30, 2007, at 7:14 AM, Magnus Malm wrote:
>>>
>>>
>>>> Hello
>>>>
>>>> I am looking into the API of PowerLoom, and I was just wondering if
>>>> there's some examples of how to use it? Especially the s-*
>>>> functions. How to create/delete concepts, objects, relations, etc.
>>>> If there's no such examples available, perhaps someone could post
>>>> one or two quick and simple ones to the mailinglist?
>>>>
>>>
>>> You didn't specify which language you were planning to use.
>>>
>>>
>> I need to use C++ for my thesis on home automation
>>> There is an example file for Java, which is on the documentation page
>>> of our web site:
>>>
>>>    <http://www.isi.edu/isd/LOOM/PowerLoom/documentation/
>>> PowerLoomExample.java>
>>>
>>>
>>>
>> The manual hasn't any documentation on C++ API. There are some  
>> examples?
> 
> We don't really have any specific C++ examples, since we haven't  
> programmed directly using that language.  When we use the C++ version  
> of PowerLoom, we have always done that through the Stella programming  
> language and had the resulting C++ code generated for us.
> 
> What you can do, however, is use the command "cpptrans" in the  
> PowerLoom listener to translate and print Stella constructs in their C 
> ++ form.  That will allow you to see how constructs from the  
> reference manual will look.  There are also analogous commands for  
> java "jptrans" and lisp "ptrans".  The name is short for "print  
> translation".
> 
> For example:
> 
> PL-USER |= (cpptrans (pli/get-concept "RELATION" null null))
> 
> pli::getConcept("RELATION", NULL, NULL)
> 
> PL-USER |= (cpptrans (pli/s-retrieve "all (concept ?y" null null))
> 
> pli::sRetrieve("all (concept ?y", NULL, NULL)
> 
> The main difference between the C++ examples and the Java code is  
> that C++ uses namespaces corresponding to the PowerLoom modules, in  
> contrast to Java and Lisp which uses their native packages.  For  
> lisp, the pli functions are in the PLI package.  All others are in  
> the STELLA package.
> 
> The other difference in C++ compared to Java, is that objects are  
> referred to using pointers.
> 
> PL-USER |= (cpptrans (let ((c (pli/get-concept "CONCEPT" null null))
>                             (it (pli/get-concept-instances c null  
> null)))
>                         (print it)))
> 
> { LogicObject* c = pli::getConcept("CONCEPT", NULL, NULL);
>    pli::PlIterator* it = pli::getConceptInstances(c, NULL, NULL);
> 
>    std::cout << it;
> }
> 
> The naming convention transformations for C++ are the same as Java,  
> except that the "*" character is translated to "o" instead of "$".
> 
> 
> 
> 
> 
> _______________________________________________
> powerloom-forum mailing list
> [email protected]
> http://mailman.isi.edu/mailman/listinfo/powerloom-forum
> 
> 
Be patient with me, I'm an absolute beginners in programming (with C++).
What I need to load in my own code to use PowerLoom C++ functions?
Which files have I to include?
Thanks

-- 
View this message in context: http://www.nabble.com/Powerloom-API-tp13489585p14254165.html
Sent from the PowerLoom mailing list archive at Nabble.com.