use of org.semanticweb.owlapi.model.AddAxiom in project stanbol by apache.
the class ScopeSetRenderer method getScopes.
public static OWLOntology getScopes(Set<Scope> scopes) {
OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
OWLOntology ont = null;
try {
ont = mgr.createOntology();
} catch (OWLOntologyCreationException e) {
LoggerFactory.getLogger(ScopeSetRenderer.class).error("KReS :: could not create empty ontology for rendering scopes.", e);
return null;
}
List<OWLOntologyChange> additions = new LinkedList<OWLOntologyChange>();
// The ODP metadata vocabulary is always imported.
// TODO : also import the ONM meta when it goes online.
additions.add(new AddImport(ont, __factory.getOWLImportsDeclaration(IRI.create("http://www.ontologydesignpatterns.org/schemas/meta.owl"))));
for (Scope scope : scopes) {
OWLNamedIndividual iScope = __factory.getOWLNamedIndividual(IRI.create(scope.getDefaultNamespace() + scope.getID()));
OWLAxiom ax = __factory.getOWLClassAssertionAxiom(cScope, iScope);
additions.add(new AddAxiom(ont, ax));
}
mgr.applyChanges(additions);
return ont;
}
use of org.semanticweb.owlapi.model.AddAxiom in project stanbol by apache.
the class TestOntologySpaces method setup.
@BeforeClass
public static void setup() throws Exception {
factory = onManager.getOntologySpaceFactory();
if (factory == null)
fail("Could not instantiate ontology space factory");
OWLOntologyManager mgr = OWLOntologyManagerFactory.createOWLOntologyManager(onManager.getOfflineConfiguration().getOntologySourceLocations().toArray(new IRI[0]));
OWLDataFactory df = mgr.getOWLDataFactory();
ont = mgr.createOntology(baseIri);
inMemorySrc = new RootOntologySource(ont);
// Let's state that Linus is a human being
OWLClass cHuman = df.getOWLClass(IRI.create(baseIri + "/" + Constants.humanBeing));
OWLIndividual iLinus = df.getOWLNamedIndividual(IRI.create(baseIri + "/" + Constants.linus));
linusIsHuman = df.getOWLClassAssertionAxiom(cHuman, iLinus);
mgr.applyChange(new AddAxiom(ont, linusIsHuman));
ont2 = mgr.createOntology(baseIri2);
minorSrc = new RootOntologySource(ont2);
dropSrc = getLocalSource("/ontologies/droppedcharacters.owl", mgr);
nonexSrc = getLocalSource("/ontologies/nonexistentcharacters.owl", mgr);
minorSrc = new RootOntologySource(ont2);
}
Aggregations