Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLOntologyManager.createOntology()


    public static void setup() {
        factory = onManager.getOntologyScopeFactory();
        if (factory == null) fail("Could not instantiate ontology space factory");
        OWLOntologyManager mgr = OWLOntologyManagerFactory.createOWLOntologyManager(null);
        try {
            src1 = new RootOntologySource(mgr.createOntology(baseIri), null);
            src2 = new RootOntologySource(mgr.createOntology(baseIri2), null);
        } catch (OWLOntologyCreationException e) {
            fail("Could not setup ontology with base IRI " + Constants.PEANUTS_MAIN_BASE);
        }
    }
View Full Code Here


        factory = onManager.getOntologyScopeFactory();
        if (factory == null) fail("Could not instantiate ontology space factory");
        OWLOntologyManager mgr = OWLOntologyManagerFactory.createOWLOntologyManager(null);
        try {
            src1 = new RootOntologySource(mgr.createOntology(baseIri), null);
            src2 = new RootOntologySource(mgr.createOntology(baseIri2), null);
        } catch (OWLOntologyCreationException e) {
            fail("Could not setup ontology with base IRI " + Constants.PEANUTS_MAIN_BASE);
        }
    }
View Full Code Here

        OWLOntologyManager mgr = OWLOntologyManagerFactory.createOWLOntologyManager(onManager
                .getOfflineConfiguration().getOntologySourceLocations().toArray(new IRI[0]));
        OWLDataFactory df = mgr.getOWLDataFactory();

        ont = mgr.createOntology(baseIri);
        inMemorySrc = new RootOntologySource(ont, null);
        // 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);
View Full Code Here

        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, null);
View Full Code Here

        }
        assertFalse(dummyiri.equals(mapper.getDocumentIRI(dummyiri)));

        // Create a new ontology in the test resources.
        OWLOntologyManager mgr = OWLOntologyManagerFactory.createOWLOntologyManager(null);
        OWLOntology o = mgr.createOntology(dummyiri);
        File f = new File(URI.create(url.toString() + "/dummycharacters.owl"));
        mgr.saveOntology(o, new WriterDocumentTarget(new FileWriter(f)));
        assertTrue(f.exists());

        ((AutoIRIMapper) mapper).update();
View Full Code Here

    public static OWLOntology getSessionMetadataRDFasOntology(Session session) {
        OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
        OWLOntology ont = null;
        try {
            ont = mgr.createOntology(IRI.create(session.getID() + "/meta.owl"));
        } catch (OWLOntologyCreationException e) {
            LoggerFactory.getLogger(ScopeSetRenderer.class).error(
                "KReS :: could not create empty ontology for rendering sesion metadata.", e);
            return null;
        }
View Full Code Here

                    log.error("Failed to merge imports for ontology.", e);
                    ont = null;
                }
            } else {
                // The root ontology ID is in the form [namespace][scopeId]
                ont = mgr.createOntology(IRI.create(getNamespace() + getID()));
                List<OWLOntologyChange> additions = new LinkedList<OWLOntologyChange>();
                // Add the import statement for the custom space, if existing and not empty
                OntologySpace spc = getCustomSpace();
                if (spc != null && spc.getOntologyCount(false) > 0) {
                    IRI spaceIri = IRI.create(getNamespace() + spc.getID());
View Full Code Here

        // Create a new ontology
        OWLOntology root;
        OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();
        IRI iri = IRI.create(namespace + _id);
        try {
            root = ontologyManager.createOntology(iri);
        } catch (OWLOntologyAlreadyExistsException e) {
            // It should be impossible, but just in case.
            ontologyManager.removeOntology(ontologyManager.getOntology(iri));
            try {
                root = ontologyManager.createOntology(iri);
View Full Code Here

            root = ontologyManager.createOntology(iri);
        } catch (OWLOntologyAlreadyExistsException e) {
            // It should be impossible, but just in case.
            ontologyManager.removeOntology(ontologyManager.getOntology(iri));
            try {
                root = ontologyManager.createOntology(iri);
            } catch (OWLOntologyAlreadyExistsException e1) {
                root = ontologyManager.getOntology(iri);
            } catch (OWLOntologyCreationException e1) {
                log.error("Failed to assemble root ontology for scope " + iri, e);
                root = null;
View Full Code Here

        OWLDataFactory df = ontMgr.getOWLDataFactory();
        OWLClass cSession = df.getOWLClass(IRI.create("http://stanbol.apache.org/ontologies/meta/Session"));

        OWLOntology o;
        try {
            o = ontMgr.createOntology(IRI.create(uriInfo.getRequestUri()));
            List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
            for (String id : sessionManager.getRegisteredSessionIDs()) {
                IRI sessionid = IRI.create(sessionManager.getNamespace() + sessionManager.getID() + "/" + id);
                OWLNamedIndividual ind = df.getOWLNamedIndividual(sessionid);
                changes.add(new AddAxiom(o, df.getOWLClassAssertionAxiom(cSession, ind)));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.