Skip to content

aantakli/AJAN-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AJAN-service

This is the Maven based JAVA service to create and run AJAN agents.

Prerequisites

You will need the following things properly installed on your computer.

Installation

Prebuild Installation

Clean Installation

  • cmd: git clone <repository-url> this repository
  • cmd: cd AJAN-service
  • cmd: git submodule update --init --recursive
  • run installAJAN.bat or cmd: mvn install

Docker

Setup Triplestore

Start AJAN-Triplestore (see below), visit http://localhost:8090/workbench/ and change (without user and psw) the RDF4J Server URL to http://localhost:8090/rdf4j

RUN

  • run startTriplestore.bat or cmd: java -jar triplestore/target/triplestore-0.1-war-exec.jar --httpPort=8090
  • run startAJAN.bat or cmd: java -Dtriplestore.initialData.agentFolderPath=executionservice/use-case/agents -Dtriplestore.initialData.domainFolderPath=executionservice/use-case/domains -Dtriplestore.initialData.serviceFolderPath=executionservice/use-case/services -Dtriplestore.initialData.behaviorsFolderPath=executionservice/use-case/behaviors -Dtriplestore.initialData.editorDataFolderPath=executionservice/use-case/editor/nodeDefinitions -Dtriplestore.initialData.editorDataFolderPath=executionservice/use-case/editor/editorData -Dpf4j.mode=development -Dserver.port=8080 -DloadTTLFiles=true -Dpf4j.pluginsDir=pluginsystem/plugins -Dtriplestore.url=http://localhost:8090/rdf4j -jar executionservice/target/executionservice-0.1.jar

VM Variables

  • -Dserver.port=8080
    -> Set the port to 8080
  • -DpublicHostName=127.0.0.1
    -> Set the host to 127.0.0.1
  • -DusePort=true
    -> Use prot in AJAN base URI (Example AJAN base URI would be http://127.0.0.1:8080/ajan/agents)
  • -Dtriplestore.url=http://localhost:8090/rdf4j
    -> Points to the triplestore
  • -Dpf4j.pluginsDir=plugins
    -> Place where the AJAN plugins are stored
  • -Dpf4j.mode=development
    -> If set to 'development', then the plugins must be available as jars to be loaded, otherwise PF4J will try to load the plugins as ZIP files
  • -DloadTTLFiles=true
    -> Loading of predefined models with start of AJAN service, this overwrites the existing models in the Triplestore
  • -Dtriplestore.initialData.agentFolderPath=use-case/agents
    -> Folder to predefined agents (RDF/Trig)
  • -Dtriplestore.initialData.domainFolderPath=executionservice/use-case/domains
    -> Folder to predefined domain (RDF/Turtle)
  • -Dtriplestore.initialData.serviceFolderPath=executionservice/use-case/services
    -> Folder to predefined services (RDF/Turtle)
  • -Dtriplestore.initialData.behaviorsFolderPath=executionservice/use-case/behaviors
    -> Folder to predefined behaviors (RDF/Turtle)

Pre-modelled agent templates, behaviors, service definitions and domain knowledge can be adapted via the turtle-files under the ajan-service/executionservice/use-case folder. If you want to model them graphically, we refer you to the AJAN-editor. This editor needs some additional data in additional Triplestores which can be included using the following VM variables:

  • -Dtriplestore.initialData.nodeDefinitionsFolderPath=executionservice/use-case/editor/nodeDefinitions
    -> Folder to predefined node definitions (RDF/Turtle)
  • -Dtriplestore.initialData.editorDataFolderPath=executionservice/use-case/editor/editorData
    -> Folder to predefined editor data (RDF/Turtle)

Examples

For examples, we refere to the AJAN-service Wiki.

Plugins

MQTT Plugin

MQTT Plugin is the plugin used to communicate using the MQTT Protocol. For more details visit https://mqtt.org/

Following are the different types of Nodes that is part of MQTT Plugin:

  • For MQTT Broker:
    • CreateMQTTBroker (Creates the MQTT Broker)
    • DeleteMQTTBroker (Deleted the created MQTT Broker)
  • For Communication:
    • PublishMessage (Publish a message to a provided topic)
    • PublishMessageRDF (Publish a message in RDF string to a provided topic)
    • SubscribeTopic (Subscribe to a provided topic and wait until message received or timeout and unsubscribe. Store the message received in knowledge base)
    • SubscribeTopicAlwaysListen (Subscribe to a provided topic and receive message asynchronously. Store the message received in knowledge base)
    • SubscribeTopicProduceEvent (Subscribe to a provided topic and fire an event on receiving message)
    • UnsubscribeTopic (Unsubscribe the subscribed topic)

Testing Environment:

Inorder to work with MQTT Publish and Subscribe, we need a working MQTT Broker setup. We could also use the CreateMQTTBroker provided here but it might be more convenient to set up our own MQTT Broker. To do so:

  • Install a MQTT Message Broker such as Mosquitto
  • Make sure you enter the path to mosquitto in envionmental variable for the following to work without any hassles.
  • Run the mosquitto broker via mosquitto -p <port-number>.
  • In Mosquitto publishing is done by mosquitto_pub -t "<your-topic>" -m "<your-message>" -r. The -r is used to retain message which is useful for testing. For further more info, please refer mosquitto_pub
  • In Mosquitto subscribing is done by mosquitto_sub -t "<your-topic>". For further more info, please refer mosquitto_sub