Using library from JAVA code

There are three steps in order to make pattern-based ontology transformation.

//Optional using part-of-speech tagger
boolean POStagger=true;

//preparatory phase: initialization
OntologyPatternDetection detection = new OntologyPatternDetectionImpl();
String ontology="http://nb.vse.cz/~svabo/patomat/ontology/confOf-recursive.owl";
OntologyTransformation<OWLOntology> transformation = new OntologyTransformationImpl(ontology);
TransformationPattern tp1 = new TransformationPatternImpl("");
InstructionGenerator ig = new InstructionGeneratorImpl(tp1,POStagger);

//1st phase: pattern detection
//getting first item in the case of only one selection for transformation
String bindingPlaceholders = detection.queryPatternNamingAspect(tp1, ontology, false, true).get(0);

//2nd phase: instruction generation
ig.generateInstructions(bindingPlaceholders);
//in general generatedInstructions is additive operation
transformation.setInstructions(ig.exportInstructions());

//3rd phase: transformation of the ontology
transformation.transformOntology(TransformationStrategy.Conservative);
transformation.saveOntology("");

The ontology is saved in /tmp directory if ontology is on a remote host or as renamed variant of the ontology in the same directory.



ondrej 2011-06-21