Valid XHTML 1.1

Bernhard Schiemann
KI Logo

How To

JADEOWLCodec

How To:

This Howto should help you step by step developing OWL-DL enabled Multi-Agent-Systems with JADE, RACER and the JadeOWLCodec.

  1. Download:

    Get the latest version of the JadeOWLCodec from here . On this website the links to RACER and the JDK needed, are given.

  2. Make the libraries available to your project:

    Add the .jar files from the JadeOWLCodec distribution zip to the classpath/build path of your project (e.g. eclipse). If some of the libs are already present, try first to remove the version that came with the JadeOWLCodec.

  3. Define an application ontology:

    We suggest that you use Protege-OWL for editing and RACER for validating. Your agents will need RACER at runtime too.

    Create an empty OWL DL ontology ("OWL RDF Files") and assign something like http://yourcompany.com/howto-ontology.owl as the URI of that ontology. Now add your first concept, e.g. "Dog", to start with something simple. Go to the properties tab, switch to datatype properties and create a "hasName" property, with "Dog" as the domain and string as the range of that property. If your new to the field of ontology design (formulation) please take a look at this tutorial.

  4. Generate wrapper classes:

    With RACER running (DIG mode is sufficient, this is by default running on port 8080 which therefore has to be free), start the wrapper generator. The wrapper generator is the class de.fau.cs.www8.jadeowlcodec.generator.WrapperGenerator. It takes a package name (e.g. "com.yourcompany.howto_ontology", the package prefix added together with a namespace prefix to the generated classes and also the path to the place where the generated files are put, converted into nested subfolders under "src/"), the adress (host:port) of the reasoner and an owl file (in our example: the path to your saved dog ontology) as arguments. We suggest using some tool from the IDE of your choice (example .launch files for eclipse included) to avoid manually setting the rather huge classpath definition needed to run the WrapperGenerator class.

  5. Write your first OWL enabled agent:

    import jade.core.Agent;
    import de.fau.cs.www8.jadeowlcodec.GenericIndividual;
    import de.fau.cs.www8.jadeowlcodec.KnowledgeBase;
    import de.fau.cs.www8.jadeowlcodec.tool.PlatformServices;
    import de.fau.cs.www8.jadeowlcodec.triplestore.Uri;
    
    import com.yourcompany.y.howto_ontology;
    
    public class DogAgent extends Agent {
        private KnowledgeBase kb = null;
    
    	@Override
    	protected void setup() {
    		super.setup();
    		PlatformServices.setReasoner("localhost", 8080); //the address of your running RACER instance 
    		this.kb = new KnowledgeBase(Uri.Other.instanceNotPretyped("http://" + this.getName().toString()+"/KB"));
    		
    		GenericIndividual dog = new GenericIndividual(kb.getABox(), null, Dog.Factory.instance.getUri()); // if the second argument is null a new URI will be created
    
    		Dog wrappedDog = Dog.Factory.wrap(dog);
    		wrappedDog.setYHas_name("Claire");
    	}
    	
    }
    

Further Information by email via: Bernhard Schiemann