[rules-users] Inserting Facts from Json Format
Mark Proctor
mproctor at codehaus.org
Mon Dec 12 00:57:33 EST 2011
See BatchExecutionHelper:
http://docs.jboss.org/drools/release/5.3.0.Final/droolsjbpm-integration-docs/html_single/index.html#d0e830
public class BatchExecutionHelper {
public static XStream newJSonMarshaller() {
Use out camel integration to work with JSON, as it hides a lot of the
complexity. Also make sure you understand the "command" stuff, which is
in the integration docs too.
http://docs.jboss.org/drools/release/5.3.0.Final/droolsjbpm-integration-docs/html_single/index.html
Mark
On 08/12/2011 17:07, ihabo01 wrote:
> Hello to all,
>
> I have the following simple rule:
>
> declare FlatData
> param1 : String
> param2 : String
> end
>
> rule "Test"
> when
> a:FlatData(param1=="something")
> then
> a.setParam2("hi");
> end
>
>
>
> And I have the following code to load the rule:
>
> KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
> kBuilder.add(ResourceFactory.newFileResource("myRule.drl"),ResourceType.DRL);
> KnowledgeBaseConfiguration kBaseConfig = KnowledgeBaseFactory
> .newKnowledgeBaseConfiguration();
> KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase(kBaseConfig);
> kBase.addKnowledgePackages(kBuilder.getKnowledgePackages());
> StatefulKnowledgeSession session = kBase.newStatefulKnowledgeSession();
> session.fireAllRules();
>
> And I have also the following object (in Json) that I would like to insert
> as a fact just before firing the rules:
> {"object":{" FlatData ":{"param1":"value1","param2":”value2”}}}}
>
> How can I achieve that?
>
> Many thanks in advance for your help
>
> Ihab
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Inserting-Facts-from-Json-Format-tp3570810p3570810.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
More information about the rules-users
mailing list