Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.SetOntologyID


                // if the ontology being read has a differet id from the one
                // that was passed in, update it
                // when parsing, the original ontology is likely an anonymous,
                // empty one
                if (!oid.equals(in.getOntologyID())) {
                    manager.applyChange(new SetOntologyID(in, oid));
                }
            } else {
                // if the ontology being read has a differet id from the one
                // that was passed in, update it
                // when parsing, the original ontology is likely an anonymous,
                // empty one
                if (!ontIRI
                        .equals(in.getOntologyID().getOntologyIRI().orNull())) {
                    manager.applyChange(new SetOntologyID(in,
                            new OWLOntologyID(Optional.of(ontIRI), Optional
                                    .<IRI> absent())));
                }
            }
        } else {
            defaultIDSpace = "TEMP";
            manager.applyChange(new SetOntologyID(in,
                    new OWLOntologyID(Optional.of(IRI.create(DEFAULT_IRI_PREFIX
                            + defaultIDSpace)), Optional.<IRI> absent())));
            // TODO - warn
        }
        trHeaderFrame(hf);
View Full Code Here


        changes.addAll(imports);
        changes.addAll(ontologyAnnotations);
        for (OntologyAxiomPair pair : axioms) {
            changes.add(new AddAxiom(ont, pair.getAxiom()));
        }
        changes.add(new SetOntologyID(ont, ontologyID));
        ont.getOWLOntologyManager().applyChanges(changes);
        ManchesterSyntaxDocumentFormat format = new ManchesterSyntaxDocumentFormat();
        format.copyPrefixesFrom(pm);
        return format;
    }
View Full Code Here

    @SuppressWarnings("null")
    @Override
    public List<OWLOntologyChange> repair() {
        // XXX arbitrary replacement
        return list(new SetOntologyID(ontology, new OWLOntologyID(
                Optional.of(IRI.create("urn:ontology#renamed")),
                Optional.of(IRI.create("urn:ontology#renamed1")))));
    }
View Full Code Here

    }

    @Override
    public List<OWLOntologyChange> repair() {
        // XXX arbitrary choice
        return list(new SetOntologyID(ontology,
                IRI.create("urn:ontology#replaced")));
    }
View Full Code Here

    }

    @Override
    public List<OWLOntologyChange> repair() {
        // XXX arbitrary replacement
        return list(new SetOntologyID(ontology,
                IRI.create("urn:ontology#renamed")));
    }
View Full Code Here

        OWLOntology onto = m.createOntology(ontologyAIRI);
        m.addAxiom(onto,
                df.getOWLDeclarationAxiom(Class(IRI("urn:test:testclass"))));
        IRI ontologyBIRI = IRI("http://www.semanticweb.org/ontologies/ontologyB");
        OWLOntology ontologyB = m.createOntology(ontologyBIRI);
        m.applyChange(new SetOntologyID(ontologyB, new OWLOntologyID(
                of(ontologyAIRI), absent())));
    }
View Full Code Here

    @SuppressWarnings("null")
    @Nonnull
    public List<OWLOntologyChange> getChanges(@Nonnull OWLOntology ontology,
            @Nonnull IRI newIRI) {
        List<OWLOntologyChange> changes = new ArrayList<>();
        changes.add(new SetOntologyID(ontology, new OWLOntologyID(Optional
                .of(newIRI), ontology.getOntologyID().getVersionIRI())));
        for (OWLOntology ont : owlOntologyManager.getOntologies()) {
            assert ont != null;
            for (OWLImportsDeclaration decl : ont.getImportsDeclarations()) {
                if (decl.getIRI().equals(
View Full Code Here

        }
    }

    private void checkForOntologyIDChange(OWLOntologyChange change) {
        if (change instanceof SetOntologyID) {
            SetOntologyID setID = (SetOntologyID) change;
            OWLOntology existingOntology = ontologiesByID
                    .get(((SetOntologyID) change).getNewOntologyID());
            if (existingOntology != null
                    && !change.getOntology().equals(existingOntology)) {
                if (!change.getOntology().getAxioms()
                        .equals(existingOntology.getAxioms())) {
                    LOGGER.error(
                            "OWLOntologyManagerImpl.checkForOntologyIDChange() existing:{}",
                            existingOntology);
                    LOGGER.error(
                            "OWLOntologyManagerImpl.checkForOntologyIDChange() new:{}",
                            change.getOntology());
                    throw new OWLOntologyRenameException(
                            change.getChangeData(),
                            ((SetOntologyID) change).getNewOntologyID());
                }
            }
            renameOntology(setID.getOriginalOntologyID(),
                    setID.getNewOntologyID());
            resetImportsClosureCache();
        }
    }
View Full Code Here

    }

    @Test
    public void testCreateOntologyChange() {
        SetOntologyIDData data = createData();
        SetOntologyID change = data.createOntologyChange(mockOntology);
        assertEquals(mockOntology, change.getOntology());
        assertEquals(mockOntologyID, change.getNewOntologyID());
    }
View Full Code Here

    }

    @Test
    public void testOntologyChangeSymmetry() {
        SetOntologyIDData data = createData();
        SetOntologyID change = new SetOntologyID(mockOntology, mockOntologyID);
        assertEquals(change.getChangeData(), data);
    }
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.model.SetOntologyID

Copyright © 2018 www.massapicom. 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.