Run

Standalone Application #

Follow the GETTING STARTED instructions to install and run the Arg2p Java IDE.

The Arg2P IDE should appear as depicted below:

Run

Copy the following example theory in the IDE editor (or create your own following the base instructions):

d1 : bird(X) => flies(X).
d2 : penguin(X) => bird(X).
s1 : penguin(X) -> -flies(X).
a1 :-> penguin(tweety).

Run the goal buildLabelSets to build and evaluate the entire framework:

Run

Labellings are printed textually in the Output tab and graphically in the Graph tab:

Run

Alternatively you can require the evaluation of a single statement with the answerQuery/4 predicate. For example, run the goal answerQuery(flies(tweety), In, Out, Und) to check the admissibility of the flies(tweety) statement. The result is printed in the Solution tab:

Run

More information on the Arg2p usage can be found on the API & Flags page.

Kotlin library #

Follow the Get Started instructions to add the Arg2p dependency to your Kotlin project.

First include the library with:

import it.unibo.tuprolog.argumentation.core.Arg2pSolver

You can create a new Prolog solver including the Arg2p library with the following notation (for more info on 2P-Kt refer to the official page):

val arg2p = Arg2pSolver.default()
val solver = ClassicSolverFactory.mutableSolverWithDefaultBuiltins(
    otherLibraries = arg2p.to2pLibraries()
)

Set the solver theory:

solver.loadStaticKb(Theory.parse("""
            graphBuildMode(standard_af).
            argumentLabellingMode(grounded).
            statementLabellingMode(statement).
            
            d1 : bird(X) => flies(X).
            d2 : penguin(X) => bird(X).
            s1 : penguin(X) -> -flies(X).
            a1 :-> penguin(tweety).

        """.trimIndent(), arg2p.operators()))

Require the evaluation of the theory. For example:

prolog {
    solver.solve("buildLabelSets"(X, Y, Z))
        .map { 
            when(it) {
                Solution.Yes -> "In statements: ${it.substitution[X].toString()}"
                Solution.No -> "No available solution"
                Solution.Halt -> "Error in resolution process"
            } 
        }
}