Not sure if I explained myself correctly.
Initially I have the following deftemplate
(deftemplate PK (slot primarykey) (slot relation))
and several rules including
(defrule isObjProperty4D
"Determine Object Properties"
?fk <- (FK (foreignkey ?a)(relation ?r) {nonBinFK == TRUE})
(NN (attribute ?a))
(UNQ (attribute ?a))
(not(PK (primarykey ?a)))
=>
(printout t ?fk.foreignkey " foreign key of "?r" is an Object Property
and Functional Property and Inverse and Cardinality 1 (Rule 4D)" crlf)
)
However, if I change the deftemplate to
(deftemplate PK (declare (from-class PK)))
where my PK class has:
private String primarykey;
private String relation;
plus the constructor and getters,
then I get an error in the rule previously mentioned where I have PK:
Jess reported an error in routine Jesp.parsePattern.
Message: No such slot primarykey in template MAIN::PK at token
'primarykey'.
However, there is a slot "primarykey" in the PK class. And with the
previous deftemplate it works.
Any insights?
Thanks
Juan Sequeda, Ph.D Student
Dept. of Computer Sciences
The University of Texas at Austin
www.juansequeda.com
www.semanticwebaustin.org
On Wed, Apr 8, 2009 at 3:40 PM, Ernest Friedman-Hill <[email protected]>wrote:
> Not sure what "the exact same slot names as before" would mean, as the
> names that JavaBeans getter methods must have are different from the
> property names that get mapped into Jess templates. But even given that, I
> think the property name "bRel" is problematic. Remember that Jess follows
> the JavaBeans spec by using the java.beans.Introspector class to find bean
> properties. The JavaBeans spec includes a special case for names like
> "URLBase" that start with multiple caps. If you have a getter name like
> "getBRel", the JavaBeans property is "BRel", not "bRel". I think the only
> way to have a property by this name is to use a BeanInfo class and
> explicitly declare all the properties for your class. It would be easier
> just to use well-formed names.
>
>
>
> On Apr 8, 2009, at 4:15 PM, Juan Sequeda wrote:
>
> Hi everybody
>>
>> I have everything working in Jess. I define the deftemplates with slots:
>>
>> (deftemplate Rel (slot name) (slot bRel))
>>
>> Now I am to embed jess in my java application. I was following the Price
>> example, and created a model: a class for each of the templates and then
>> replace it in my rules file:
>>
>> (deftemplate Rel (declare (from-class Rel)))
>>
>> The java class has the exact slot names as I had before. However, the
>> second slot, bRel, is not read.
>>
>> if I replace it back to the original deftemplate with slots, it does work.
>> Any pointers?
>>
>> Thanks
>>
>> Jess reported an error in routine Jesp.parsePattern.
>> Message: No such slot bRel in template MAIN::Rel at token 'bRel'.
>> Program text: ( defrule isClass "Determine if a relation is a Class" ?r
>> <- ( Rel { bRel at line 25 in file generateOntology.clp.
>> at jess.Jesp.error(Unknown Source)
>> at jess.Jesp.a(Unknown Source)
>> at jess.InfixSlotParser.a(Unknown Source)
>> at jess.InfixSlotParser.a(Unknown Source)
>> at jess.InfixSlotParser.a(Unknown Source)
>> at jess.InfixSlotParser.if(Unknown Source)
>> at jess.InfixSlotParser.if(Unknown Source)
>> at jess.Jesp.a(Unknown Source)
>> at jess.Jesp.a(Unknown Source)
>> at jess.Jesp.if(Unknown Source)
>> at jess.Jesp.parseDefrule(Unknown Source)
>> at jess.Jesp.parseExpression(Unknown Source)
>> at jess.Jesp.promptAndParseOneExpression(Unknown Source)
>> at jess.Jesp.parse(Unknown Source)
>> at jess.Batch.batch(Unknown Source)
>> at jess.Batch.batch(Unknown Source)
>> at jess.Batch.batch(Unknown Source)
>> at jess.Batch.batch(Unknown Source)
>> at jess.Rete.batch(Unknown Source)
>> at
>> org.morphster.sql2sw.rules.OntologyEngine.<init>(OntologyEngine.java:34)
>> at
>> org.morphster.sql2sw.rules.OntologyEngine.main(OntologyEngine.java:43)
>>
>>
>>
>> Juan Sequeda, Ph.D Student
>> Dept. of Computer Sciences
>> The University of Texas at Austin
>> www.juansequeda.com
>> www.semanticwebaustin.org
>>
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Informatics & Decision Sciences Phone: (925) 294-2154
> Sandia National Labs
> PO Box 969, MS 9012 [email protected]
> Livermore, CA 94550 http://www.jessrules.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].
> --------------------------------------------------------------------
>
>