@tuprolog/2p-full 0.20.9-dev0g
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTORS +8 -0
- package/LICENSE +202 -0
- package/README.md +372 -0
- package/kotlin/2p-full/it/unibo/tuprolog/tuprolog.kjsm +0 -0
- package/kotlin/2p-full.js +15 -0
- package/kotlin/2p-full.js.map +1 -0
- package/kotlin/2p-full.meta.js +1 -0
- package/package.json +37 -0
package/CONTRIBUTORS
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Giovanni Ciatto (giovanni.ciatto@unibo.it, giovanni.ciatto@gmail.com)
|
|
2
|
+
Enrico Siboni (enrico.siboni3@studio.unibo.it)
|
|
3
|
+
Paolo Verdini (paolo.verdini@studio.unibo.it, paolopiano1997@gmail.com)
|
|
4
|
+
Manuel Bonarrigo (manuel.bonarrigo@studio.unibo.it)
|
|
5
|
+
Sofia Montebugnoli (sofia.montebugnoli2@studio.unibo.it)
|
|
6
|
+
Davide Greco (davide.greco4@studio.unibo.it)
|
|
7
|
+
Silvia Lanzoni (silvia.lanzoni5@studio.unibo.it)
|
|
8
|
+
Lorenzo Rizzato (lorenzo.rizzato@studio.unibo.it)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2020, Giovanni Ciatto and contributors listed in
|
|
190
|
+
the CONTRIBUTORS file.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
# 2P-Kt
|
|
2
|
+
|
|
3
|
+
### Some quick links:
|
|
4
|
+
|
|
5
|
+
* [Home Page](http://tuprolog.unibo.it)
|
|
6
|
+
* [GitHub Repository](https://github.com/tuProlog/2p-kt) (public repository)
|
|
7
|
+
* [GitLab Repository](https://gitlab.com/pika-lab/tuprolog/2p-in-kotlin) (dismissed)
|
|
8
|
+
* [NPM Repository](https://www.npmjs.com/org/tuprolog) (where JS releases are hosted)
|
|
9
|
+
* [Maven Central Repository](https://search.maven.org/search?q=g:it.unibo.tuprolog) (where all stable releases are hosted)
|
|
10
|
+
* [GitHub Maven Repository](https://github.com/orgs/tuProlog/packages?repo_name=2p-kt) (where all releases are hosted, there including dev releases)
|
|
11
|
+
* [Documentation](http://pika-lab.gitlab.io/tuprolog/2p-in-kotlin/) (work in progress)
|
|
12
|
+
* [Presentation](https://github.com/tuProlog/2p-kt-presentation/releases/latest) (currently describing the main API of 2P-Kt)
|
|
13
|
+
|
|
14
|
+
## Intro
|
|
15
|
+
|
|
16
|
+

|
|
17
|
+
|
|
18
|
+
[tuProlog](https://www.cs.nmsu.edu/ALP/2013/10/tuprolog-making-prolog-ubiquitous/) (2P henceforth) is a multi-paradigm
|
|
19
|
+
logic programming framework written in Java.
|
|
20
|
+
|
|
21
|
+
2P-Kt is a Kotlin-based and multi-platform reboot of 2P.
|
|
22
|
+
It consists of an open ecosystem for Symbolic Artificial Intelligence (AI).
|
|
23
|
+
For this reason, 2P-Kt consists of a number of incrementally inter-dependent modules aimed at supporting symbolic
|
|
24
|
+
manipulation and reasoning in an extensible and flexible way.
|
|
25
|
+
|
|
26
|
+
A complete overview about modules and their dependencies is provided by the following diagram:
|
|
27
|
+
|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
As shown in the project map, 2P-Kt currently focuses on supporting knowledge representation and automatic reasoning through logic programming,
|
|
31
|
+
by featuring:
|
|
32
|
+
|
|
33
|
+
* a module for logic terms and clauses representation, namely `core`,
|
|
34
|
+
|
|
35
|
+
* a module for logic unification representation, namely `unify`,
|
|
36
|
+
|
|
37
|
+
* a module for in-memory indexing and storing logic theories, as well as other sorts of collections of logic clauses, namely `theory`,
|
|
38
|
+
|
|
39
|
+
* a module providing generic API for resolution of logic queries, namely `solve`, coming with several implementations
|
|
40
|
+
(e.g. `solve-classic` and `solve-streams`, targetting Prolog ISO Standard compliant resolution),
|
|
41
|
+
|
|
42
|
+
* a module providing generic API for the probabilistic resolution of logic queries via _probabilistic logic programming_
|
|
43
|
+
(PLP), namely `solve-plp`, coming with an implementation targetting [ProbLog](https://dtai.cs.kuleuven.be/problog/)
|
|
44
|
+
(`solve-problog`)
|
|
45
|
+
- leveraging on module `:bdd`, which provides a multi-platform implementation of [binary decision diagrams](https://en.wikipedia.org/wiki/Binary_decision_diagram) (BDD)
|
|
46
|
+
|
|
47
|
+
* a module providing OR-concurrent resolution facilities, namely `solve-concurrent`,
|
|
48
|
+
|
|
49
|
+
* a number of modules (i.e., the many `dsl-*` modules) supporting a Prolog-like, Domain Specific Language (DSL)
|
|
50
|
+
aimed at bridging the logic programming with the Kotlin object-oriented \& functional environment,
|
|
51
|
+
- further details are provided in [this paper](http://ceur-ws.org/Vol-2706/paper14.pdf)
|
|
52
|
+
|
|
53
|
+
* two parsing modules: one aimed at parsing terms, namely `parser-core`, and the other aimed at parsing theories,
|
|
54
|
+
namely `parser-theory`,
|
|
55
|
+
|
|
56
|
+
* two serialisation-related modules: one aimed at (de)serialising terms and clauses, namely `serialize-core`, and the
|
|
57
|
+
other aimed at (de)serialising terms theories, namely `serialize-theory`,
|
|
58
|
+
|
|
59
|
+
* a module for using Prolog via a command-line interface, namely `repl`,
|
|
60
|
+
|
|
61
|
+
* a module for using Prolog via a graphical user interface (GUI), namely `ide`,
|
|
62
|
+
|
|
63
|
+
* a module for using PLP (and, in particular, ProbLob) via a GUI, namely `ide-plp`.
|
|
64
|
+
|
|
65
|
+
The modular, unopinionated architecture of 2P-Kt is deliberately aimed at supporting and encouraging extensions towards
|
|
66
|
+
other sorts of symbolic AI systems than Prolog---such as ASP, tabled-Prolog, concurrent LP, etc.
|
|
67
|
+
|
|
68
|
+
Furthermore, 2P-Kt is developed as in _pure_, __multi-platform__ Kotlin project.
|
|
69
|
+
This brings two immediate advantages:
|
|
70
|
+
1. it virtually supports several platforms, there including JVM, JS, Android, and Native (even if, currently, only JVM,
|
|
71
|
+
JS and Android are supported),
|
|
72
|
+
2. it consists of a very minimal and lightweight library, only leveraging on the Kotlin _common_ library, as it cannot
|
|
73
|
+
commit to any particular platform standard library.
|
|
74
|
+
|
|
75
|
+
## Users
|
|
76
|
+
2P-Kt can either be used as a command-line program or as a Kotlin, JVM, Android, or JS library.
|
|
77
|
+
|
|
78
|
+
The 2P-Kt executables are currently available for download on the [Releases section](https://github.com/tuProlog/2p-kt/releases) of the
|
|
79
|
+
GitHub repository.
|
|
80
|
+
|
|
81
|
+
The 2P-Kt modules for JVM, Android, or Kotlin users are currently available for import
|
|
82
|
+
on [Maven Central](https://search.maven.org/search?q=g:it.unibo.tuprolog), under the `it.unibo.tuprolog` group ID (not
|
|
83
|
+
to be confused with the `it.unibo.alice.tuprolog`, which contains the old Java-based implementation).
|
|
84
|
+
The same modules are available through an _ad-hoc_ [Maven repository](https://github.com/orgs/tuProlog/packages?repo_name=2p-kt) as well,
|
|
85
|
+
hosted by GitHub.
|
|
86
|
+
|
|
87
|
+
The 2P-Kt modules for JS users, are available for import on NPM, under the [`@tuprolog` organization](https://www.npmjs.com/org/tuprolog).
|
|
88
|
+
|
|
89
|
+
### End users
|
|
90
|
+
|
|
91
|
+
#### Graphical User Interface
|
|
92
|
+
|
|
93
|
+
If you need a GUI for your Prolog interpreter, you can rely on the 2P-Kt IDE which is available on the [Releases section of the
|
|
94
|
+
GitHub repository](https://github.com/tuProlog/2p-kt/releases).
|
|
95
|
+
|
|
96
|
+
The page of the [latest release](https://github.com/tuProlog/2p-kt/releases/latest) of 2P-Kt exposes a number of _Assets_.
|
|
97
|
+
There, the one named:
|
|
98
|
+
```
|
|
99
|
+
2p-ide-VERSION-redist.jar
|
|
100
|
+
```
|
|
101
|
+
is the self-contained, executable Jar containing the 2P-Kt-based Prolog interpreter (`VERSION` may vary depending on the
|
|
102
|
+
actual release version).
|
|
103
|
+
|
|
104
|
+
After you download the `2p-ide-VERSION-redist.jar`, you can simply launch it by running:
|
|
105
|
+
```bash
|
|
106
|
+
java -jar 2p-ide-VERSION-redist.jar
|
|
107
|
+
```
|
|
108
|
+
However, if you have properly configured the JVM on your system, it may be sufficient to just double-click on the
|
|
109
|
+
aforementioned JAR to start the IDE.
|
|
110
|
+
In any case, running the JAR should make the following window appear:
|
|
111
|
+
|
|
112
|
+

|
|
113
|
+
|
|
114
|
+
There, one may query the 2P-Kt Prolog interpreter against the currently opened theory file, which can of course be
|
|
115
|
+
loaded from the user's file system by pressing <kbd>File</kbd> and then <kbd>Open...</kbd>.
|
|
116
|
+
|
|
117
|
+
To issue a query, the user must write it in the query text field, at the center of the application.
|
|
118
|
+
By either pressing <kbd>Enter</kbd> while the cursor is on the query text field, or by clicking on the <kbd>Solve</kbd>
|
|
119
|
+
(resp. <kbd>Solve all</kbd>) button, the user can start a new resolution process, aimed at solving the provided query.
|
|
120
|
+
Further solutions can be explored by clicking on the <kbd>Next</kbd> (resp. <kbd>All next</kbd>) button over and over again.
|
|
121
|
+
The <kbd>Next</kbd> (resp. <kbd>All next</kbd>) button shall appear in place of <kbd>Solve</kbd> (resp. <kbd>Solve all</kbd>)
|
|
122
|
+
if and when further solutions are available for the current query.
|
|
123
|
+
|
|
124
|
+
One may also compute all the unexplored solutions at once by clicking on the <kbd>Solve all</kbd>
|
|
125
|
+
(resp. <kbd>All next</kbd>) button.
|
|
126
|
+
Avoid this option in case of your query is expected to compute an unlimited amount of solutions.
|
|
127
|
+
|
|
128
|
+
To perform a novel query, they user may either:
|
|
129
|
+
- write the new query in the query text field, and then press <kbd>Enter</kbd>, or
|
|
130
|
+
- click on the <kbd>Stop</kbd> button, write the new query in the query text field, and then press the <kbd>Solve</kbd>
|
|
131
|
+
(resp. <kbd>SolveNext</kbd>) button again.
|
|
132
|
+
|
|
133
|
+
The <kbd>Reset</kbd> button cleans up the status of the solver, clearing any side effect possibly provoked by previous
|
|
134
|
+
queries (including assertions, retractions, prints, warnings, loading of libraries, operators, or flags).
|
|
135
|
+
|
|
136
|
+
Finally, users may inspect the current status of the solver by leveraging the many tabs laying at the bottom of the IDE.
|
|
137
|
+
There,
|
|
138
|
+
- the _Solutions_ tab is aimed at showing the Prolog interpreter's answers to the user's queries;
|
|
139
|
+
- the _Stdin_ tab is aimed at letting the user provide some text the Prolog interpreter's standard input stream;
|
|
140
|
+
- the _Stdout_ tab is aimed at showing the Prolog interpreter's standard output stream;
|
|
141
|
+
- the _Stderr_ tab is aimed at showing the Prolog interpreter's standard error stream;
|
|
142
|
+
- the _Warnings_ tab is aimed at showing any warning possibly generated by the Prolog interpreter while computing;
|
|
143
|
+
- the _Operators_ tab is aimed at showing the current content Prolog interpreter's operator table;
|
|
144
|
+
- the _Flags_ tab is aimed showing the actual values of all the flags currently defined with the Prolog interpreter;
|
|
145
|
+
- the _Libraries_ tab is aimed at letting the user inspect the currently loaded libraries and the predicates, operators, and functions they import;
|
|
146
|
+
- the _Static_ (resp. _Dynamic_) _KB_ tab is aimed at letting the user inspect the current content of the Prolog interpreter's static (resp. dynamic) knowledge base.
|
|
147
|
+
|
|
148
|
+
Any of these tabs may be automatically updated after a solution to some query is computed.
|
|
149
|
+
Whenever something changes w.r.t. the previous content of the tab, an asterisk will appear close to the tab name, to notify an update in that tab.
|
|
150
|
+
|
|
151
|
+
#### Command Line Interface
|
|
152
|
+
|
|
153
|
+
If you just need a command-line Prolog interpreter, you can rely on the 2P-Kt REPL which is available on the [Releases section of the
|
|
154
|
+
GitHub repository](https://github.com/tuProlog/2p-kt/releases).
|
|
155
|
+
|
|
156
|
+
The page of the [latest release](https://github.com/tuProlog/2p-kt/releases/latest) of 2P-Kt exposes a number of _Assets_.
|
|
157
|
+
There, the one named:
|
|
158
|
+
```
|
|
159
|
+
2p-repl-VERSION-redist.jar
|
|
160
|
+
```
|
|
161
|
+
is the self-contained, executable Jar containing the 2P-Kt-based Prolog interpreter (`VERSION` may vary depending on the
|
|
162
|
+
actual release version).
|
|
163
|
+
|
|
164
|
+
After you download the `2p-repl-VERSION-redist.jar`, you can simply launch it by running:
|
|
165
|
+
```bash
|
|
166
|
+
java -jar 2p-repl-VERSION-redist.jar
|
|
167
|
+
```
|
|
168
|
+
This should start an interactive read-eval-print loop accepting Prolog queries.
|
|
169
|
+
A normal output should be as follows:
|
|
170
|
+
```
|
|
171
|
+
# 2P-Kt version LAST_VERSION_HERE
|
|
172
|
+
|
|
173
|
+
?- <write your dot-terminated Prolog query here>.
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
For instance:
|
|
177
|
+
|
|
178
|
+

|
|
179
|
+
|
|
180
|
+
Other options or modes of execution are supported.
|
|
181
|
+
One can explore them via the program help, which can be displayed by running:
|
|
182
|
+
```bash
|
|
183
|
+
java -jar 2p-repl-VERSION-redist.jar --help
|
|
184
|
+
```
|
|
185
|
+
This should display a message similar to the following one:
|
|
186
|
+
```
|
|
187
|
+
Usage: java -jar 2p-repl.jar [OPTIONS] COMMAND [ARGS]...
|
|
188
|
+
|
|
189
|
+
Start a Prolog Read-Eval-Print loop
|
|
190
|
+
|
|
191
|
+
Options:
|
|
192
|
+
-T, --theory TEXT Path of theory file to be loaded
|
|
193
|
+
-t, --timeout INT Maximum amount of time for computing a solution (default:
|
|
194
|
+
1000 ms)
|
|
195
|
+
--oop Loads the OOP library
|
|
196
|
+
-h, --help Show this message and exit
|
|
197
|
+
|
|
198
|
+
Commands:
|
|
199
|
+
solve Compute a particular query and then terminate
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Gradle users
|
|
203
|
+
|
|
204
|
+
To import the 2P-Kt module named `2P_MODULE` (version `2P_VERSION`) into your Kotlin-based project leveraging on Gradle,
|
|
205
|
+
you simply need to declare the corresponding dependency in your `build.gradle(.kts)` file:
|
|
206
|
+
```kotlin
|
|
207
|
+
// assumes Gradle's Kotlin DSL
|
|
208
|
+
dependencies {
|
|
209
|
+
implementation("it.unibo.tuprolog", "2P_MODULE", "2P_VERSION")
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
In this way, the dependencies of `2P_MODULE` should be automatically imported.
|
|
213
|
+
|
|
214
|
+
The step above, requires you to tell Gradle to either use Maven Central or our GitHub repository (or both) as a source
|
|
215
|
+
for dependency lookup. You can do it as follows:
|
|
216
|
+
```kotlin
|
|
217
|
+
// assumes Gradle's Kotlin DSL
|
|
218
|
+
repositories {
|
|
219
|
+
maven("https://maven.pkg.github.com/tuProlog/2p-kt")
|
|
220
|
+
mavenCentral()
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
> Authentication may be required in case the GitHub repository is exploited
|
|
225
|
+
|
|
226
|
+
#### JVM-only projects with Gradle
|
|
227
|
+
|
|
228
|
+
Remember to add the `-jvm` suffix to `2P_MODULE` in case your project only targets the JVM platform:
|
|
229
|
+
```kotlin
|
|
230
|
+
// assumes Gradle's Kotlin DSL
|
|
231
|
+
dependencies {
|
|
232
|
+
implementation("it.unibo.tuprolog", "2P_MODULE-jvm", "2P_VERSION")
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Maven users
|
|
237
|
+
|
|
238
|
+
To import the 2P-Kt module named `2P_MODULE` (version `2P_VERSION`) into your Kotlin-based project leveraging on Maven,
|
|
239
|
+
you simply need to declare the corresponding dependency in your `pom.xml` file:
|
|
240
|
+
```xml
|
|
241
|
+
<dependency>
|
|
242
|
+
<groupId>it.unibo.tuprolog</groupId>
|
|
243
|
+
<artifactId>2P_MODULE</artifactId>
|
|
244
|
+
<version>2P_VERSION</version>
|
|
245
|
+
</dependency>
|
|
246
|
+
```
|
|
247
|
+
In this way, the dependencies of `2P_MODULE` should be automatically imported.
|
|
248
|
+
|
|
249
|
+
The step above, requires you to tell Maven to either use Maven Central or our GitHub repository (or both) as a source
|
|
250
|
+
for dependency lookup. You can do it as follows:
|
|
251
|
+
```xml
|
|
252
|
+
<repositories>
|
|
253
|
+
<repository>
|
|
254
|
+
<id>github-2p-repo</id>
|
|
255
|
+
<url>https://maven.pkg.github.com/tuProlog/2p-kt</url>
|
|
256
|
+
</repository>
|
|
257
|
+
</repositories>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
> Authentication may be required in case the GitHub repository is exploited
|
|
261
|
+
|
|
262
|
+
#### JVM-only projects with Maven
|
|
263
|
+
|
|
264
|
+
Remember to add the `-jvm` suffix to `2P_MODULE` in case your project only targets the JVM platform:
|
|
265
|
+
```xml
|
|
266
|
+
<dependency>
|
|
267
|
+
<groupId>it.unibo.tuprolog</groupId>
|
|
268
|
+
<artifactId>2P_MODULE-jvm</artifactId>
|
|
269
|
+
<version>2P_VERSION</version>
|
|
270
|
+
</dependency>
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### NPM users (JavaScript-only projects)
|
|
274
|
+
|
|
275
|
+
The 2P-Kt software is available as a JavaScript library as well, on NPM, under the [`@tuprolog` organization](https://www.npmjs.com/org/tuprolog).
|
|
276
|
+
To import the `2P_MODULE` into your `package.json`, it is sufficient to declare your dependency as follows:
|
|
277
|
+
```json
|
|
278
|
+
{
|
|
279
|
+
"dependencies": {
|
|
280
|
+
"@tuprolog/2P_MODULE": "^2P_MODULE_VERSION"
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
Notice that the JS dependencies of `2P_MODULE` should be automatically imported.
|
|
285
|
+
|
|
286
|
+
## Developers
|
|
287
|
+
|
|
288
|
+
Working with the 2P-Kt codebase requires a number of tools to be installed and properly configured on your system:
|
|
289
|
+
- JDK 11+ (please ensure the `JAVA_HOME` environment variable is properly) configured
|
|
290
|
+
- Kotlin 1.5.10+
|
|
291
|
+
- Gradle 7.1+ (please ensure the `GRADLE_HOME` environment variable is properly configured)
|
|
292
|
+
- Git 2.20+
|
|
293
|
+
|
|
294
|
+
### Develop 2P-Kt with IntelliJ Idea
|
|
295
|
+
|
|
296
|
+
To participate in the development of 2P-Kt, we suggest the [IntelliJ Idea](https://www.jetbrains.com/idea/download/) IDE.
|
|
297
|
+
The free, _Community_ version will be fine.
|
|
298
|
+
|
|
299
|
+
#### Recommended configuration
|
|
300
|
+
You will need the __Kotlin__ plugin for IntelliJ Idea.
|
|
301
|
+
This is usually installed upon Idea's very first setup wizard.
|
|
302
|
+
However, one may easily late-install such plugin through the IDE's Plugins settings dialog.
|
|
303
|
+
To open such dialog, use <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd>, then search for "Plugins"
|
|
304
|
+
|
|
305
|
+
#### Importing the project
|
|
306
|
+
|
|
307
|
+
1. Clone this repository in a folder of your preference using `git clone` appropriately
|
|
308
|
+
|
|
309
|
+
0. Open IntellJ Idea.
|
|
310
|
+
If a project opens automatically, select "Close project".
|
|
311
|
+
You should be on the welcome screen of IntelliJ idea, with an aspect similar to this image:
|
|
312
|
+

|
|
313
|
+
|
|
314
|
+
0. Select "Import Project"
|
|
315
|
+
|
|
316
|
+
0. Navigate your file system and find the folder where you cloned the repository.
|
|
317
|
+
**Do not select it**.
|
|
318
|
+
Open the folder, and you should find a lowercase `2p-in-kotlin` folder.
|
|
319
|
+
That is the correct project folder, created by `git` in case you cloned without specifying a different folder name.
|
|
320
|
+
Once the correct folder has been selected, click <kbd>Ok</kbd>
|
|
321
|
+
|
|
322
|
+
0. Select "Import Project from external model"
|
|
323
|
+
|
|
324
|
+
0. Make sure "Gradle" is selected as external model tool
|
|
325
|
+
|
|
326
|
+
0. Click <kbd>Finish</kbd>
|
|
327
|
+
|
|
328
|
+
0. If prompted to override any `.idea` file, try to answer <kbd>No</kbd>. It's possible that IntelliJ refuses to proceed, in which case click <kbd>Finish</kbd> again, then select <kbd>Yes</kbd>
|
|
329
|
+
|
|
330
|
+
0. A dialog stating that "IntelliJ IDEA found a Gradle build script" may appear, in such case answer <kbd>Import Gradle Project</kbd>
|
|
331
|
+
|
|
332
|
+
0. Wait for the IDE to import the project from Gradle. The process may take several minutes, due to the amount of dependencies. Should the synchronization fail, make sure that the IDE's Gradle is configured correctly:
|
|
333
|
+
|
|
334
|
+
0. In 'Settings -> Build, Execution, Deployment -> Build Tools > Gradle', for the option 'Use Gradle from' select 'gradle-wrapper.properties file'. Enabling auto-import is also recommended
|
|
335
|
+
|
|
336
|
+
### Developing the project
|
|
337
|
+
Contributions to this project are welcome. Just some rules:
|
|
338
|
+
|
|
339
|
+
* We use [git flow](https://github.com/nvie/gitflow), so if you write new features, please do so in a separate `feature/` branch
|
|
340
|
+
|
|
341
|
+
* We recommend forking the project, developing your stuff, then contributing back via pull request directly from the Web interface
|
|
342
|
+
|
|
343
|
+
* Commit often. Do not throw pull requests with a single giant commit adding or changing the whole world. Split it in multiple commits and request a merge to the mainline often
|
|
344
|
+
|
|
345
|
+
* Stay in sync with the `develop` branch: pull often from `develop` (if the build passes), so that you don't diverge too much from the main development line
|
|
346
|
+
|
|
347
|
+
* Do not introduce low quality or untested code. Merge requests will be reviewed before merge.
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
#### Building the project
|
|
351
|
+
While developing, you can rely on IntelliJ to build the project, it will generally do a very good job.
|
|
352
|
+
If you want to generate the artifacts, you can rely on Gradle. Just point a terminal on the project's root and issue
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
./gradlew build
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
This will trigger the creation of the artifacts the executions of the tests, the generation of the documentation and of the project reports.
|
|
359
|
+
|
|
360
|
+
#### Versioning
|
|
361
|
+
|
|
362
|
+
The 2P project leverages on [Semantic Versioning](https://semver.org/) (SemVer, henceforth).
|
|
363
|
+
|
|
364
|
+
In particular, SemVer is enforced by the current Gradle configuration, which features [DanySK](https://github.com/DanySK)'s [Git sensitive SemVer Gradle Plugin](https://github.com/DanySK/git-sensitive-semantic-versioning-gradle-plugin).
|
|
365
|
+
This implies it is strictly forbidden in this project to create tags whose label is not a valid SemVar string.
|
|
366
|
+
|
|
367
|
+
Notice that the 2P project is still in its initial development stage---as proven by the major number equal to `0` in its version string.
|
|
368
|
+
According to SemVer, this implies anything _may_ change at any time, as the public API _should not_ be considered stable.
|
|
369
|
+
|
|
370
|
+
#### Issue tracking
|
|
371
|
+
|
|
372
|
+
If you meet some problem in using or developing 2P, you are encouraged to signal it through the project ["Issues" section](https://github.com/tuProlog/2p-kt/issues) on GitHub.
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
(function (_, Kotlin, $module$_2p_repl) {
|
|
2
|
+
'use strict';
|
|
3
|
+
var main = $module$_2p_repl.it.unibo.tuprolog.ui.repl.main_kand9s$;
|
|
4
|
+
function main_0(args) {
|
|
5
|
+
main(args);
|
|
6
|
+
}
|
|
7
|
+
var package$it = _.it || (_.it = {});
|
|
8
|
+
var package$unibo = package$it.unibo || (package$it.unibo = {});
|
|
9
|
+
var package$tuprolog = package$unibo.tuprolog || (package$unibo.tuprolog = {});
|
|
10
|
+
package$tuprolog.main_kand9s$ = main_0;
|
|
11
|
+
Kotlin.defineModule('@tuprolog/2p-full', _);
|
|
12
|
+
return _;
|
|
13
|
+
}(module.exports, require('kotlin'), require('@tuprolog/2p-repl')));
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=2p-full.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"2p-full.js","sources":["../../../../../full/src/jsMain/kotlin/it/unibo/tuprolog/PrologCLI.kt"],"sourcesContent":[null],"names":[],"mappings":";;;EAEA,sB;IAC8B,KAAK,IAAL,C;EAC9B,C;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Kotlin.kotlin_module_metadata(393729, "@tuprolog/2p-full", "H4sIAAAAAAAA/y3OQQrCMBCF4XQ6SYfBxZCNEjyCQukBBM8gHqCClGBNSkwXHkNXHsXjGaSb9y3e5ldU21fFB8Z77wObW8xjEc/BZ8Y+DQ/Wx5T6J5tTTj4MDOXQc/CXyJTnKcUxDnbHIBUbUgIb9RcXdRHEMBJKU1YLua1bi3LQVt1KakcWLbR1C19SHzJvAlZuCXFNN+3TdRp/rZ0dH6gAAAA=");
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tuprolog/2p-full",
|
|
3
|
+
"main": "kotlin/2p-full.js",
|
|
4
|
+
"version": "0.20.9-dev0g",
|
|
5
|
+
"homepage": "https://github.com/tuProlog/2p-kt",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/tuProlog/2p-kt/issues",
|
|
9
|
+
"email": "giovanni.ciatto@unibo.it"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@tuprolog/2p-bdd": "0.20.9-dev0g",
|
|
13
|
+
"@tuprolog/2p-core": "0.20.9-dev0g",
|
|
14
|
+
"@tuprolog/2p-dsl-core": "0.20.9-dev0g",
|
|
15
|
+
"@tuprolog/2p-dsl-solve": "0.20.9-dev0g",
|
|
16
|
+
"@tuprolog/2p-dsl-theory": "0.20.9-dev0g",
|
|
17
|
+
"@tuprolog/2p-dsl-unify": "0.20.9-dev0g",
|
|
18
|
+
"@tuprolog/2p-io-lib": "0.20.9-dev0g",
|
|
19
|
+
"@tuprolog/2p-parser-core": "0.20.9-dev0g",
|
|
20
|
+
"@tuprolog/2p-parser-theory": "0.20.9-dev0g",
|
|
21
|
+
"@tuprolog/2p-serialize-core": "0.20.9-dev0g",
|
|
22
|
+
"@tuprolog/2p-serialize-theory": "0.20.9-dev0g",
|
|
23
|
+
"@tuprolog/2p-solve": "0.20.9-dev0g",
|
|
24
|
+
"@tuprolog/2p-solve-classic": "0.20.9-dev0g",
|
|
25
|
+
"@tuprolog/2p-solve-plp": "0.20.9-dev0g",
|
|
26
|
+
"@tuprolog/2p-solve-problog": "0.20.9-dev0g",
|
|
27
|
+
"@tuprolog/2p-solve-streams": "0.20.9-dev0g",
|
|
28
|
+
"@tuprolog/2p-theory": "0.20.9-dev0g",
|
|
29
|
+
"@tuprolog/2p-unify": "0.20.9-dev0g",
|
|
30
|
+
"@tuprolog/2p-utils": "0.20.9-dev0g",
|
|
31
|
+
"@tuprolog/2p-parser-js": "0.20.9-dev0g"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"source-map-support": "0.5.21"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {}
|
|
37
|
+
}
|