Matching rules for metaclass

27 views
Skip to first unread message

levi...@gmail.com

unread,
May 9, 2008, 8:59:02 AM5/9/08
to CLIPSESG
This is a crosspost from comp.lang.lisp

I have a huge ontology represented in clips (it was built with
protege). It is a hierarchical structure made of COOL objects. I want
to filter out references to instances.

So the problem would look like I have a pattern to match where I only
know the slot type, but not the slot name.

A little example of what I'm thinking of:

(defclass A
(slot one (type INSTANCE))
(slot two (type SYMBOL))
)

(defclass B
(slot three (type INSTANCE))
)

(defclass C
(slot four (type SYMBOL))
)

(make-instance c1 of C
(four sym1)
)

(make-instance c2 of C
(four sym2)
)
(make-instace a1 of A
(one c1)
)
(make-instance b1 of B
(three c2)
)

I need a rule which would give back c1 and c2, because it is
referenced by other classes. I have of course a lot more classes (with
a lot of differently named slots) , and I don't want to write a rule
for each.


(messages from the other thread)
--------------------

On Thu, May 8, 2008 at 11:05 PM, michael bobak
<michae...@ucsf.edu> wrote:

Hello again, You say meta-class but you show super-class; &in
fact missed a few (you might notice the code won't load).
You might want to at least cross-post this to a CLIPS list. If
you (just) want sub-classes, there is a function for that, and you can
set it up, to call it recursively. Is that what you want?

(I replied:)

No, it's not about subclasses:
I need a rule which matches the pattern
(slot .... (type INSTANCE))

and gives back slot names
(or gives back instances which classes are like that)

Johan Lindberg

unread,
May 10, 2008, 11:00:03 AM5/10/08
to CLIP...@googlegroups.com
Hi,

> I have a huge ontology represented in clips (it was built with
> protege). It is a hierarchical structure made of COOL objects. I want
> to filter out references to instances.
>
> So the problem would look like I have a pattern to match where I only
> know the slot type, but not the slot name.

> A little example of what I'm thinking of:

> ...


> I need a rule which would give back c1 and c2, because it is
> referenced by other classes. I have of course a lot more classes (with
> a lot of differently named slots) , and I don't want to write a rule
> for each.

> ...


> I need a rule which matches the pattern
> (slot .... (type INSTANCE))
>
> and gives back slot names
> (or gives back instances which classes are like that)

You can do what you describe with the test-CE using a deffunction to
filter out slots of the right type. Something along the lines of:

CLIPS> (deffunction get-instance-slots (?instance)
"Returns a Multifield containing the slots in ?instance
that has the type INSTANCE-ADDRESS. Returns
FALSE if none are found."

(bind $?result (create$))
(progn$ (?slot (class-slots (class ?instance)))
(if (member$ INSTANCE-ADDRESS (slot-types (class ?instance) ?slot))
then (bind $?result (create$ $?result ?slot))))
(if (eq 0 (length$ $?result))
then (return FALSE)
else (return $?result)))

And using it in a rule could look something like this:

CLIPS> (defrule match-instances
?o <- (object (is-a USER))
(test (neq FALSE (get-instance-slots ?o)))
=>
(printout t ?o " " (get-instance-slots ?o) crlf))

Which gives the following output (using your example code):

CLIPS> (run)
<Instance-b1> (three)
<Instance-a1> (one)
CLIPS>

HTH
Johan Lindberg
jo...@pulp.se

rodrick chalwe

unread,
May 10, 2008, 12:35:48 PM5/10/08
to CLIP...@googlegroups.com

I downloaded CLIPS 6.30 for windows but it  does not contain the CLIPS.bdsgroup file which can be used to build projects using Borland Turbo C++ 2006.  What can i do?

Johan Lindberg <johan.h....@gmail.com> wrote:
(three)

(one)
CLIPS>

HTH
Johan Lindberg
jo...@pulp.se


Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

Johan Lindberg

unread,
May 10, 2008, 1:50:55 PM5/10/08
to CLIP...@googlegroups.com
Hi,

> I downloaded CLIPS 6.30 for windows but it does not contain the
> CLIPS.bdsgroup file which can be used to build projects using Borland Turbo
> C++ 2006. What can i do?

Did you download the source code distro
CLIPS_6.30_Beta_Windows_Source_Code_Installer_R3.msi or did you get
the binary installer
CLIPS_6.30_Beta_Windows_Application_Installer_R3.msi? IIRC it is only
included in the source code distro.

HTH
Johan Lindberg
johan@pulp.

rodrick chalwe

unread,
May 10, 2008, 2:36:45 PM5/10/08
to CLIP...@googlegroups.com
site do i get

Johan Lindberg <johan.h....@gmail.com> wrote:

Hi,
I downloaded CLIPS_6.30_Beta_Windows_Application_Installer_R3.msi.
Type: Window Installer Package
align=center>If i have seen further its by standing on the shoulders of the great

rodrick chalwe

unread,
May 10, 2008, 3:00:36 PM5/10/08
to CLIP...@googlegroups.com
I downloaded application installer.  Which is the right one


rodrick chalwe <oner...@yahoo.com> wrote
Johan Lindberg <johan.h....@gmail.com> wrote:

Hi,

wnloaded CLIPS 6.30 for windows but it does not contain the
> CLIPS.bdsgroup file which can be used to build projects using Borland Turbo
> C++ 2006. What can i do?

Did you download the source code distro
CLIPS_6.30_Beta_Windows_Source_Code_Installer_R3.msi or did you get
the binary installer
CLIPS_6.30_Beta_Windows_Application_Installer_R3.msi? IIRC it is only
included in the source code distro.

HTH
Johan Lindberg
johan@pulp.

align=center>If i have seen further its by standing on the shoulders of the great

Johan Lindberg

unread,
May 10, 2008, 3:14:33 PM5/10/08
to CLIP...@googlegroups.com
Hi,

> I downloaded application installer. Which is the right one

The source code installer is the one you want.

BR
Johan Lindberg
jo...@pulp.se

rodrick chalwe

unread,
May 10, 2008, 7:03:44 PM5/10/08
to CLIP...@googlegroups.com
I have downloaded the source code installer and installed it.  However, am failing to build projects using c++.  I have tried to follow instructions on page 200 of the advanced programming guide but i just don't seem to get there.  will you please assist.

Johan Lindberg <johan.h....@gmail.com> wrote:

CLIPS Support

unread,
May 10, 2008, 7:06:51 PM5/10/08
to CLIPSESG
What specifically went wrong?

On May 10, 6:03 pm, rodrick chalwe <onero...@yahoo.com> wrote:
> I have downloaded the source code installer and installed it.  However, am failing to build projects using c++.  I have tried to follow instructions on page 200 of the advanced programming guide but i just don't seem to get there.  will you please assist.
>
> Johan Lindberg <johan.h.lindb...@gmail.com> wrote:  
>
> Hi,
>
> > I downloaded application installer. Which is the right one
>
> The source code installer is the one you want.
>
> BR
> Johan Lindberg
> jo...@pulp.se
>
> If i have seen further its by standing on the shoulders of the great
>
> ---------------------------------

rodrick chalwe

unread,
May 10, 2008, 7:20:27 PM5/10/08
to CLIP...@googlegroups.com
When i double click on CLIPS.bdsgroup, ican only see the code and not project menu nor the menu item make all projects. And how do write a program in c++ and execute it using clips.  If possible give an example.

CLIPS Support <gdronl...@swbell.net> wrote:

What specifically went wrong?


On May 10, 6:03 pm, rodrick chalwe wrote:
> I have downloaded the source code installer and installed it.  However, am failing to build projects using c++.  I have tried to follow instructions on page 200 of the advanced programming guide but i just don't seem to get there.  will you please assist.
>
> Johan Lindberg wrote:  
>
> Hi,
>
> > I downloaded application installer. Which is the right one
>
> The source code installer is the one you want.
>
> BR
> Johan Lindberg
> jo...@pulp.se
>
> If i have seen further its by standing on the shoulders of the great
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

CLIPS Support

unread,
May 11, 2008, 1:18:58 AM5/11/08
to CLIPSESG
What do you mean you only see the code? Did Turbo C launch? If so
which version are you using? What menu items do you see? Have you used
Turbo C before?

On May 10, 6:20 pm, rodrick chalwe <onero...@yahoo.com> wrote:
> When i double click on CLIPS.bdsgroup, ican only see the code and not project menu nor the menu item make all projects. And how do write a program in c++ and execute it using clips.  If possible give an example.
>

rodrick chalwe

unread,
May 11, 2008, 1:32:26 AM5/11/08
to CLIP...@googlegroups.com
I have never used turbo c before.  The code look like html.

CLIPS Support <gdronl...@swbell.net> wrote:

What do you mean you only see the code? Did Turbo C launch? If so
which version are you using? What menu items do you see? Have you used
Turbo C before?

On May 10, 6:20 pm, rodrick chalwe wrote:
> When i double click on CLIPS.bdsgroup, ican only see the code and not project menu nor the menu item make all projects. And how do write a program in c++ and execute it using clips.  If possible give an example.
>
> CLIPS Support wrote:  
>
> What specifically went wrong?
>
> On May 10, 6:03 pm, rodrick chalwe wrote:
>
>
>
> > I have downloaded the source code installer and installed it.  However, am failing to build projects using c++.  I have tried to follow instructions on page 200 of the advanced programming guide but i just don't seem to get there.  will you please assist.
>
> > Johan Lindberg wrote:  
>
> > Hi,
>
> > > I downloaded application installer. Which is the right one
>
> > The source code installer is the one you want.
>
> > BR
> > Johan Lindberg
> > jo...@pulp.se
>
> > If i have seen further its by standing on the shoulders of the great
>
> > ---------------------------------
> > Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
>
> If i have seen further its by standing on the shoulders of the great
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

CLIPS Support

unread,
May 11, 2008, 11:49:28 AM5/11/08
to CLIPSESG
It sounds like you don't have Turbo C installed on your machine and
some other program is launching to display the project file when you
double-click on it.

On May 11, 12:32 am, rodrick chalwe <onero...@yahoo.com> wrote:
> I have never used turbo c before.  The code look like html.
>

rodrick chalwe

unread,
May 12, 2008, 3:36:57 AM5/12/08
to CLIP...@googlegroups.com
Thanks for the advice.  Where can i get Turbo c 

CLIPS Support <gdronl...@swbell.net> wrote:

It sounds like you don't have Turbo C installed on your machine and
some other program is launching to display the project file when you
double-click on it.

On May 11, 12:32 am, rodrick chalwe wrote:
> I have never used turbo c before.  The code look like html.
>
shoulders of the great


Johan Lindberg

unread,
May 12, 2008, 3:54:05 AM5/12/08
to CLIP...@googlegroups.com
> Where can i get Turbo c

Try http://www.codegear.com/products/turbo

BR
Johan Lindberg
jo...@pulp.se

danny nkutua

unread,
May 13, 2008, 9:39:16 AM5/13/08
to CLIP...@googlegroups.com

pleaze i really need your help, i'm building an application and i have many problem about how to connect CLIPS and java. if you can help me to find some pdf book i really be so gland

thank for all you'll do for me


__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
http://mail.yahoo.fr Yahoo! Mail

Johan Lindberg

unread,
May 13, 2008, 10:14:42 AM5/13/08
to CLIP...@googlegroups.com
Hi,

> pleaze i really need your help, i'm building an application and i have many
> problem about how to connect CLIPS and java. if you can help me to find some
> pdf book i really be so gland

Have you written any code yet? If so, could you be more specific as to
what is giving you problems? If you haven't written any code yet I
think that looking at the examples in the CLIPSJNI package[1] might be
a good way to jump-start your efforts.

HTH
Johan Lindberg
jo...@pulp.se

[1] http://clipsrules.sourceforge.net/CLIPSJNIBeta.html

Reply all
Reply to author
Forward
0 new messages