Nested JSON iterations using drools Fluent API

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 23:05:18

问题


For below JSON, later mention drl syntax should suffice (Although haven't tested running drl but correction would be welcome)

{
  "category": [
    {
      "nlp": [
        {
          "mainCategory": "General"
        }
      ],
      "crawler": 
        {
          "isNLP": true,
          "mainCategory": "General"
        }

    }
  ],

  "uniqueId": "5695d7dae4b047806242cfbc0"
}

Drl Rule for testing "category.nlp.mainCategory" as "General" below:

When 
$basePojo:  BasePojo($categoryList:category)
$catgory :  Category($nlpList: nlp) from $categoryList
$nlp     :  Nlp(mainCategory=="General") from   $nlpList

Then
System.out.println("Document verfied");

Question: How do I use drools fluent Java API to write the above drl for "category.nlp.mainCategory" iteration?

I saw some helpful discussion on StackOverflow discussing drools Java API to write drl rules as here

http://docs.jboss.org/drools/release/5.2.0.Final/droolsjbpm-introduction-docs/html/ch02.html#d0e124

which creates few straight constraints in above official documentation.

来源:https://stackoverflow.com/questions/46014752/nested-json-iterations-using-drools-fluent-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!