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-tp3570...
Sent from the Drools: User forum mailing list archive at
Nabble.com.