-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule grammar incomplete #16
Comments
Thomas is keen on having it (it was added just recently to ADL2). When you have a hammer everything looks like a nail, however I'm not sure we are ready for one-size-fits-all sort of model driven functional language. There probably must be a reason why we use R, rule lang, Java, SQL, ... If we go that way we'll need to elaborate;
And above all -> how to get support from development community I think it would be probably better to think of something like "handles". |
There are certainly existing candidates for plugging in in some way, e.g. Xpath / Xquery is a surprisingly good predicate logic language; Javascript is pretty good as well. R is also clean although I have no experience with it. However, you can't literally plug them in because they can't reference archetype paths. Various strategies seem possible if we want to write executable rules. Strategy A Strategy B There are probably other variants. If we assume that the rules that will be written in archetypes and templates are relatively simple, i.e. really complex stuff will probably be in separate guidelines, then one of the above strategies is probably doable without much problem. |
Sorry, I am very busy with all kind of things, and have no time to follow If this is convenient, please, someone coordinates this, and tell me what Best regards
|
Do I understand correctly that the rules grammar is part of ADL, but people generally use something else? I asked about the rules grammar because I would like to do things the standard way if there is one. Also because I want to develop something that evaluates some kind of rules and release it. I could easily use the rules grammar with a few predefined mechanisms, like:
(you could of course implement more sophisticated calculations, but these are relatively simple to do and solve many use cases) Easy enough to do even with limited development time. Regarding the strategies, one could easily do a strategy C: composition.getValue(path);
composition.setValue(path, value);
composition.reportError(error); //could be a code in the terminology to translate
composition.show(path);
composition.hide(path); // or some other term, or setExistence, or ...
composition.query(...); And you could do many things. Add a require-function and you could use external libraries. That is rather easy to implement with of the shelf javascript tools - it's hard to find a development environment where you cannot in some way evaluate ecmascript/javascript. So, what to do? :) |
There are examples of archetypes containing rules that are parsed here. So far I have not gone further on defining named variables. The discussion points that Borut raises are relevant here - how is the computing to be done? How much of this language do we (re)invent? Recreating a language isn't that hard, as long as the scope language is limited and we know what job we are trying to achieve. The original intention with the rules part of an archetype was to allow the expression of constraints that cannot be expressed 'inline', typically constraints that range over disparate paths in the tree. See the above examples to get an idea. The original idea was not to compute guidelines, but rather to state validity conditions on the data. Now, if there is a mathematical relationship that has to hold for the data to be correct, e.g. the individual Apgar scores have to add up to the total, then the constraint statement has the same form as a statement designed to compute the result. If such a statement is understood as a constraint then the '=' symbol means 'is equal to'. If it is meant to be a computation then the '=' would be intepreted as an assignment, i.e. 'becomes' in the usual sense of a programming language. Some people have said, ok, that means we need to support 'functions' i.e. formulae that do assign values to a field based on other fields; if we do that then we would limit the 'rules' to be purely assertions of whether some optional field exists depending on a value of another field etc. This is the main source of confusion about the rules section in my view. I think the community still has not arrived at a consensus on these issues. I might post some of this on a wiki page and mention it on the discussion groups. |
Currently I'm implementing rules parsing. So far i've implemented what is in the grammar. Then I noticed the rules grammar is incomplete. At least missing is:
Also I cannot find an existing testset for the rules, and no open source rule parsing library. They look very useful for several things (score calculation, conditional questions, custom validations, etc...) and we certainly want to support them, including variables and queries. But the lack of open source libraries supporting this, and the lack of use in the CKM makes me wonder - is this actually being used?
The text was updated successfully, but these errors were encountered: