Re: very basic question

Thomas Russ <[email protected]>
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>
On Sep 22, 2004, at 11:13 AM, Leo Ferres wrote:

> Hi, again;
>
> The (load) command worked!!! Thanks. Now I have another "startup"
> problem. Suppose I loaded your kbs/business.ploom KB and I'd like the
> system to return a list of the companies.
>
> 1) how do I change the "context"?

You should use CC to change the context.  CC is quite
flexible, but it does have some complicated ramifications.

The first is that the names used for finding contexts are
case-sensitive.
The second is that unless in a case-sensitive module, PowerLoom
will convert all symbol names to uppercase.

What that means is that the name of the context you want is
actually "BUSINESS".  Therefore, there are two possible ways
to get there.  They are:

|= (cc business)

|= (cc "BUSINESS")

The first works because of the conversion to canonical
uppercase of the symbol name.
The second works because we gave the name as a string in
the proper case.  Strings, unlike symbols, do not get a
case transformation applied.

> 2) I issued a (retrieve (COMPANY ?x)), but it didn't work... what am I
> doing wrong?

The proper PowerLoom context (module) was not selected.  The
error messages indicate that.  Also, CC will always return
what the new context is.  If an error occurs, you will note
that the returned value is the context you started in.

> Below you'll find a copy of a small session in which I try it and the
> messages I get. I'm sorry I don't have more interesting questions to 
> ask
> yet...

These are actually quite useful questions for us, since they
indicate areas where we need to expand the documentation of
the system.  It's also one of the hardest areas for us to
identify, because our familiarity with the system means we
overlook a lot of these issues when we write manuals.

>
> Thanks,
>
> Leo
>
> ---
>
> |= (cc)
>
> |MDL|/PL-KERNEL-KB/PL-USER
>
> |= (load "kbs/business.ploom")
>
> |= (cc "business")
>
>>> Error: No context with name or nickname `business'
> |= (cc)
>
> |MDL|/PL-KERNEL-KB/PL-USER
>
> |= (retrieve (COMPANY ?x))
>
> Processing check-types agenda...
> ERROR: Undeclared predicate or function reference: `COMPANY'.
>    Error occurred while parsing the proposition:
>    (KAPPA (?X) (COMPANY ?X))
>
> |= (cc "/PL-KERNEL/BUSINESS")
>
>>> Error: No context with name `/PL-KERNEL/BUSINESS'

The other issues were explained above.

This was actually quite a clever thing to try, since the
full name of the module is, in fact, /PL-KERNEL/BUSINESS.

But what wasn't clear is the difference between symbols
and strings in the language.  Unfortunately, by enclosing
the name in double quotes and making it a string, the normal
parsing of PowerLoom symbols was by-passed and the search
was made for a context/module with the name "/PL-KERNEL/BUSINESS"
instead of a module with the name "BUSINESS" as a sub-module
of "PL-KERNEL".  To get the proper pathname parsing for names,
they have to be supplied as symbols (without the quotes)
instead of strings.

It's clear that we need to have some discussion of this
issue in our documentation, since I'm sure it can be a
source of confusion to many people.

-Tom.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.