Hi,
Well, as far as "subslots", Jess doesn't support those; instead you'll
need to push everything up to the top level; where you currently have
a "Name" slot with structure, you'll instead want a Name deftemplate
with a series of slots, and a name slot in (e.g.) Person to refer to
Name instances.
As for determining the inheritance between deftemplates at runtime:
first, you can use the Rete.listDeftemplates(),
Deftemplate.getParent() and Deftemplate.getName() methods from Java to
figure this out. But I should point out that in general, as it is in
any other object-oriented language, this is a Bad Idea and should be
avoided.
Usually the only reason people want to explicitly know that a Person
is a Mammal is so that they can write an if-then statement on the
type. Instead, use explicit rules. Match Mammal for things that should
be done to all Mammals, Person for things that should only be done for
person. Then the fact that a Person is a Mammal gets handled
automatically.
I think boysss wrote:
> Hello to all,
>
> I am a newbie to Experts System trying to develop a
> domain knowledge for accessing mutli-databases. I am
> trying to use frame representation as the formalism.
>
> ;------------------------------------------------------
> ; For example a simple Ontology between Mammal,
> Persons and Student:
> ;------------------------------------------------------
>
> (deffacts ontology
>
> ; class hierarchy
> (class Things)
> (class Mammals)
> (class Persons)
> (class Students)
> (subclassOf Students Persons)
> (subclassOf Persons Mammals)
> (subclassOf Mammals Things)
>
> ; slot hierarchy
> (slot Attribute)
> (slot Name)
> (slot LastName)
> (slot ID)
> (slot StudentID)
> (subslotOf Name Attribute)
> (subslotOf LastName Name)
> (subslotOf ID Attribute)
> (subslotOf StudentID ID)
> )
>
>
> ;------------------------------------------------------;
> The facts for db schemas
> ;------------------------------------------------------(deffacts
> schemas
> (hasTable db1 Students)
> (hasField db1 StudentID)
> (hasField db1 LastName)
> (hasTable db2 Persons)
> (hasField db2 ID)
> (hasField db2 Name)
> (phase 1)
> )
>
>
> ;------------------------------------------------------;
> The rules for representing transitivity and
> reflexivity
> ;------------------------------------------------------(defrule
> class-transitivity
> (subclassOf ?x ?y)
> (subclassOf ?y ?z)
> =>
> ; (facts)
> (assert (subclassOf ?x ?z)))
>
> (defrule class-reflexivity
> (class ?x)
> =>
> (assert (subclassOf ?x ?x)))
>
> (defrule slot-transitivity
> (subslotOf ?x ?y)
> (subslotOf ?y ?z)
> =>
> (assert (subslotOf ?x ?z)))
>
> (defrule slot-reflexivity
> (slot ?x)
> =>
> (assert (subslotOf ?x ?x)))
>
>
> Although I could use defquery to determine the
> generalisation and specialisation relationship between
> each
> concepts so
> that all related data in the databases (that have
> generalisation or specialisation relationship) can be
> retrieved.
> For example; for
> (defquery search (declare (variables ?X)) (subclassOf
> ?X ?Y))
> ?X will always represent the specialisation class; ?Y
> the generalisation class.
>
>
> But how to do all these using unordered facts since
> the above example has been done using order facts.
> -------------------------------------------------------(deftemplate
> Thing)
>
> (deftemplate Mammal extends Thing
> (slot gender))
>
> (deftemplate Person extends Mammal
> (multislot name))
>
> (deftemplate Student extends Person
> (slot ID))
>
> ...
>
> I find some on now relationship can be detemined
> now???
> Please advise as I am very new here to expert system.
>
> thanks
> alvin
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Photos -- now, 100 FREE prints!
> http://photos.yahoo.com
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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]
---------------------------------------------------------------------