-
Notifications
You must be signed in to change notification settings - Fork 66
Interpreted rule should be available in JSON format #1
Comments
Hi, i don't understand why json would be better than a raw text, you could insert it in a encode/decode json of a php code (Hoa\Ruler::interprete) return a php code is really difficult ... I'm not sure to see the benefits to implement this feature. |
Hi stephpy, The benefit would be interoperation with nosql querying language, in querying rules and rule sets. See Rule Language here: https://code.google.com/p/jsonrules/wiki/RuleLanguage If we had a JSON rule we could query through db something like - ( psuedocode ) db.rules.find( {"conditions": { "and" OR "or" } , "action": changeBackground " }}); You can do this kind of querying with with the raw text command, but it becomes much more powerful to offload this advanced querying to the db. In my mind its better to always store a structured language , than raw english language |
Hello :-), So you want only a serializer, not a unserializer? And you want to respect the Json Rules specification? |
Serializer would be nice, it could just use the current rule formatting, the Rule Language was just an example, I don't think it is a widely adopted format. An unserializer isn't necessary right away. I can store the actual raw command as stephpy suggested to execute the rule. I could also build an unserializer, if someone gets me started on the serializer, but i'm not quite familiar with the framework yet. Thanks |
I have a question. The goal here is not to serialize or unserialize the rule model but only to compile the model into JSON, in order to use it in some database engine. Ok. But how will you execute the rule in the database engine? Does the JSON rules format is supported by such engines? You have mentionned the JSON rules format as an example. Are there others? |
@bthibault ping? |
Hi there, So let me walk you through my work flow.
So maybe that helps clarify, I just need a consistent way to build , store, query rules. Really the missing piece is translating Hoa rules to a formatted, structured definition I can use and store (JSON (or XML)) Does that help clarify the issue? |
If the goal is to translate rules into JSON, then the only thing one has to do is to create a new visitor, such as Next questions are:
Cheers :-). |
Either way. I'm going forward with Hoa/Ruler, Nools, or JBoss Drools. If I use Hoa/Ruler I will write a Visitor for JSON Thanks |
@bthibault It is part of Hoa to promote and propose a strong implementation of standards, but it seems like even one standard does not exists actually. This is a problem :-). Do you have a study about the usage of such serializations? Aside to that, it is easy to write an Hoathis that extends |
http://ruleml.org/ here is a standard Rule definition. Thanks |
I'm agree with you @Hywan, Rules could be stored in different formats. |
Can we close this issue? |
serialize(
Hoa\Ruler::interprete(
'logged(user) and group in ("customer", "guest") and points > 30'
)
This might be good for storing in a relational db, but for those of us using NoSql db like Mongo, It would be nice to get a JSON encoded rule model ...
The text was updated successfully, but these errors were encountered: