Whenever you use generated Kazuki classes you must include the Kazuki jar file in you classpath along with the Jena 2.1 jar files. This can be done easily using Classpath Containers provided by the SWeDE.
To modify the classpath, right click on the project and click on Properties. Click on Java Build Path and then view the Libraries tab.

Click on the Add Library... button and select Jena Libraries from the list. Click on Next > and then Finish.

Repeat this procedure for the Kazuki Library, then click OK to update your classpath. Package explorer should now list both classpath containers under your project.

Before you can use the Kazuki classes you must register the classes with Jena. You can easily do this by calling the static registerAll() method of the Registrar class. This class was generated by Kazuki and located in the base folder.
Registrar.registerAll();
To create a new instance file using Kazuki:
OntModel model = ModelFactory.createOntologyModel();
Because the instances will be using existing ontologies, you need to import the referenced ontologies into your model. To do this you need to generate an Ontology object for your instance file. This requires the default namespace or URL of the instance file.
Ontology ont = model.createOntology(sBase);
Now you should import the ontology files you are using into the model. The Kazuki Registrar class has a static method called registerImports that will do this for all the ontologies used in the generation of the Kazuki interface. It takes as input the model and the Ontology instance.
Registrar.registerImports(model, ont);
To create a new instance of a class use the create method on the Kazuki interface class. Please provide the uri of your instance.
Dog woofer = Dog.create(base+"#woofer", model);
Now you can add properties to your instance.
woofer.setName("Woofer");
woofer.addColor("Brown");
woofer.addColor("White");
woofer.setAge(3);
To save your instance file you write out your model.
model.write(new FileOutputStream(file));
When you load an existing instance file into an OntModel any imported ontologies will be loaded. Unless the file didn't previously import the needed ontologies, you do not need to call registerImports().
OntModel model = ModelFactory.createOntologyModel();
model.read(base);
Using the Jena method getResource() you can get a specific instance from your model by uri. You will need to "cast" the returned Resource to a Dog object using the as() method.
Dog dog = (Dog)model.getResource(base+"#woofer").as(Dog.class);
Now you can access the properties of your instance.
System.out.println("Dog named " + dog.getName());
ExtendedIterator i = dog.listColor();
while (i.hasNext()) System.out.println((String)i.next());
![]()
API Generation
Kazuki Interface Design
![]()
Generating API's
Kazuki Interfaces