Algernon: how to store values in multiple cardinality slot

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Algernon: how to store values in multiple cardinality slot

Mauro Jansen

Using Algernon API from a Java Program (or direct from Algernon tab), how can I
store more than one value in a slot whose cardinality is multiple (with ADD-
INSTANCE command, for example)?

For example, if my ontology has a frame "person" with the string slots
"name" and "alias" that is multiple, how to use the ADD-INSTANCE command to
store a instance named "John" with the aliases "the flash" and "J"?

Thanks,
Mauro



-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

Re: Algernon: how to store values in multiple cardinality slot

R H-2

Mauro,

I copied your other email into this one since the topic is
the same.  Algernon tab is a bit different from the command
line.  In the tab the Ask and Tell keywords are buttons.
In the script, you must explicitly type them in, so
your add instance would in script look like:
(:TELL
((:add-instance
  (?Optional_Goal "Optional Goal" )
  (name ?Optional_Goal "Algernon Test")
)) )

the same with :ASK keyword, you would use it to query the
knowledge base.  
Another difference between the two keywords is that
:TELL asserts new knowledge in the AlgernonKB and thus
fires forward chaining rules if any. While :ASK queries
the KB and fires backward chaining rules.

Hope this helps,
Raja



Now my plugin can access the KB to read values, but scripts with the
ADD-INSTANCE or DELETE-INSTANCE like a simple
((:add-instance
  (?Optional_Goal "Optional Goal" )
  (name ?Optional_Goal "Algernon Test")
))
are not working. Algernon generates no errors, but no instance is added
or
deleted. If I run the same script in Algernon tab it works and the
instance
added appear in the instances tab. Where is the problem? It is
necessary any
additional java command to post or commit the "add or update" and
refresh
the instances tab view to show it? I tried run the command, save the
project,
close and reload, but the instance was really not added.

Thanks,
Mauro


Mauro Jansen <[hidden email]> wrote:
Using Algernon API from a Java Program (or direct from Algernon tab), how can I
store more than one value in a slot whose cardinality is multiple (with ADD-
INSTANCE command, for example)?

For example, if my ontology has a frame "person" with the string slots
"name" and "alias" that is multiple, how to use the ADD-INSTANCE command to
store a instance named "John" with the aliases "the flash" and "J"?

Thanks,
Mauro



-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html



               
---------------------------------
 
 What are the most popular cars? Find out at Yahoo! Autos

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

Re: Algernon: how to store values in multiple cardinality slot

Mauro Jansen

Hi Raja,

R H <rajamhayek <at> yahoo.com> writes:
> Algernon tab is a bit different from the command line.

In fact, I'm not using Algernon in command line mode. I have a Protegé plugin
written in java that calls Algernon API to execute these scripts with the
methods ask / tell. I revised my code to put the Algernon instance in the same
class of my plugin and it is working now. And I see that both ask and tell
execute the scripts, but with possible different results (certainly because the
forward / backward firing, as you explained).

The problem I'm trying to solve in this topic is how to use Algernon commands
to store more than one value on a multiple cardinality slot. I discovered that
repeating the slot in the add-instance command like in
((:ADD-INSTANCE (?p Person)
    (name ?p John
    (alias ?p J)
    (alias ?p "the flash")
 ))
it works, but what I need is to uptade the multiple cardinality slots with the
results of another query. There is any way to update a instance? (i found only
commands to add or delete instance). If exist, I could use it in the code.

Thanks,
Mauro


-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

Re: Algernon: how to store values in multiple cardinality slot

R H-2
Mauro,
 
  Most of algernon commands can be found on (with the exception of :TELL!) :
  http://algernon-j.sourceforge.net/doc/commands/
 
  Updating a slot is easily done via a tell command, if you have the  result from a query and you know which instance you are updating, all  you need is tell Algernon what to store:
 
  (:TELL (:instance Person ?p)(name ?p "John")(alias ?p "your results")))
 
  The problem you will have is uniqueness of the Person's name, so if you  use the :NAME slot instead, which is filled with Protege's generated  name, you will be guaranteed uniqueness.
 
  Raja
 

Mauro Jansen <[hidden email]> wrote:  
Hi Raja,

R H  yahoo.com> writes:
> Algernon tab is a bit different from the command line.

In fact, I'm not using Algernon in command line mode. I have a Protegé plugin
written in java that calls Algernon API to execute these scripts with the
methods ask / tell. I revised my code to put the Algernon instance in the same
class of my plugin and it is working now. And I see that both ask and tell
execute the scripts, but with possible different results (certainly because the
forward / backward firing, as you explained).

The problem I'm trying to solve in this topic is how to use Algernon commands
to store more than one value on a multiple cardinality slot. I discovered that
repeating the slot in the add-instance command like in
((:ADD-INSTANCE (?p Person)
    (name ?p John
    (alias ?p J)
    (alias ?p "the flash")
 ))
it works, but what I need is to uptade the multiple cardinality slots with the
results of another query. There is any way to update a instance? (i found only
commands to add or delete instance). If exist, I could use it in the code.

Thanks,
Mauro


-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html