In other words, in 5.0 you can do:

declare Address
   line1 : String
   line2 : String
end

declare Person
  name : String
  age : int
  address : Address
end

   There are additional notation and features you are able to use when working with type declarations, but the above is what you asked for.

   []s
   Edson


2008/8/11 Mark Proctor <mproctor@codehaus.org>
FactTemplates are an experimental feature and only supports primitives and strings as fields. It was based around using arrays for the models, this made the implementation easy but tooling and integration with other libraries being very hard. For 5.0 we using "type declarations" which basically are generated pojos, which causes a nightmare for custom classloader stuff, but is much more tooling and 3rd party library integration friendly. These type declarations support primitives and classes for their fields.

Mark

Stephen Kestle wrote:
I'm trying to make some fact templates in the form of

template "Address"
  String line1
  String line2
end

template "Person"
  String name
  int age
  Address address
end

It complains that it is "Unable to resolve class "Address""

 1. Is there any way around this - am I just getting syntax wrong?
 2. Is this being fixed in 5.0 or > 4.0.7 (which I have)
 3. Am I able to modify the class loader to grab the FactTemplate
    class types and infer the correct object? e.g. is this something
    that's ridiculously hard, and so hasn't already been included?
 4. Am I going about this entirely the wrong way?
       1. Are nested types at all useful in the rules?
       2. Is it possible to even have a rule like:
          p: Person( age == 5, Address(line1 == "My address))
          ? (given a java object schema)
       3. Should I be using variables and other rules to assert facts?
       4. Off topic: Is rules composition achieved by the assertion of
          facts for other rules to use?

What I want to do:
I am dealing with (xml) schemas and ontologies, and need to be able to create Fact Templates from these definitions.  While I can do this easily enough in java side, I believe I need to create the templates to match my java objects so that the rules can be compiled.

Thanks heaps

Stephen
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.com