Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLOntologyID


    @Test(expected = OWLOntologyAlreadyExistsException.class)
    public void testCreateDuplicateOntologyWithIRIAndVersionIRI()
            throws OWLOntologyCreationException {
        IRI ontologyIRI = IRI("http://www.semanticweb.org/ontologies/ontology");
        IRI versionIRI = IRI("http://www.semanticweb.org/ontologies/ontology");
        m.createOntology(new OWLOntologyID(of(ontologyIRI), of(versionIRI)));
        m.createOntology(new OWLOntologyID(of(ontologyIRI), of(versionIRI)));
    }
View Full Code Here


        IRI ontologyIRI = IRI("http://www.semanticweb.org/ontologies/ontology");
        IRI ontologyIRI2 = IRI("http://www.semanticweb.org/ontologies/ontology2");
        IRI documentIRI = IRI("file:documentIRI");
        m.getIRIMappers().add(new SimpleIRIMapper(ontologyIRI, documentIRI));
        m.getIRIMappers().add(new SimpleIRIMapper(ontologyIRI2, documentIRI));
        m.createOntology(new OWLOntologyID(of(ontologyIRI), of((IRI) null)));
        m.createOntology(new OWLOntologyID(of(ontologyIRI2), of((IRI) null)));
    }
View Full Code Here

    @Test
    public void shouldFindSameHashCodeForIDs() {
        IRI iri1 = IRI(TEST_ONTOLOGY_IRI_STRING);
        IRI iri2 = IRI(TEST_ONTOLOGY_IRI_STRING);
        assertEquals(iri1.hashCode(), iri2.hashCode());
        OWLOntologyID id1 = new OWLOntologyID(of(iri1), absent());
        OWLOntologyID id2 = new OWLOntologyID(of(iri2), absent());
        assertEquals(id1.hashCode(), id2.hashCode());
    }
View Full Code Here

    @Test
    public void shouldFindSameHashCodeForIDs2() {
        IRI iri1 = IRI(TEST_ONTOLOGY_IRI_STRING);
        IRI iri2 = IRI(TEST_ONTOLOGY_IRI_STRING);
        assertEquals(iri1.hashCode(), iri2.hashCode());
        OWLOntologyID id1 = new OWLOntologyID(of(iri1), absent());
        OWLOntologyID id2 = new OWLOntologyID(of(iri2), absent());
        assertEquals(id1.hashCode(), id2.hashCode());
        assertEquals(id1, id2);
    }
View Full Code Here

        assertEquals(id1, id2);
    }

    @Test
    public void testUnequalIdsUnequal() {
        OWLOntologyID id1 = new OWLOntologyID(of(IRI("http://www.w3.org/foo")),
                absent());
        OWLOntologyID id2 = new OWLOntologyID(of(IRI("http://www.w3.org/bar")),
                absent());
        assertNotEquals(id1.hashCode(), id2.hashCode());
        assertNotEquals(id1, id2);
    }
View Full Code Here

    public void testVersionedIDComparisons() {
        IRI iri1 = IRI(TEST_ONTOLOGY_IRI_STRING);
        IRI iri2 = IRI(TEST_ONTOLOGY_IRI_STRING);
        assertEquals(iri1.hashCode(), iri2.hashCode());
        assertEquals(iri1, iri2);
        OWLOntologyID unversionedID = new OWLOntologyID(of(iri1), absent());
        String version1IRIString = TEST_ONTOLOGY_IRI_STRING + "/version1";
        IRI version1IRI = IRI(version1IRIString);
        OWLOntologyID version1ID = new OWLOntologyID(of(iri2), of(version1IRI));
        assertEquals("null vs v1 base IRIs", unversionedID.getOntologyIRI(),
                version1ID.getOntologyIRI());
        assertNotEquals(unversionedID.getVersionIRI(),
                version1ID.getVersionIRI());
        assertNotEquals("null version vs version1", unversionedID.hashCode(),
                version1ID.hashCode());
        assertNotEquals("null version vs version1", unversionedID, version1ID);
        OWLOntologyID duplicateVersion1ID = new OWLOntologyID(
                of(IRI(TEST_ONTOLOGY_IRI_STRING)), of(IRI(version1IRIString)));
        assertEquals(" two version1 ids", version1ID, duplicateVersion1ID);
        OWLOntologyID differentBasedVersion1ID = new OWLOntologyID(
                of(IRI(TEST_ONTOLOGY_IRI_STRING + "-of-doom")),
                of(IRI(version1IRIString)));
        assertNotEquals("version1 of two base IRIs", version1ID,
                differentBasedVersion1ID);
        IRI version2IRI = IRI(TEST_ONTOLOGY_IRI_STRING + "/version2");
        IRI iri3 = IRI(TEST_ONTOLOGY_IRI_STRING);
        OWLOntologyID version2ID = new OWLOntologyID(of(iri3), of(version2IRI));
        assertNotEquals("version1 vs version2", version1ID.hashCode(),
                version2ID.hashCode());
        assertNotEquals("version1 vs version2", version1ID, version2ID);
    }
View Full Code Here

    @Test
    public void testCreateOntologyChangeEquals()
            throws OWLOntologyCreationException {
        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
        OWLOntology ontology = manager.createOntology();
        OWLOntologyID ontologyID = ontology.getOntologyID();
        AddAxiomData addAxiomData = new AddAxiomData(mockAxiom);
        OWLOntologyChangeRecord changeRecord = new OWLOntologyChangeRecord(
                ontologyID, addAxiomData);
        OWLOntologyChange change = changeRecord.createOntologyChange(manager);
        assertNotNull(change);
View Full Code Here

        return result;
    }

    @Override
    public OWLOntology getOntology(IRI ontologyIRI) {
        OWLOntologyID ontologyID = new OWLOntologyID(of(ontologyIRI),
                of((IRI) null));
        OWLOntology result = ontologiesByID.get(ontologyID);
        if (result == null) {
            for (OWLOntologyID nextOntologyID : ontologiesByID.keySet()) {
                if (ontologyIRI.equals(nextOntologyID.getVersionIRI().orNull())
View Full Code Here

    }

    @Nullable
    @Override
    public OWLOntology getImportedOntology(OWLImportsDeclaration declaration) {
        OWLOntologyID ontologyID = ontologyIDsByImportsDeclaration
                .get(declaration);
        if (ontologyID == null) {
            // No such ontology has been loaded through an import declaration,
            // but it might have been loaded manually.
            // Using the IRI to retrieve it will either find the ontology or
View Full Code Here

    }

    @Override
    public void setOntologyFormat(OWLOntology ontology,
            OWLDocumentFormat ontologyFormat) {
        OWLOntologyID ontologyID = ontology.getOntologyID();
        ontologyFormatsByOntology.put(ontologyID, ontologyFormat);
    }
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.