Google Groups Home
Help | Sign in
Matching rules for metaclass
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  17 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
zslevi@gmail.com  
View profile
 More options May 9, 8:59 am
From: "zsl...@gmail.com" <levili...@gmail.com>
Date: Fri, 9 May 2008 05:59:02 -0700 (PDT)
Local: Fri, May 9 2008 8:59 am
Subject: Matching rules for metaclass
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

<michael.bo...@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)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Johan Lindberg  
View profile
 More options May 10, 11:00 am
From: "Johan Lindberg" <johan.h.lindb...@gmail.com>
Date: Sat, 10 May 2008 17:00:03 +0200
Local: Sat, May 10 2008 11:00 am
Subject: Re: Matching rules for metaclass
Hi,

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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rodrick chalwe  
View profile
 More options May 10, 12:35 pm
From: rodrick chalwe <onero...@yahoo.com>
Date: Sat, 10 May 2008 09:35:48 -0700 (PDT)
Local: Sat, May 10 2008 12:35 pm
Subject: Re: Matching rules for metaclass

  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.lindb...@gmail.com> wrote:  

Hi,

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)
(three)
(one)
CLIPS>

HTH
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.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Johan Lindberg  
View profile
 More options May 10, 1:50 pm
From: "Johan Lindberg" <johan.h.lindb...@gmail.com>
Date: Sat, 10 May 2008 19:50:55 +0200
Local: Sat, May 10 2008 1:50 pm
Subject: Re: Matching rules for metaclass
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.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rodrick chalwe  
View profile
 More options May 10, 2:36 pm
From: rodrick chalwe <onero...@yahoo.com>
Date: Sat, 10 May 2008 11:36:45 -0700 (PDT)
Local: Sat, May 10 2008 2:36 pm
Subject: Re: Matching rules for metaclass

site do i get

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

Hi,
I downloaded CLIPS_6.30_Beta_Windows_Application_Installer_R3.msi.
  Type: Window Installer Package

> 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.

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.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rodrick chalwe  
View profile
 More options May 10, 3:00 pm
From: rodrick chalwe <onero...@yahoo.com>
Date: Sat, 10 May 2008 12:00:36 -0700 (PDT)
Local: Sat, May 10 2008 3:00 pm
Subject: Re: Matching rules for metaclass

I downloaded application installer.  Which is the right one

rodrick chalwe <onero...@yahoo.com> wrote

Johan Lindberg <johan.h.lindb...@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

---------------------------------
  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.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Johan Lindberg  
View profile
 More options May 10, 3:14 pm
From: "Johan Lindberg" <johan.h.lindb...@gmail.com>
Date: Sat, 10 May 2008 21:14:33 +0200
Local: Sat, May 10 2008 3:14 pm
Subject: Re: Matching rules for metaclass
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rodrick chalwe  
View profile
 More options May 10, 7:03 pm
From: rodrick chalwe <onero...@yahoo.com>
Date: Sat, 10 May 2008 16:03:44 -0700 (PDT)
Local: Sat, May 10 2008 7:03 pm
Subject: Re: Matching rules for metaclass

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

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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CLIPS Support  
View profile
 More options May 10, 7:06 pm
From: CLIPS Support <gdronline2...@swbell.net>
Date: Sat, 10 May 2008 16:06:51 -0700 (PDT)
Local: Sat, May 10 2008 7:06 pm
Subject: Re: Matching rules for metaclass
What specifically went wrong?

On May 10, 6:03 pm, rodrick chalwe <onero...@yahoo.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rodrick chalwe  
View profile
 More options May 10, 7:20 pm
From: rodrick chalwe <onero...@yahoo.com>
Date: Sat, 10 May 2008 16:20:27 -0700 (PDT)
Local: Sat, May 10 2008 7:20 pm
Subject: Re: Matching rules for metaclass

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 <gdronline2...@swbell.net> wrote:  

What specifically went wrong?

On May 10, 6:03 pm, rodrick chalwe wrote:

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.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CLIPS Support  
View profile
 More options May 11, 1:18 am
From: CLIPS Support <gdronline2...@swbell.net>
Date: Sat, 10 May 2008 22:18:58 -0700 (PDT)
Local: Sun, May 11 2008 1:18 am
Subject: Re: Matching rules for metaclass
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:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rodrick chalwe  
View profile
 More options May 11, 1:32 am
From: rodrick chalwe <onero...@yahoo.com>
Date: Sat, 10 May 2008 22:32:26 -0700 (PDT)
Local: Sun, May 11 2008 1:32 am
Subject: Re: Matching rules for metaclass

I have never used turbo c before.  The code look like html.

CLIPS Support <gdronline2...@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:

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.