[rules-users] Composition of Fact Templates

Mark Proctor mproctor at codehaus.org
Mon Aug 11 21:34:14 EDT 2008


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?
It is preferably not to use nested classes, but instead create 
relationships for declarative relational programming. See this blog for 
more detials:
http://blog.athico.com/2007/06/declarative-relational-programming.html
>         2. Is it possible to even have a rule like:
>            p: Person( age == 5, Address(line1 == "My address))
>            ? (given a java object schema)
nested patterns are not allowed and not planned, if you are using pojos 
with nested values there is limitied support for nested accessors that 
don't require parameters, and you can use evals with MVEL dialect if you 
need to called method with params.
>         3. Should I be using variables and other rules to assert facts?
depends on the problem you are trying to solve.
>         4. Off topic: Is rules composition achieved by the assertion of
>            facts for other rules to use?
That is possible, yes. That's what inference is about, one rule can 
assert a fact that another rule can depend on.
>
> 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.
Drools 5.0 comes with dataloaders, which can dataload into our internal 
type declarations. 5.0 will include dataloaders for smooks, jaxb and 
xstream.
>
> Thanks heaps
>
> Stephen
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




More information about the rules-users mailing list