Re: Beginner - Help Needed!
Thomas Russ <[email protected]> Mon, 30 Jun 2008 21:16:04 -0700
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <[email protected]> |
On Jun 30, 2008, at 7:42 PM, Rangarajan Krishnamoorthy wrote:
> Hi,
> I have just downloaded PowerLoom on Windows. I am using LispWorks 5.1.
> Although the documentation of PowerLoom talks about the language and
> API, I do not find examples of how to call the API from Lisp. I could
> not even get started with simple examples using the API from Lisp.
First off, I apologize because we have not yet had the opportunity to
finish the lisp-specific section of the manual.
Fortunately, the Lisp interface is straight-forward, since the
documentation of the functions are all in the Lisp syntax. The key
items that are missing from the documentation are:
1. The PowerLoom Interface functions from section 7 are all in the PLI
package. Those API functions are exported and are intended for use
from your own Lisp program.
2. All other PowerLoom functions are in the STELLA package, but are
not exported. This includes all of the normal PowerLoom functions. So
it is often convenient to just operate in the STELLA package. This
works well for interactive development using the Lisp environment.
So, to use PowerLoom in Lisp one would need to do the following:
(load "load-powerloom.lisp")
(in-package "STELLA")
;; At this point you can just type PowerLoom commands,
;; or you could go through the annotated example in the manual.
(defconcept Person)
(deffunction age ((?p person) (?age integer)))
(defrelation friend ((?p1 person) (?p2 person)))
(assert (person fred))
(assert (person rajiv))
(assert (and (age fred 20) (age rajiv 19) (friend fred rajiv)))
(ask (age fred 20))
(ask (age fred 30))
(retrieve all (friend ?x rajiv))
(defconcept teenager ((?p person))
:<=> (and (person ?p)
(< (age ?p) 20)
(> (age ?p) 12)))
(retrieve all (teenager ?p))
(retrieve all (and (teenager ?p) (age ?p ?age)))
>
> There is some mention of "translation" to C++, etc. Does it mean that
> PowerLoom code can be translated to Lisp (or C++) and then used in
> that mode? How do I invoke the translator?
PowerLoom itself has already been translated to Lisp, Java and C++.
This is done by using our underlying Stella language, which has such a
translator. More information and an incomplete manual can be found at
http://www.isi.edu/isd/LOOM/Stella/index.html
When using Stella to write programs, one would normally build a
"system" which has a description of the files and Stella modules
(namespaces) involved. Then the translator is invoked with
(make-system "system-name" :target-language)
where the :target-language is one of :common-lisp :java or :cpp
and "system-name" is the name of your system.
>
> Thanks for your help.
I hope this helps to get you started. If this isn't quite enough,
please ask further questions and we'll help you get started.
>
> Regards,
> Rangarajan_______________________________________________
> powerloom-forum mailing list
> [email protected]
> http://mailman.isi.edu/mailman/listinfo/powerloom-forum