dalecosp Posted April 29, 2014 Share Posted April 29, 2014 (edited) I'm wanting to do is some lightly dynamic rules processing; an engine receives a widget, examines the widget properties, scans its own ruleset and changes widget properties according to the logic in the rule statement. Does this sound like an inference engine? Does anyone have experience with, suggested reading, or other tidbits to share about such things in PHP? Edited April 29, 2014 by dalecosp Quote Link to comment https://forums.phpfreaks.com/topic/288124-inference-engine-rules-processing/ Share on other sites More sharing options...
requinix Posted April 29, 2014 Share Posted April 29, 2014 I'm wanting to do is some lightly dynamic rules processing; an engine receives a widget, examines the widget properties, scans its own ruleset and changes widget properties according to the logic in the rule statement. Does this sound like an inference engine?Not really. An inference engine builds upon existing information. If this thing was supposed to take the ruleset and learn more rules over time then that would qualify. Otherwise... I suppose maybe an expert system? In a slightly more than typical sense of the term. Does anyone have experience with, suggested reading, or other tidbits to share about such things in PHP?What is "such things"? Your rules processing or inference systems? Quote Link to comment https://forums.phpfreaks.com/topic/288124-inference-engine-rules-processing/#findComment-1477662 Share on other sites More sharing options...
dalecosp Posted April 30, 2014 Author Share Posted April 30, 2014 Thank you very much for your reply. What is "such things"? Your rules processing or inference systems? I suppose you have me. I don't *know* that this system would have to learn on its own (other parts of the system that are currently in existence I tend to view that way, though).Essentially what I have is this: The system is in production and mostly automated, but the "Verify" stage combines human intervention and automation. Obviously we'd like to decrease the amount of human intervention required. What is desired is for the humans to be able to put "rules" into the system without knowledge of code, and have the system process the data flow using said rules without further human interaction. So, the system would have to store these rules (DB, no issues there), but I'm not too sure about the overall design and implementation of this idea. What would you call this? I'm not sure what to study ;-) Quote Link to comment https://forums.phpfreaks.com/topic/288124-inference-engine-rules-processing/#findComment-1477705 Share on other sites More sharing options...
ignace Posted April 30, 2014 Share Posted April 30, 2014 (edited) Can you give an example of said rules? And how will these rules be defined? Can a programmer intervene to program said rules and does the end-user merely be able to 'chain' these rules? If this is true then the answer is the Specification Pattern: http://en.wikipedia.org/wiki/Specification_pattern Or something like: http://symfony.com/doc/current/components/expression_language/syntax.html Edited April 30, 2014 by ignace Quote Link to comment https://forums.phpfreaks.com/topic/288124-inference-engine-rules-processing/#findComment-1477723 Share on other sites More sharing options...
dalecosp Posted April 30, 2014 Author Share Posted April 30, 2014 (edited) Thank you, Ignace. I want the rules to be introduced into the system via the UI. An example rule might be: IF product_make = "Ford" and seller_id = 12345 THEN MODIFY product_category TO 'Truck' OR IF product_make = "Google" and product_model = "Glass" THEN UNSET product_color I'm getting a handle on what I *think* I need to do; I'm just not sure if I'm doing it The Best Way. The reading I've done this morning has been helpful, at least, in terms of inspiration, if not actually learning anything (didn't sleep *too* well last evening, alas).... Edited April 30, 2014 by dalecosp Quote Link to comment https://forums.phpfreaks.com/topic/288124-inference-engine-rules-processing/#findComment-1477726 Share on other sites More sharing options...
ignace Posted April 30, 2014 Share Posted April 30, 2014 (edited) Well you could achieve that using the ExpressionLanguage component and short-circuit logic: (product.makeEquals('Ford') and seller.idEquals(12345)) and product.changeCategory('Truck')Or using ternary operators: (product.makeEquals('Google') and product.modelEquals('Glass')) ? product.removeColor()But this assumes your use-case won't get complexer than this and someone with some programming background is around to write these rules. Not to mention that if there is someone with a programming background around he could aswell simply write it in PHP. You don't want your business logic in your database. Edited April 30, 2014 by ignace Quote Link to comment https://forums.phpfreaks.com/topic/288124-inference-engine-rules-processing/#findComment-1477730 Share on other sites More sharing options...
dalecosp Posted April 30, 2014 Author Share Posted April 30, 2014 Oh, but I do, because I've no idea how many rules the operators will want to add (so I guess "complexer" than this is something of a given). The point is that I'm writing generic PHP to handle as many rules as they want to create. Since the system will have to remember these rules, a DB seems better than a text file, no? I'm making some progress. I'll update you if I discover anything remarkable. Thanks again for your help! Quote Link to comment https://forums.phpfreaks.com/topic/288124-inference-engine-rules-processing/#findComment-1477734 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.