rules

Is it possible to set priorities for rules to avoid the “longest-earliest” matching pattern?

有些话、适合烂在心里 提交于 2019-12-03 10:30:27
Another simple question : is there any way to tell flex to prefer a rule that matches a short thing over a rule that matches a longer thing ? I can't find any good documentation about that. Here is why I need that : I parse a file for a pseudo language that contains some keywords corresponding to control instructions. I'd like them to be the absolute priority so that they're not parsed as parts of an expression. I actually need this priority thing because I don't have to write a full grammar for my project (that would be totally overkill in my case since I perform structural analysis on the

Python Rule Based Engine [closed]

ぐ巨炮叔叔 提交于 2019-12-03 10:00:47
Closed . This question needs to be more focused. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it focuses on one problem only by editing this post . I am looking to design a system that will essentially need to make decisions based on input. The input will be a person. class Person: def __init__(self, name, age, sex, weight, height, nationality): self.name = name self.age = age self.sex = sex self.weight = weight self.height = height self.nationality = nationality We want to assign each person to a school class based on certain rules.

Should a business rule violation throw an exception?

荒凉一梦 提交于 2019-12-03 09:06:28
问题 Should a business rule violation throw an exception? 回答1: No. It's part of normal conditional-handling logic in the program (and often just a disguised form of user error). 回答2: It depends on what the business rule is, IMO. I would venture to say "not usually" but I'd view it on a case-by-case basis. I don't think there is any one answer, as different business rules might warrant it while others might not. 回答3: First, a couple of quotes from chapter 18 of Applied Microsoft .NET Framework

Should I use Drools in this situation?

北城余情 提交于 2019-12-03 06:35:26
I'll use a university's library system to explain my use case. Students register in the library system and provide their profile: gender, age, department, previously completed courses, currently registered courses, books already borrowed, etc. Each book in the library system will define some borrowing rules based on students' profile, for example, a textbook for the computer algorithm can only be borrowed by students currently registered with that class; another textbook may only be borrowed by students in the math department; there could also be rules such that students can only borrow 2

Drools - rule hierarchy and conditional execution

女生的网名这么多〃 提交于 2019-12-03 03:51:29
I was wondering if there is a way to define hierarchy (not just order of execution) between rules and control the rule execution - i.e. if the parent rule fired then the ones below should not be evaluated etc... Information in this thread is an option but it is essentially IF/THEN/ELSE Is there a different option? thanks I am not sure if I understand your question, but using a combination of Activation Groups and the traditional conflict resolution strategies might achieve what you need. For instance, lets say you have 3 rules, A, B and C. You want to use, lets say, salience to give priority

I am compiling a rules of programming mindset for my team: What are yours? [closed]

本小妞迷上赌 提交于 2019-12-03 01:32:29
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 months ago . Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. I have been working on a list for a while that helps me share the why of programming approach and

I need a simple rules engine, I think? [closed]

五迷三道 提交于 2019-12-03 01:22:06
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I need some advice on the best approach to solving this problem. I've researched DROOLS, Java Rule Engine and a few others. All of

Should a business rule violation throw an exception?

老子叫甜甜 提交于 2019-12-03 00:37:28
Should a business rule violation throw an exception? No. It's part of normal conditional-handling logic in the program (and often just a disguised form of user error). It depends on what the business rule is, IMO. I would venture to say "not usually" but I'd view it on a case-by-case basis. I don't think there is any one answer, as different business rules might warrant it while others might not. First, a couple of quotes from chapter 18 of Applied Microsoft .NET Framework Programming (page 402) by Jeffrey Richter : "Another common misconception is that an 'exception' identifies an 'error'."

elementui的表格嵌套表单及校验demo

匿名 (未验证) 提交于 2019-12-02 23:55:01
你在使用vue+elementUI技术栈的时候,有没有碰到表格嵌套表单需求以及需要前台的一个校验? 这里为大家写了一个demo: 1 <template> 2 <div> 3 < el - form : model = "forms" ref = "forms" : rules = "rules" > 4 < el - table : data = "forms.voList" > 5 < el - table - column 6 label = "商品名称" > 7 < template slot - scope = "scope" > 8 < el - form - item : prop = "'voList.'+scope.$index+'.goodsName'" > 9 < el - input v - model = "scope.row.goodsName" ></ el - input > 10 </ el - form - item > 11 </ template > 12 </ el - table - column > 13 < el - table - column 14 label = "商品编码" > 15 < template slot - scope = "scope" > 16 < el - form - item : prop = "

Drools: storing rules in database

怎甘沉沦 提交于 2019-12-02 17:17:50
Currently I store all rules files on the file system (there are lots of versions of them) and load the different versions of them into memory at startup. I would like to change to storing my drools files in a database and was wondering if there is any solution or addon to Drools which facilitates this or should I craft my own? Thanks. Yes, it can be done. All you need is the ability to get InputStream .In my case I use my own JPA class RulePackage to persist rule source as byte[], but you could use direct JDBC connection to access BLOB/CLOB fields in your DB schema. Important thing is to save