Tweety
A comprehensive collection of Java libraries for logical aspects of artificial intelligence and knowledge representation
Home Libraries Downloads Documentation Web Interfaces Contact


Brought to you by




Supported by

back

Installation of Tweety Libraries on the command line

The following step-by-step guide can be used for installing the Tweety libraries via Maven on the command line. This works for all Linux derivatives/Max OS X (the guide is given for Ubuntu Linux but works similarly for other systems).

  1. Install Maven
    $ sudo apt-get install maven
  2. Create empty Maven project
    $ mvn archetype:generate
      -DgroupId=mytweety.mytweetyapp
      -DartifactId=mytweetyapp
      -DarchetypeArtifactId=maven-archetype-quickstart
      -DinteractiveMode=false
  3. Add Tweety as dependency
    $ cd mytweetyapp
    $ nano pom.xml

    <project ...>
       ...
       <dependencies>
       ...
          <dependency>
             <groupId>net.sf.tweety</groupId>
             <artifactId>tweety-full</artifactId>
             <version>1.9</version>
          </dependency>
       ...
       </dependencies>
    </project>
  4. Configure Maven for automatic dependency inclusion (recommended for beginners)
    <project ...>
       ...
       <build>
          <plugins>
             <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                   <descriptorRefs>
                      <descriptorRef>jar-with-dependencies</descriptorRef>
                   </descriptorRefs>
                </configuration>
                <executions>
                   <execution>
                      <id>make-assembly</id>
                      <phase>package</phase>
                      <goals>
                         <goal>single</goal>
                      </goals>
                   </execution>
                </executions>
             </plugin>
          </plugins>
       </build>
    </project>
  5. Write code
    $ nano src/main/java/mytweety/mytweetyapp/App.java

    package mytweety.mytweetyapp;

    import net.sf.tweety.logics.pl.syntax.*;

    public class App{
       public static void main( String[] args ) {
          PropositionalFormula helloWorld = new Proposition("HelloWorld");
          System.out.println(helloWorld); }
       }
  6. Compile and run
    $ mvn package
    $ java -cp target/mytweetyapp -1.0-SNAPSHOT-jar-with-dependencies.jar
       mytweety.mytweetyapp.App HelloWorld



back



Last updated 13.07.2017, Matthias Thimm