On JessTab-related issues, you are better off asking questions on the [EMAIL PROTECTED] list.

(instanceof ?c1 Customer-related\ Information\ Element)

doesn't work because, in the Protege/JessTab environment, there is no Java class Customer-related\ Information\ Element.

It seems that the following should work:

(filter (lambda (?c)(eq (class ?c) Customer-related\ Information\ Element)) ?r)

where ?r is your list of Information\ Element instances.

Samson

Dona Mommsen wrote:
Hi,

I'm trying to make a small example how to use filter in combination with Protege. So far I haven't figured out whether I'm making a trivial mistake in the way I'm trying to use filter, or whether there is a particular Protigi / JessTab problem that I'm not getting.

 I have the following class and subclasses in Protege
(unfortunately the names have spaces, therefore the \):
class: Information\ Element
subclasses:      Customer-related\ Information\ Element
            Portfolio-related\ Information\ Element
            

a) WITHOUT any Protege particularities: Assume that ?r is a list with of instances of Information\ Element, and now I would like to use filter to get all instances Customer-related\ Information\ Element, how would the syntax look like?

b) Predicate function: Testing class With Protege  and JessTab
I used (mapclass Information\ Element) to assert the facts.
?c1 is a Protege instance of Customer-related\ Information\ Element

Jess> ?c1
<Java-Object:edu.stanford.smi.protege.model.DefaultSimpleInstance>


I can get the class of a Protege instance with a JessTab function and test for equality

Jess> (eq (class ?c1) Customer-related\ Information\ Element)
TRUE


However, the built-in Jess function instanceof creates a 'Class not found' error

Jess> (instanceof ?c1 Customer-related\ Information\ Element)
Jess reported an error in routine instanceof
while executing (instanceof ?c1 Customer-related Information Element).
  Message: Class not found: Customer-related Information Element.
Program text: ( instanceof ?c1 Customer-related Information Element ) at line 105.

Nested exception is:
Customer-related Information Element


AFAIK this is the expected behavior for mapped Protege instances.

The JessTab function instancep just tests if an instance is a Protege instance, thus

(filter instancep ?r)

just returns the entire list ?r.

So how do I have to express the predicate function to test the class of a protege instance?

Thanks in advance for any help.

Dona


--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------


--
Samson Tu                    email: [EMAIL PROTECTED]
Senior Research Scientist    web: www.stanford.edu/~swt/
Stanford Medical Informatics phone: 1-650-725-3391
Stanford University          fax: 1-650-725-7944

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to