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


Brought to you by




Supported by

back

Installation of TweetyProject Libraries on the command line

The following step-by-step guide can be used for installing the TweetyProject 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 TweetyProject as dependency
    $ cd mytweetyapp
    $ nano pom.xml

    <project ...>
       ...
       <dependencies>
       ...
          <dependency>
             <groupId>org.tweetyproject</groupId>
             <artifactId>tweety-full</artifactId>
             <version>1.27</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 org.tweetyproject.logics.pl.syntax.*;

    public class App{
       public static void main( String[] args ) {
          PlFormula 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 03.09.2024, Matthias Thimm | Terms