A
A
Alexander Asoskov2016-03-03 15:09:22
PHP
Alexander Asoskov, 2016-03-03 15:09:22

Are there any libraries or tools for creating/modifying/processing complex business rules in php or java?

In a working project, you need to implement complex business logic based on logical rules (or, and, like, in .... etc.)
You need to create a rule in the user interface, that is, they are dynamic. Then a certain array of data needs to be run through each rule. And perform the action corresponding to this rule in case of a positive result.
Are there any tools or examples of how to implement such a task in php/java?
Example there is an array:
name=Alexander,
surname=Ivanov
age=23
from=Tver,
cars=honda, vaz
there is a set of rules:
Rule 1 : name=Alexander AND age<=20 if the rule is passed "send to the client"
Rule 2 : name= Vasya OR cars in('vaz') if the rule is passed "
rule 3 : (age=23 AND from=Moscow) OR name=Kolya if the rule is passed, edit the array and save
...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2016-03-03
@zolt85

Implemented such a thing using ANTLR . It was ANTLR that was used to describe the grammar. It also generates parsers / lexers for this grammar (in the target language, we used Java as such).
Then you will need to implement your visitor for the AST tree (which will be built on the basis of the grammar you described), which will actually give you true or false of the entire expression.
It is not difficult to describe the grammar (there are examples of various grammars on the Internet), it is also easy to implement visitor.

A
aol-nnov, 2016-03-03
@aol-nnov

> processing complex business rules
google://bpm engine

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question