[rules-users] Ws-Policy and drools rules

Wolfgang Laun wolfgang.laun at gmail.com
Mon May 7 13:12:54 EDT 2012


See inline.

On 7 May 2012 18:30, FILIPPO AGAZZI <filippo.agazzi at studenti.unipr.it>wrote:

> Hi Davide,
> thank you very much for your suggestions. I'm very pleased to see that you
> find interesting this topic..i have to think about the possibility to come
> there to discuss about this, cause i'm really really busy between thesis
> and job. But i'm interested and i'll think about it, and i'll write you a
> mail about this in the next days. I'm sorry to disturb you again, but i
> need to ask you some technical details, because i need to go on with my
> thesis work...
>
> You suggest use of rule template, i read about this, but my doubt are:
>
> - i find examples (http://planet.jboss.org/post/drools_rule_templates),
> where data is taken from a spreadsheet and then used to generate rules,
> from the rule template. I see that particular instructions are used, such
> as *@{row.rowNumber},* that i think can be used only with data stored in
> a row-column format. So this example can't help me about data from xml. But
> i read that rule template can be used with generals data format, but i
> can't find anything from which i can start about xml data...can you help me
> in some way? Any example or web resourse?
>

A rule template is just a boilerplate (or macro) with a set of formal macro
parameters. The instantiation process may be driven by rows of a
spreadsheet (one instantiation per row) or by a collection of Java objects
(one instantiation per object), or from a Map. So, if you deserialize your
XML into a set of Java objects of some class, you may create one rule from
each object, inserting the object's attribute values as actual macro
parameters. Note that these parameters can represent anything: a simple
literal, or an expression or something more complex: it's just text.


> - i'm confusing about the translator: if i use rule template, i need a
> tranlsator too? Or is it an alternative? I think that is an alternative,
> because if i translate xml with an xsl stylesheet, i can otbtain directly
> the rules, without using rule template..is it correct, or i need translator
> also if i use rule template, and generate rules from xml data?
>

First, you expand a template file, which results in in a string, and then
you compile this DRL text.

See the section on "Templates", i.e., 6.2 in the Expert manual for version
5.3.0. I admit that I wrote that, so if you find anything amiss, please let
me know so I can correct it.

-W


>
> Thanks in advance,
> Filippo
>
>
> 2012/5/4 Davide Sottara <dsotty at gmail.com>
>
>> Dear Filippo,
>> I would use rule templates to generate rules from the XML, and then use
>> them
>> to create a new session, or add them to an existing session. The
>> translator
>> itself could be implemented in DRL? XSLT? ...?
>> Inserting a Policy would hardly work generally, Drools does not (yet) have
>> full prolog-like unification, so that solution would be feasible only if
>> you
>> could write meta-rules to join Policies and runtime data/facts.
>> Leaving the technical details apart, the mapping between WS-Policy and
>> rules
>> is an interesting topic... would you be interested in coming to Bologna
>> and
>> spend a few hours discussing the problem in greater detail?
>> Davide
>>
>> ----------------
>> Davide Sottara, PhD
>> Post-Doc Affiliate
>> Faculty of Engineering
>> University of Bologna
>> Italy
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/rules-users-Ws-Policy-and-drools-rules-tp3959245p3960925.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120507/edc8cabc/attachment.html 


More information about the rules-users mailing list