Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLOntologyID


            Clause dvclause = hf.getClause(OboFormatTag.TAG_DATA_VERSION);
            if (dvclause != null) {
                String dv = dvclause.getValue().toString();
                IRI vIRI = IRI.create(DEFAULT_IRI_PREFIX + ontOboId + '/' + dv
                        + '/' + ontOboId + ".owl");
                OWLOntologyID oid = new OWLOntologyID(Optional.of(ontIRI),
                        Optional.of(vIRI));
                // 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);
        for (Frame f : obodoc.getTypedefFrames()) {
View Full Code Here


    @Override
    public ManchesterSyntaxDocumentFormat
            parseOntology(@Nonnull OWLOntology ont) {
        Set<OntologyAxiomPair> axioms = new HashSet<>();
        OWLOntologyID ontologyID = new OWLOntologyID();
        Set<AddImport> imports = new HashSet<>();
        Set<AddOntologyAnnotation> ontologyAnnotations = new HashSet<>();
        defaultOntology = ont;
        processDeclaredEntities();
        while (true) {
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

public class OWLOntologyChangeRecordTest {

    @SuppressWarnings("null")
    @Test
    public void testSerializeChangeRecord() throws Exception {
        OWLOntologyID id1 = new OWLOntologyID(Optional.of(IRI.create("urn:a")),
                Optional.of(IRI.create("urn:v1")));
        OWLOntologyID id2 = new OWLOntologyID(Optional.of(IRI.create("urn:a")),
                Optional.of(IRI.create("urn:v2")));
        OWLOntologyChangeRecord idChangeRecord = new OWLOntologyChangeRecord(
                id1, new SetOntologyIDData(id2));
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(byteArrayOutputStream);
View Full Code Here

            }
        }

        @Override
        public void visit(OWLOntology ontology) {
            OWLOntologyID ontologyID = ontology.getOntologyID();
            if (!ontologyID.isAnonymous()) {
                if (ontologyID.getOntologyIRI().get().isReservedVocabulary()) {
                    profileViolations
                            .add(new UseOfReservedVocabularyForOntologyIRI(
                                    getCurrentOntology()));
                }
                Optional<IRI> versionIRI = ontologyID.getVersionIRI();
                if (versionIRI.isPresent()) {
                    if (versionIRI.get().isReservedVocabulary()) {
                        profileViolations
                                .add(new UseOfReservedVocabularyForVersionIRI(
                                        getCurrentOntology()));
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

     * @param ont
     *        ontology to use
     * @return short form of the ontology IRI
     */
    public String getShortForm(OWLOntology ont) {
        OWLOntologyID ontologyID = ont.getOntologyID();
        if (ontologyID.getOntologyIRI().isPresent()) {
            return getShortForm(verifyNotNull(ontologyID.getOntologyIRI().get()));
        } else {
            return ontologyID.toString();
        }
    }
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

    @Test
    public void testCreateOntologyWithIRIAndVersionIRI()
            throws OWLOntologyCreationException {
        IRI ontologyIRI = IRI("http://www.semanticweb.org/ontologies/ontology");
        IRI versionIRI = IRI("http://www.semanticweb.org/ontologies/ontology/version");
        OWLOntology ontology = m.createOntology(new OWLOntologyID(
                of(ontologyIRI), of(versionIRI)));
        assertNotNull("ontology should not be null", ontology);
        assertNotNull("ontology id should not be null",
                ontology.getOntologyID());
        assertEquals(versionIRI, ontology.getOntologyID()
View Full Code Here

        IRI ontologyIRI = IRI("http://www.semanticweb.org/ontologies/ontology");
        IRI versionIRI = IRI("http://www.semanticweb.org/ontologies/ontology/version");
        IRI documentIRI = IRI("file:documentIRI");
        SimpleIRIMapper mapper = new SimpleIRIMapper(versionIRI, documentIRI);
        m.getIRIMappers().add(mapper);
        OWLOntology ontology = m.createOntology(new OWLOntologyID(
                of(ontologyIRI), of(versionIRI)));
        assertNotNull("ontology should not be null", ontology);
        assertNotNull("ontology id should not be null",
                ontology.getOntologyID());
        assertEquals(versionIRI, ontology.getOntologyID()
View Full Code Here

TOP

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

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.