Java 有没有好的术语重写库?

发布于 2024-11-04 03:47:01 字数 277 浏览 0 评论 0原文

我正在开发一个Java应用程序,它对语言的基本术语进行一些推理,简单地实现为复合体(它们都是内部生成的,而不是从文本解析的)。现在我需要对术语语言应用一组重写规则,这个问题手动完成变得非常烦人。经过一些研究,我发现 Tom 以及可能的 Stratego/XT 可能是为 Java 添加术语重写功能的替代方案。有没有人对它们有一些经验来建议我两者的优点和缺点?有谁知道有什么替代方案吗?考虑到软件的规模,重写作为 POJO 数据结构实现的术语的能力是必要的(我接近截止日期,我不想用另一个术语表示替换当前的术语表示,尽管我将来可能会这样做)。

I am working on a Java application which does some reasoning on basic terms of a language, trivially implemented as Composites (they are all internally generated, not parsed from text). Now I am in the need of applying a set of rewrite rules to the term language, an issue which is becoming really annoying to do by hand. After some research I found that Tom and possibly Stratego/XT may be alternatives to add term rewriting abilities to Java. Does anyone have some experience on them to suggest me which are the advantages and disadvantages of both? Does anyone know about any alternative? Given the size of the software the ability to rewrite terms implemented as POJO data structures is a requisite (I am close to a deadline and I do not want to replace the current term representation with another one, although I likely will in the future).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

内心旳酸楚 2024-11-11 03:47:01

还存在术语软件: http://redmine.gradsoft.ua/projects/show/termware

不确定,这正是你想要的,但它可以处理规​​则中的任何java对象,即

domain(examples,
  system(Invoicing,default,
         ruleset(
           # import general operations.
           import(general),

           # handle new invoice and set one to paid if possible.
           @class("ua.gradsoft.termwaredemos.invoicing.Invoice", $invoice)
                        [ ! $invoice.isPayed()
                           &&
                            $invoice.getCustomer().getAccountBalance() - $invoice.getAmount() + $invoice.getCustomer().getCreditLimit() > 0
                        ]
                          -> true
                             [ $invoice.getCustomer().decrementAccount($invoice.getAmount())
                               &&
                               $invoice.setPayed(true) ],

           # set credit limit in depend from summary payments.
           @class("ua.gradsoft.termwaredemos.invoicing.Customer", $customer)
                        [ $customer.getAccountBalance() > 0 && $customer.getSummaryPayments() > 2000 ] -> true [ $customer.setCreditLimit(500) ]

         ),
         FirstTop)
);

你也可以=看看jess方面。
http://www.jessrules.com/

Also exists termware: http://redmine.gradsoft.ua/projects/show/termware

Does not sure, that this is exactly what you want, but it can handle any java object in rule, i.e.

domain(examples,
  system(Invoicing,default,
         ruleset(
           # import general operations.
           import(general),

           # handle new invoice and set one to paid if possible.
           @class("ua.gradsoft.termwaredemos.invoicing.Invoice", $invoice)
                        [ ! $invoice.isPayed()
                           &&
                            $invoice.getCustomer().getAccountBalance() - $invoice.getAmount() + $invoice.getCustomer().getCreditLimit() > 0
                        ]
                          -> true
                             [ $invoice.getCustomer().decrementAccount($invoice.getAmount())
                               &&
                               $invoice.setPayed(true) ],

           # set credit limit in depend from summary payments.
           @class("ua.gradsoft.termwaredemos.invoicing.Customer", $customer)
                        [ $customer.getAccountBalance() > 0 && $customer.getSummaryPayments() > 2000 ] -> true [ $customer.setCreditLimit(500) ]

         ),
         FirstTop)
);

Also you can =look at jess side.
http://www.jessrules.com/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文