Project Overview - aantakli/AJAN-service GitHub Wiki

JAVA Project

In the following, all sub-projects of the AJAN-service are listed. The most important ones are: Executionservice, where the actual service was implemented and the agent is managed; Common, where the configuration for the triplestores was implemented and which contains several utility classes and the general AJAN vocabulary; and Behaviour, where all AJAN native SPARQL-BT nodes, events and queries were implemented.

Project Structure:

  • AJAN Parent Project
    • Build-Resources
    • RDFBeans
    • Behaviour
    • Common
    • Triplestore
    • Executionservice
    • PluginSystem
      • Loader
      • Plugins
        • StandardBTNodes
        • MOSIMPlugin
        • ASPPlugin
        • MappingPlugin
        • StripsPlugin

Via the PluginSystem project new SPARQL-BT nodes (e.g. domain-specific like MOSIMPlugin) can be defined or implemented. Furthermore, such plugins can be used to extend AJAN with new interfaces. How to create plugins is explained in the subchapter Plugins. One of the most important plugins is the standard BTNodes plugin, which implements the standard behavior tree nodes like Sequence, Parallel, Repeat, etc. according to the BT logic defined by gdx-ai.

Plugins

This section assumes that the user has some knowledge about Java and Maven. For the sake of example the following variables have been considered:

  • $ajan = de.dfki.asr.ajan
  • $name = DummyPlugin
  • $pkgName = $ajan.pluginsystem.dummyplugin
  • $className = $ajan.pluginsystem.dummyplugin.DummyPlugin
  • $actionFile = $ajan.pluginsystem.dummyplugin.extensions.DummyAction
  • $mosimPkg = $ajan.pluginsystem.mosimplugin

How to create a new Plugin and a Plugin Action:

The easiest way to create a new plugin is to clone an existed plugin from the location ajan-service\pluginsystem\plugins in the same directory. The following things have to be changed before the newly created plugin could function properly.

  1. Rename the folder of the cloned plugin to $name.

  2. In ajan-service\pluginsystem\plugins\pom.xml add <module>$name</module> in the <modules> tag.

  3. Change the <artifactId> and <name> in ajan-service\pluginsystem\plugins\$name\pom.xml to $name.

  4. Rename the directories such that it is consistent with the $pkgName. Make sure that package names in the classes are compatible with the $pkgName as well.

  5. Rename the class $className and change the content related to debugging.

  6. In file ajan-service\pluginsystem\plugins\$name\plugin.properties, make the following changes:

    • Change plugin.class to $className
    • Change plugin.id to $name
    • Change plugin.provider and plugin.version accordingly.
  7. In file ajan-service\pluginsystem\plugins\$name\src\main\resources\META-INF\MANIFEST.MF, make the changes consistent to step 6.

  8. Important: In case you're using new namespaces, make sure they're listed in package-info.java file (in the package $pkgName.extensions).

  9. Important: Change the content of $actionFile according to the requirements. Make sure that the name of annotation @RDFBean and the Resource in the method getType() are consistent with IRI used in the ttl files.

How to define a BTNode:

In order to create a new BTNode:

  1. Create a class in the package $pkgName.extensions.
  2. The newly created class must extend $ajan.behaviour.nodes.common.AbstractTDBLeafTask.java and implements $ajan.pluginsystem.extensionpoints.NodeExtension.java.

How to define a Thrift Endpoint:

Similar to MOSIMPlugin:

  1. The thrift compiled files must be placed in the package $pkgName.endpoint.
  2. Create an interface similar to $mosimPkg.endpoint.ThriftAction.java in the package$pkgName.endpoint.
  3. Define a new thrift endpoint class in the package $pkgName.extensions which should implement the newly created interface.

For more details please have a look into the implementation of $mosimPkg.extensions.AbstractInstruction.java

⚠️ **GitHub.com Fallback** ⚠️