I believe I have it... "declare" is meant to be used for easy generation
of java classes, so that rules can instantiate objects and use them as
such. For dynamic data models, "template" is a better fit, as getField
etc are geared towards map-like data structures.
I believe that I could have :
template "Address"
String line1
String line2
end
template "Person"
String name
int age
Object address
end
rule "Test"
when
add: Address(line1 == "address")
person: Person(address == add)
then
...
Is this correct?
Cheers
Stephen Kestle wrote:
I'm creating a type hierarchy using TypeDeclarations based on an
ontological model (analagous to an xml schema for the purposes of this
post).
If I declare a drl file to have the following declarations
declare Address
line1 : String
line2 : String
end
declare Person
name : String
age : int
address : Address
end
it will create Java Pojo classes for me. However, I had it all
working using fact templates, except for the address item. Is it
possible to insert fact implementations based on templates, while
declaring TypeDeclarations in the drl? (I now go to look for how to
specify the format = TEMPLATE for the drl)
I say this because I'm looking up values using id strings - e.g. the
exact same way that FactTemplate based Facts does accessing. I don't
want to have to convert all my String ids to reflectively call the set
methods on the created Pojo.
Hopefully this is enough info for you 5.0 developers - I'm still
trying to wrap my head around it all.
Cheers
Stephen
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit
http://www.messagelabs.com/email
______________________________________________________________________
--
------------------------------------------------------------------------
* <
http://www.orionhealth.com>*
*Stephen Kestle Software Engineer*
stephen.kestle(a)orionhealth.com <mailto:stephen.kestle@orionhealth.com>
P: +64 9 638 0619
M: +64 27 453 7853
F: +64 9 638 0699
S: skestle <callto:skestle>
www.orionhealth.com <
http://www.orionhealth.com>
This e-mail and any attachments are intended only for the person to whom
it is addressed and may contain privileged, proprietary, or other data
protected from disclosure under applicable law. If you are not the
addressee or the person responsible for delivering this to the addressee
you are hereby notified that reading, copying or distributing this
transmission is prohibited. If you have received this e-mail in error,
please telephone us immediately and remove all copies of it from your
system. Thank you for your co-operation.