All Downloads are FREE. Search and download functionalities are using the official Maven repository.

protege.code-generation.2.0.0.source-code.factory.header Maven / Gradle / Ivy

Go to download

Generate Java code from an OWL ontology in the Protege Desktop editing environment.

The newest version!
package ${factoryPackage};

import ${package}.impl.*;
${factoryExtraImport}

import java.util.Collection;

import org.protege.owl.codegeneration.CodeGenerationFactory;
import org.protege.owl.codegeneration.WrappedIndividual;
import org.protege.owl.codegeneration.impl.FactoryHelper;
import org.protege.owl.codegeneration.impl.ProtegeJavaMapping;
import org.protege.owl.codegeneration.inference.CodeGenerationInference;
import org.protege.owl.codegeneration.inference.SimpleInference;

import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyStorageException;

/**
 * A class that serves as the entry point to the generated code providing access
 * to existing individuals in the ontology and the ability to create new individuals in the ontology.

* * Generated by Protege (http://protege.stanford.edu).
* Source Class: ${factoryClass}
* @version generated on ${date} by ${user} */ public class ${factoryClass} implements CodeGenerationFactory { private OWLOntology ontology; private ProtegeJavaMapping javaMapping = new ProtegeJavaMapping(); private FactoryHelper delegate; private CodeGenerationInference inference; public ${factoryClass}(OWLOntology ontology) { this(ontology, new SimpleInference(ontology)); } public ${factoryClass}(OWLOntology ontology, CodeGenerationInference inference) { this.ontology = ontology; this.inference = inference; javaMapping.initialize(ontology, inference); delegate = new FactoryHelper(ontology, inference); } public OWLOntology getOwlOntology() { return ontology; } public void saveOwlOntology() throws OWLOntologyStorageException { ontology.getOWLOntologyManager().saveOntology(ontology); } public void flushOwlReasoner() { delegate.flushOwlReasoner(); } public boolean canAs(WrappedIndividual resource, Class javaInterface) { return javaMapping.canAs(resource, javaInterface); } public X as(WrappedIndividual resource, Class javaInterface) { return javaMapping.as(resource, javaInterface); } public Class getJavaInterfaceFromOwlClass(OWLClass cls) { return javaMapping.getJavaInterfaceFromOwlClass(cls); } public OWLClass getOwlClassFromJavaInterface(Class javaInterface) { return javaMapping.getOwlClassFromJavaInterface(javaInterface); } public CodeGenerationInference getInference() { return inference; }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy