Menu

Home

redmitry

The library doesn't provide too much flexibility.
There are two important classes:

OWLOntologyModel the class that encapsulates OWL ontology and provides a bunch of resoning operations on it.
XmlSchemaGenerator the class that generates XML Schema from the model.

XmlSchemaGenerator intents to separate XML Schemas by ontologies namespaces.
This way there can be many XML Schemas generated from an ontology.
This is the reason why XmlSchemaGenerator's write() method accepts a ZipOutputStream. It just writes all generated XML Schemas into it.

Here is an example of library usage:

OWLOntologyModel model = OWLOntologyFactory.newInstance().getOWLOntologyModel();
model.load("file:///ontology.owl");
XmlSchemaGenerator generator = new XmlSchemaGenerator(model, true /*useLocalElements*/, true /*useAttribute*/);
FileOutputStream out = new FileOutputStream("file:///schemas.zip");        
try {
    ZipOutputStream zip = new ZipOutputStream(out);        
    try {
        generator.write(zip); 
    } finally {
        zip.flush(); 
        zip.close();
    }
} finally {
    out.close();
}