I'm working on an application in Java, that needs to do some complex logic rule deductions as part of its functionality. I'd like to code my logic deductions in Prolog or some other logic/constraint programming language, instead of Java, as I believe the resulting code will be significantly simpler and more maintainable.
我正在开发一个Java应用程序,它需要做一些复杂的逻辑规则推导作为其功能的一部分。我想在Prolog或其他一些逻辑/约束编程语言中编写我的逻辑演绎,而不是Java,因为我相信生成的代码将更加简单和易于维护。
I googled for embedded Java implementations on Prolog, and found number of them, each with very little documentation. My (modest) selection criteria are:
我在Prolog上搜索了嵌入式Java实现,并发现了它们的数量,每个都只有很少的文档。我的(适度)选择标准是:
- should be embeddable in Java (e.g. can be bundled up with my java package instead of requiring any native installations on external programs)
- 应该可以嵌入Java(例如,可以与我的java包捆绑在一起,而不需要在外部程序上进行任何本机安装)
- simple interface to use from Java (for initiating deductions, inspecting results, and adding rules)
- 从Java使用的简单接口(用于启动扣减,检查结果和添加规则)
- come with at least a few examples on how to use it
- 至少有一些关于如何使用它的例子
- doesn't necessarily have to be Prolog, but other logic/constraint programming languages with the above criteria would suit my needs, too.
- 不一定必须是Prolog,但具有上述标准的其他逻辑/约束编程语言也适合我的需要。
What choices do I have and what are their advantages and disadvantages?
我有什么选择?它们的优点和缺点是什么?
13 个解决方案
#1
22
According to Wikipedia, the following versions of Prolog have Java interfaces. I've linked to the main pages for them:
根据Wikipedia,以下版本的Prolog具有Java接口。我已经链接到他们的主页:
- BProlog
- BProlog
- Ciao Prolog
- Ciao Prolog
- SICStus Prolog
- SICStus Prolog
- SWI Prolog
- SWI Prolog
- TuProlog (implemented in Java)
- TuProlog(用Java实现)
- LPA Prolog
- LPA Prolog
Good luck with your search!
祝你的搜索顺利!
#2
8
SWI prolog A very popular implementation seems to have a Java interface as does SiCStus which would be easier than using JNI to instantiate an instance in your Java Process. I've used both from C quite a while ago and do recommend them. My prefference would be SWI as it is open-source and from my experience the de facto implementation.
SWI prolog一个非常流行的实现似乎有一个Java接口和SiCStus一样,这比使用JNI在Java进程中实例化一个实例要容易。我很久以前就使用过C和推荐它们。我的首选是SWI,因为它是开源的,根据我的经验,事实上的实现。
The documentation for SWI's Java interface seems to be adequate, and the embedding process quite straight forward.
SWI Java接口的文档似乎已经足够,嵌入过程非常直接。
#3
6
I've needed to do the same 2 years ago. I used SWI interface which is called JPL. It lets you load a Prolog file, assert on it and query on it. It does required an installation of SWI Prolog but that's not problem at all. SWI Prolog is available for many platforms.
我需要在2年前做同样的事情。我使用了名为JPL的SWI接口。它允许您加载Prolog文件,在其上断言并查询它。它确实需要安装SWI Prolog,但这根本不是问题。 SWI Prolog适用于许多平台。
I've also tried alternatives that were 100% implemented in Java and didn't required external programs. All them were buggy or hard to use. Don't waste your time.
我也尝试过用Java实现100%并且不需要外部程序的替代方案。所有这些都是马车或难以使用。不要浪费你的时间。
#4
4
Amzi prolog has been around for a while. I have used it briefly but not the embedded version. however they do have good documentation and support can be bought. They have Java port so it might be worth a look.
Amzi prolog已经存在了一段时间。我简单地使用了它,但没有使用嵌入式版本。但他们确实有很好的文档和支持可以买。他们有Java端口,所以值得一看。
#5
3
LPA does offer the LPA Intelligence Server as a way of embedding its Prolog engine within a whole variety of mainstream languages including Java, .Net etc
LPA确实提供LPA Intelligence Server作为将Prolog引擎嵌入各种主流语言(包括Java,.Net等)的方式
Clive
克莱夫
http://www.lpa.co.uk/int.htm
#6
3
Two commercial Prologs written in Java: Minerva by IF Computer Japan and Jekejeke. Both are very close to ISO.
用Java编写的两本商业Prolog:IF Computer Japan和Jekejeke的Minerva。两者都非常接近ISO。
#7
3
Clojure is a JVM based Lisp-like language with a library (core.logic) supporting logic and constraint based programming. Clojure also has a large number of facilities for generating java classes and working with java code, so inter-op between the two languages is trivial.
Clojure是一种基于JVM的类似Lisp的语言,其库(core.logic)支持基于逻辑和约束的编程。 Clojure还有大量用于生成java类和使用java代码的工具,因此两种语言之间的交互操作是微不足道的。
#8
3
You can also take a look at the Prol engine that I created. It allows you to embed Prolog into your Java programs (but it is not very fast one)
您还可以查看我创建的Prol引擎。它允许您将Prolog嵌入到Java程序中(但它不是很快)
#9
2
Prova 3.0 http://www.prova.ws is nearing completion. It is, however, not just another Prolog but a mix of programming styles, particularly, useful for easy bi-directional Java integration, reactive agent programming, integration with ESB's, workflow logic, and event processing. This version is a complete rewrite from zero so some older features, like OWL integration, are missing, but are bound to return in the next revision.
Prova 3.0 http://www.prova.ws即将完成。然而,它不仅仅是另一种Prolog,而是混合编程风格,特别适用于简单的双向Java集成,反应式代理编程,与ESB的集成,工作流逻辑和事件处理。这个版本是从零完全重写的,因此缺少一些较旧的功能,如OWL集成,但必须在下一版本中返回。
#10
2
There's Mini-Kanren for Scala, which gives you a native JVM implementation of a lean, hackable, modern Horn-clause based logic programming language.
有Scala的Mini-Kanren,它为您提供了一个基于Jorn子句的精简,可黑客,现代的逻辑编程语言的原生JVM实现。
#11
2
Another worthwhile option I recently came across is JSetL. It's not a Prolog, but a constraint programming library for Java, with support for logic variables, unification, constraint solving and non-determinism.
我最近遇到的另一个有价值的选择是JSetL。它不是Prolog,而是Java的约束编程库,支持逻辑变量,统一,约束求解和非确定性。
http://prmat.math.unipr.it/~gianfr/JSetL/index.html
http://prmat.math.unipr.it/~gianfr/JSetL/index.html
#12
2
There are a number of Prolog implementations in Java. They are not terribly fast, but convenient to use from within Java. Examples are: TuProlog or PrologCafe You can also have a look at the following Bachelor's thesis on the subject of Execution and Analysis of Prolog Programs in Java.
Java中有许多Prolog实现。它们不是非常快,但在Java中使用方便。例如:TuProlog或PrologCafe您还可以查看以下关于Java中Prolog程序的执行和分析主题的学士论文。
#13
2
Prof. Paul Tarau made available from his page several implementations
Paul Tarau教授从他的页面中提供了几个实现
Jinni Prolog
内核Prolog
#1
22
According to Wikipedia, the following versions of Prolog have Java interfaces. I've linked to the main pages for them:
根据Wikipedia,以下版本的Prolog具有Java接口。我已经链接到他们的主页:
- BProlog
- BProlog
- Ciao Prolog
- Ciao Prolog
- SICStus Prolog
- SICStus Prolog
- SWI Prolog
- SWI Prolog
- TuProlog (implemented in Java)
- TuProlog(用Java实现)
- LPA Prolog
- LPA Prolog
Good luck with your search!
祝你的搜索顺利!
#2
8
SWI prolog A very popular implementation seems to have a Java interface as does SiCStus which would be easier than using JNI to instantiate an instance in your Java Process. I've used both from C quite a while ago and do recommend them. My prefference would be SWI as it is open-source and from my experience the de facto implementation.
SWI prolog一个非常流行的实现似乎有一个Java接口和SiCStus一样,这比使用JNI在Java进程中实例化一个实例要容易。我很久以前就使用过C和推荐它们。我的首选是SWI,因为它是开源的,根据我的经验,事实上的实现。
The documentation for SWI's Java interface seems to be adequate, and the embedding process quite straight forward.
SWI Java接口的文档似乎已经足够,嵌入过程非常直接。
#3
6
I've needed to do the same 2 years ago. I used SWI interface which is called JPL. It lets you load a Prolog file, assert on it and query on it. It does required an installation of SWI Prolog but that's not problem at all. SWI Prolog is available for many platforms.
我需要在2年前做同样的事情。我使用了名为JPL的SWI接口。它允许您加载Prolog文件,在其上断言并查询它。它确实需要安装SWI Prolog,但这根本不是问题。 SWI Prolog适用于许多平台。
I've also tried alternatives that were 100% implemented in Java and didn't required external programs. All them were buggy or hard to use. Don't waste your time.
我也尝试过用Java实现100%并且不需要外部程序的替代方案。所有这些都是马车或难以使用。不要浪费你的时间。
#4
4
Amzi prolog has been around for a while. I have used it briefly but not the embedded version. however they do have good documentation and support can be bought. They have Java port so it might be worth a look.
Amzi prolog已经存在了一段时间。我简单地使用了它,但没有使用嵌入式版本。但他们确实有很好的文档和支持可以买。他们有Java端口,所以值得一看。
#5
3
LPA does offer the LPA Intelligence Server as a way of embedding its Prolog engine within a whole variety of mainstream languages including Java, .Net etc
LPA确实提供LPA Intelligence Server作为将Prolog引擎嵌入各种主流语言(包括Java,.Net等)的方式
Clive
克莱夫
http://www.lpa.co.uk/int.htm
#6
3
Two commercial Prologs written in Java: Minerva by IF Computer Japan and Jekejeke. Both are very close to ISO.
用Java编写的两本商业Prolog:IF Computer Japan和Jekejeke的Minerva。两者都非常接近ISO。
#7
3
Clojure is a JVM based Lisp-like language with a library (core.logic) supporting logic and constraint based programming. Clojure also has a large number of facilities for generating java classes and working with java code, so inter-op between the two languages is trivial.
Clojure是一种基于JVM的类似Lisp的语言,其库(core.logic)支持基于逻辑和约束的编程。 Clojure还有大量用于生成java类和使用java代码的工具,因此两种语言之间的交互操作是微不足道的。
#8
3
You can also take a look at the Prol engine that I created. It allows you to embed Prolog into your Java programs (but it is not very fast one)
您还可以查看我创建的Prol引擎。它允许您将Prolog嵌入到Java程序中(但它不是很快)
#9
2
Prova 3.0 http://www.prova.ws is nearing completion. It is, however, not just another Prolog but a mix of programming styles, particularly, useful for easy bi-directional Java integration, reactive agent programming, integration with ESB's, workflow logic, and event processing. This version is a complete rewrite from zero so some older features, like OWL integration, are missing, but are bound to return in the next revision.
Prova 3.0 http://www.prova.ws即将完成。然而,它不仅仅是另一种Prolog,而是混合编程风格,特别适用于简单的双向Java集成,反应式代理编程,与ESB的集成,工作流逻辑和事件处理。这个版本是从零完全重写的,因此缺少一些较旧的功能,如OWL集成,但必须在下一版本中返回。
#10
2
There's Mini-Kanren for Scala, which gives you a native JVM implementation of a lean, hackable, modern Horn-clause based logic programming language.
有Scala的Mini-Kanren,它为您提供了一个基于Jorn子句的精简,可黑客,现代的逻辑编程语言的原生JVM实现。
#11
2
Another worthwhile option I recently came across is JSetL. It's not a Prolog, but a constraint programming library for Java, with support for logic variables, unification, constraint solving and non-determinism.
我最近遇到的另一个有价值的选择是JSetL。它不是Prolog,而是Java的约束编程库,支持逻辑变量,统一,约束求解和非确定性。
http://prmat.math.unipr.it/~gianfr/JSetL/index.html
http://prmat.math.unipr.it/~gianfr/JSetL/index.html
#12
2
There are a number of Prolog implementations in Java. They are not terribly fast, but convenient to use from within Java. Examples are: TuProlog or PrologCafe You can also have a look at the following Bachelor's thesis on the subject of Execution and Analysis of Prolog Programs in Java.
Java中有许多Prolog实现。它们不是非常快,但在Java中使用方便。例如:TuProlog或PrologCafe您还可以查看以下关于Java中Prolog程序的执行和分析主题的学士论文。
#13
2
Prof. Paul Tarau made available from his page several implementations
Paul Tarau教授从他的页面中提供了几个实现
Jinni Prolog
内核Prolog