@tuprolog/arg2p-core 0.10.0 → 0.10.2

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/README.md CHANGED
@@ -1,120 +1,131 @@
1
1
  # Arg2P
2
2
 
3
- Quick links:
3
+ Arg2P is a lightweight implementation of the ASPIC<sup>+</sup> framework for structured argumentation.
4
+ Built on top of the [tuProlog](http://pika-lab.gitlab.io/tuprolog/2p-kt/) engine, it supports both JVM and Node environments.
4
5
 
5
- - [GitLab Repository](https://gitlab.com/pika-lab/argumentation/arg2p-kt)
6
- - [GitHub Repository](https://github.com/tuProlog/arg2p-kt)
7
- - [Maven Repository](https://search.maven.org/search?q=g:it.unibo.tuprolog.argumentation)
8
- - [NPM Package](https://www.npmjs.com/package/@tuprolog/arg2p-core)
9
- - [Documentation](https://pika-lab.gitlab.io/argumentation/arg2p-kt)
6
+ More details are available on the [official wiki](https://pika-lab.gitlab.io/argumentation/arg2p-kt/).
10
7
 
8
+ ---
11
9
 
12
- Arg2Prolog is a lightweight implementation of the ASPIC<sup>+</sup>-like framework for structured argumentation.
13
- It is built on the top of the [tuProlog](http://pika-lab.gitlab.io/tuprolog/2p-in-kotlin/) engine.
10
+ ## Getting Started
14
11
 
15
- More information about the project can be found on the [official wiki](https://pika-lab.gitlab.io/argumentation/arg2p-kt/).
12
+ Arg2p is available as a [2P-Kt](http://pika-lab.gitlab.io/tuprolog/2p-kt/) library.
16
13
 
17
- ### Get Started
14
+ #### JVM Library - Gradle
18
15
 
19
- The Arg2p library is available in two different forms: as a standalone application (Arg2p Java IDE), and as a [2P-Kt](http://pika-lab.gitlab.io/tuprolog/2p-in-kotlin/) library.
16
+ To import the Arg2p module (version `ARG2P_VERSION`) into your Kotlin-based Gradle project, declare the dependency in your `build.gradle(.kts)` file:
17
+ ```kotlin
18
+ repositories {
19
+ mavenCentral()
20
+ }
21
+
22
+ dependencies {
23
+ implementation("it.unibo.tuprolog.argumentation:arg2p-jvm:ARG2P_VERSION")
24
+ }
25
+ ```
26
+
27
+ #### Usage Example
20
28
 
21
- #### Graphical User Interface
29
+ ```kotlin
30
+ import it.unibo.tuprolog.argumentation.core.Arg2pSolverFactory
31
+ import it.unibo.tuprolog.argumentation.core.libs.basic.FlagsBuilder
32
+
33
+ fun main() {
34
+ val graph = Arg2pSolverFactory.evaluate("""
35
+ f1 :=> d.
36
+ f2 :=> -d.
37
+ """.trimIndent(), FlagsBuilder()).first()
38
+
39
+ graph.labellings.forEach {
40
+ println("${it.label} : ${it.argument.conclusion}")
41
+ }
42
+ }
43
+ ```
22
44
 
23
- If you need a GUI for your Prolog interpreter, you can rely on the Arg2p IDE which is available on the [Releases section of the
24
- GitHub repository](https://github.com/tuProlog/arg2p-kt/releases).
45
+ For a complete example, check out the [GitHub demo](https://github.com/Gilbocc/arg2p-kt-demo).
25
46
 
26
- The page of the [latest release](https://github.com/tuProlog/arg2p-kt/releases/latest) of Arg2P exposes a number of _Assets_.
27
- There, the one named:
28
- ```
29
- arg2p-ide-VERSION-redist.jar
47
+ #### NPM Library
48
+
49
+ The Arg2P software is available on NPM as a JavaScript library as well. It can be found under the [`@tuprolog` organization](https://www.npmjs.com/org/tuprolog).
50
+ To use the library, add the dependency to your `package.json`:
51
+
52
+ ```json
53
+ {
54
+ "dependencies": {
55
+ "@tuprolog/arg2p": "ARG2P_VERSION"
56
+ }
57
+ }
30
58
  ```
31
- is the self-contained, executable Jar containing the 2P-Kt-based Prolog interpreter (`VERSION` may vary depending on the
32
- actual release version).
33
59
 
34
- After you download the `arg2p-ide-VERSION-redist.jar`, you can simply launch it by running:
35
- ```bash
36
- java -jar arg2p-ide-VERSION-redist.jar
60
+ #### Usage Example
61
+
62
+ ```js
63
+ const arg2p = require('@tuprolog/arg2p').it.unibo.tuprolog.argumentation.bridge.JsBridge
64
+
65
+ const graph = arg2p.solve('buildLabelSets', `
66
+ f1 :=> d.
67
+ f2 :=> -d.`, `
68
+ graphBuildMode(standard_af).
69
+ statementLabellingMode(statement).
70
+ argumentLabellingMode(grounded_hash).
71
+ orderingPrinciple(last).
72
+ orderingComparator(elitist).
73
+ graphExtension(standardPref).
74
+ queryMode.`, _ => { }).i.next().graph
75
+
76
+ graph.arguments.forEach(arg => {
77
+ console.log(`${arg.label} : ${arg.descriptor}`)
78
+ })
37
79
  ```
38
- However, if you have properly configured the JVM on your system, it may be sufficient to just double-click on the JAR to start the IDE.
39
80
 
40
- There, one may query the Arg2p Prolog interpreter against the currently opened theory file, which can of course be
41
- loaded from the user's file system by pressing <kbd>File</kbd> and then <kbd>Open...</kbd>.
81
+ For a complete example, see the [repository](https://github.com/tuProlog/arg2p-kt-web).
42
82
 
43
- To issue a query, the user must write it in the query text field, at the center of the application.
44
- By either pressing <kbd>Enter</kbd> while the cursor is on the query text field, or by clicking on the <kbd>&gt;</kbd> button, the user can start a new resolution process, aimed at solving the provided query.
45
- Further solutions can be explored by clicking on the <kbd>&gt;</kbd> over and over again.
46
- One may also compute all the unexplored solutions at once by clicking on the <kbd>&gt;&gt;</kbd> button.
83
+ ---
47
84
 
48
- To perform a novel query, the user may either:
49
- - write the new query in the query text field, and then press <kbd>Enter</kbd>, or
50
- - click on the <kbd>X</kbd> (Stop) button, write the new query in the query text field, and then press <kbd>&gt;</kbd>.
85
+ ## Arg2p IDE
51
86
 
52
- For a deeper introduction on the Arg2p IDE you can refer to the original [2P-Kt](https://gitlab.com/pika-lab/tuprolog/2p-in-kotlin) page.
53
- The Arg2p version of the IDE introduces two additional tabs:
54
- - the _Graph_ tab, containing the graphical representation of the abstract argumentation graph (available only if leveraging the abstract query mode -- `buildLabelSet` predicate);
55
- - the _Arg Flag_ tab, allowing the user to see/modify the values of the Arg2p flags. A comprehensive description of these values can be found on the [official wiki](https://pika-lab.gitlab.io/argumentation/arg2p-kt/wiki/predicate).
87
+ The Arg2p IDE is available on the [Releases section of the
88
+ GitHub repository](https://github.com/tuProlog/arg2p-kt/releases/latest).
56
89
 
57
- #### Gradle users
90
+ ![Java IDE](./imgs/javaide.png)
58
91
 
59
- To import the Arg2p module (version `ARG2P_VERSION`) into your Kotlin-based project leveraging on Gradle,
60
- you simply need to declare the corresponding dependency in your `build.gradle(.kts)` file:
61
- ```kotlin
62
- dependencies {
63
- implementation("it.unibo.tuprolog.argumentation", "arg2p", "ARG2P_VERSION")
64
- }
65
- ```
92
+ In the [latest release](https://github.com/tuProlog/arg2p-kt/releases/latest) page, download the _Asset_ named:
93
+ ```
94
+ arg2p-ide-ARG2P_VERSION-redist.jar
95
+ ```
96
+ a self-contained, executable Jar containing the 2P-Kt-based Prolog interpreter (`ARG2P_VERSION` will vary depending on the
97
+ actual release version).
66
98
 
67
- Don't forget to tell Gradle to use Maven Central as a source for dependency lookup. You can do it as follows:
68
- ```kotlin
69
- repositories {
70
- mavenCentral()
71
- }
72
- ```
99
+ After you download the `arg2p-ide-ARG2P_VERSION-redist.jar`, you can simply launch it by running:
100
+ ```bash
101
+ java -jar arg2p-ide-ARG2P_VERSION-redist.jar
102
+ ```
103
+ If your JVM is properly configured, you can also start the IDE by double-clicking the JAR file.
73
104
 
74
- ##### JVM-only projects with Gradle
105
+ ### Features
75
106
 
76
- In the case your project only targets the JVM platform, remember to add the `-jvm` suffix to the module name:
77
- ```kotlin
78
- dependencies {
79
- implementation("it.unibo.tuprolog.argumentation", "arg2p-jvm", "ARG2P_VERSION")
80
- }
81
- ```
107
+ - **Query Execution:** Write your query in the text field and hit <kbd>Enter</kbd> or click <kbd>&gt;</kbd>.
108
+ - **Solution Exploration:** Click <kbd>&gt;</kbd> for the next solution or <kbd>&gt;&gt;</kbd> to compute all solutions.
109
+ - **New Query:** Click <kbd>X</kbd> to stop the current query, then enter a new one.
82
110
 
83
- #### Maven users
111
+ ### Additional Tabs
84
112
 
85
- To import the Arg2p module (version `ARG2P_VERSION`) into your Kotlin-based project leveraging on Maven,
86
- you simply need to declare the corresponding dependency in your `pom.xml` file:
87
- ```xml
88
- <dependency>
89
- <groupId>it.unibo.tuprolog.argumentation</groupId>
90
- <artifactId>arg2p</artifactId>
91
- <version>ARG2P_VERSION</version>
92
- </dependency>
93
- ```
113
+ - **Graph Tab:** Displays a graphical representation of the abstract argumentation graph.
114
+ - **Arg Flag Tab:** Shows and allows modification of Arg2P flags. Detailed descriptions are on the [official wiki](https://pika-lab.gitlab.io/argumentation/arg2p-kt/wiki/predicate).
94
115
 
95
- ##### JVM-only projects with Maven
116
+ ---
96
117
 
97
- In the case your project only targets the JVM platform, remember to add the `-jvm` suffix to the module name:
98
- ```xml
99
- <dependency>
100
- <groupId>it.unibo.tuprolog.argumentation</groupId>
101
- <artifactId>arg2p-jvm</artifactId>
102
- <version>ARG2P_VERSION</version>
103
- </dependency>
104
- ```
118
+ ## Arg2p Playground
105
119
 
106
- #### NPM users
120
+ Try Arg2P directly in your browser using the [Web Playground](https://legalmachinelab.unibo.it/arg2p).
107
121
 
108
- The Arg2P software is available on NPM as a JavaScript library as well. It can be found under the [`@tuprolog` organization](https://www.npmjs.com/org/tuprolog).
109
- To import the Arg2p library into your `package.json`, it is sufficient to declare your dependency as follows:
110
- ```json
111
- {
112
- "dependencies": {
113
- "@tuprolog/arg2p-core": "^ARG2P_MODULE_VERSION"
114
- }
115
- }
116
- ```
122
+ ![Web Playground](./imgs/playground.png)
123
+
124
+ It functions the same as the Java IDE, offering an interactive experience without installation.
125
+
126
+ ---
117
127
 
118
- ### Issue tracking
128
+ ## Issue tracking
119
129
 
120
- If you meet some problem in using Arg2p, you are encouraged to signal it through the project ["Issues" section](https://gitlab.com/pika-lab/argumentation/arg2p-kt/-/issues) on GitLab.
130
+ If you encounter any issues, please report them on the [GitHub Issues](https://github.com/tuProlog/arg2p-kt/issues) page.
131
+ Your feedback helps improve the project!
@@ -80,7 +80,7 @@ if (typeof Math.imul === 'undefined') {
80
80
  setMetadataFor(Collection, 'Collection', interfaceMeta);
81
81
  setMetadataFor(AbstractCollection, 'AbstractCollection', classMeta, VOID, [Collection]);
82
82
  setMetadataFor(MutableIterable, 'MutableIterable', interfaceMeta);
83
- setMetadataFor(AbstractMutableCollection, 'AbstractMutableCollection', classMeta, AbstractCollection, [AbstractCollection, MutableIterable, Collection]);
83
+ setMetadataFor(AbstractMutableCollection, 'AbstractMutableCollection', classMeta, AbstractCollection, [AbstractCollection, Collection, MutableIterable]);
84
84
  setMetadataFor(IteratorImpl, 'IteratorImpl', classMeta);
85
85
  setMetadataFor(ListIteratorImpl, 'ListIteratorImpl', classMeta, IteratorImpl);
86
86
  setMetadataFor(List, 'List', interfaceMeta, VOID, [Collection]);
@@ -91,19 +91,19 @@ if (typeof Math.imul === 'undefined') {
91
91
  setMetadataFor(AbstractMap, 'AbstractMap', classMeta, VOID, [Map_0]);
92
92
  setMetadataFor(AbstractMutableMap, 'AbstractMutableMap', classMeta, AbstractMap, [AbstractMap, Map_0]);
93
93
  setMetadataFor(Set, 'Set', interfaceMeta, VOID, [Collection]);
94
- setMetadataFor(AbstractMutableSet, 'AbstractMutableSet', classMeta, AbstractMutableCollection, [AbstractMutableCollection, Set, Collection, MutableIterable]);
94
+ setMetadataFor(AbstractMutableSet, 'AbstractMutableSet', classMeta, AbstractMutableCollection, [AbstractMutableCollection, Collection, Set, MutableIterable]);
95
95
  setMetadataFor(Companion, 'Companion', objectMeta);
96
96
  setMetadataFor(ArrayList, 'ArrayList', classMeta, AbstractMutableList, [AbstractMutableList, Collection, List, MutableIterable, RandomAccess], ArrayList_init_$Create$);
97
97
  setMetadataFor(HashMap, 'HashMap', classMeta, AbstractMutableMap, [AbstractMutableMap, Map_0], HashMap_init_$Create$);
98
- setMetadataFor(HashMapKeys, 'HashMapKeys', classMeta, AbstractMutableSet, [Set, Collection, MutableIterable, AbstractMutableSet]);
99
- setMetadataFor(HashMapValues, 'HashMapValues', classMeta, AbstractMutableCollection, [MutableIterable, Collection, AbstractMutableCollection]);
100
- setMetadataFor(HashMapEntrySetBase, 'HashMapEntrySetBase', classMeta, AbstractMutableSet, [Set, Collection, MutableIterable, AbstractMutableSet]);
98
+ setMetadataFor(HashMapKeys, 'HashMapKeys', classMeta, AbstractMutableSet, [Collection, Set, MutableIterable, AbstractMutableSet]);
99
+ setMetadataFor(HashMapValues, 'HashMapValues', classMeta, AbstractMutableCollection, [Collection, MutableIterable, AbstractMutableCollection]);
100
+ setMetadataFor(HashMapEntrySetBase, 'HashMapEntrySetBase', classMeta, AbstractMutableSet, [Collection, Set, MutableIterable, AbstractMutableSet]);
101
101
  setMetadataFor(HashMapEntrySet, 'HashMapEntrySet', classMeta, HashMapEntrySetBase);
102
102
  setMetadataFor(HashMapKeysDefault$iterator$1, VOID, classMeta);
103
103
  setMetadataFor(HashMapKeysDefault, 'HashMapKeysDefault', classMeta, AbstractMutableSet);
104
104
  setMetadataFor(HashMapValuesDefault$iterator$1, VOID, classMeta);
105
105
  setMetadataFor(HashMapValuesDefault, 'HashMapValuesDefault', classMeta, AbstractMutableCollection);
106
- setMetadataFor(HashSet, 'HashSet', classMeta, AbstractMutableSet, [AbstractMutableSet, Set, Collection, MutableIterable], HashSet_init_$Create$);
106
+ setMetadataFor(HashSet, 'HashSet', classMeta, AbstractMutableSet, [AbstractMutableSet, Collection, Set, MutableIterable], HashSet_init_$Create$);
107
107
  setMetadataFor(Companion_0, 'Companion', objectMeta);
108
108
  setMetadataFor(Itr, 'Itr', classMeta);
109
109
  setMetadataFor(KeysItr, 'KeysItr', classMeta, Itr);
@@ -150,7 +150,7 @@ if (typeof Math.imul === 'undefined') {
150
150
  setMetadataFor(InternalMap, 'InternalMap', interfaceMeta);
151
151
  setMetadataFor(InternalHashMap, 'InternalHashMap', classMeta, VOID, [InternalMap], InternalHashMap_init_$Create$);
152
152
  setMetadataFor(LinkedHashMap, 'LinkedHashMap', classMeta, HashMap, [HashMap, Map_0], LinkedHashMap_init_$Create$);
153
- setMetadataFor(LinkedHashSet, 'LinkedHashSet', classMeta, HashSet, [HashSet, Set, Collection, MutableIterable], LinkedHashSet_init_$Create$);
153
+ setMetadataFor(LinkedHashSet, 'LinkedHashSet', classMeta, HashSet, [HashSet, Collection, Set, MutableIterable], LinkedHashSet_init_$Create$);
154
154
  setMetadataFor(BaseOutput, 'BaseOutput', classMeta);
155
155
  setMetadataFor(NodeJsOutput, 'NodeJsOutput', classMeta, BaseOutput);
156
156
  setMetadataFor(BufferedOutput, 'BufferedOutput', classMeta, BaseOutput, VOID, BufferedOutput);
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "url": "https://github.com/tuProlog/arg2p-kt"
18
18
  },
19
19
  "main": "arg2p-core.js",
20
- "version": "0.10.0",
20
+ "version": "0.10.2",
21
21
  "name": "@tuprolog/arg2p-core",
22
22
  "dependencies": {
23
23
  "@tuprolog/parser-utils": "0.4.1",