Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLOntologyManager


@SuppressWarnings("javadoc")
public class OWLOntologyToStringTestCase {

    @Test
    public void testNamedOntologyToString() throws OWLOntologyCreationException {
        OWLOntologyManager man = OWLManager.createOWLOntologyManager();
        IRI ontIRI = IRI("http://owlapi.sourceforge.net/ont");
        OWLOntology ont = man.createOntology(ontIRI);
        String s = ont.toString();
        String expected = "Ontology(" + ont.getOntologyID() + ") [Axioms: "
                + ont.getAxiomCount() + " Logical Axioms: "
                + ont.getLogicalAxiomCount() + "] First 20 axioms: {}";
        assertEquals(expected, s);
View Full Code Here


    @Nonnull
    private static final IRI ONTOLOGY_IRI = IRI("http://test.com/ont");

    private static OWLOntologyManager createManager() {
        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
        manager.getIRIMappers().clear();
        return manager;
    }
View Full Code Here

        return manager;
    }

    @Test
    public void testCreateOntologyWithIRI() throws OWLOntologyCreationException {
        OWLOntologyManager manager = createManager();
        OWLOntology ontology = manager.createOntology(ONTOLOGY_IRI);
        assertEquals(ONTOLOGY_IRI, ontology.getOntologyID().getOntologyIRI()
                .get());
        assertEquals(ONTOLOGY_IRI, manager.getOntologyDocumentIRI(ontology));
    }
View Full Code Here

    }

    @Test
    public void testCreateOntologyWithAxioms()
            throws OWLOntologyCreationException {
        OWLOntologyManager manager = createManager();
        OWLOntology ontology = manager.createOntology(new HashSet<OWLAxiom>());
        assertNotNull("ontology should not be null",
                manager.getOntologyDocumentIRI(ontology));
    }
View Full Code Here

    }

    @Test
    public void testCreateOntologyWithAxiomsAndIRI()
            throws OWLOntologyCreationException {
        OWLOntologyManager manager = createManager();
        OWLOntology ontology = manager.createOntology(new HashSet<OWLAxiom>(),
                ONTOLOGY_IRI);
        assertEquals(ONTOLOGY_IRI, ontology.getOntologyID().getOntologyIRI()
                .get());
        assertEquals(ONTOLOGY_IRI, manager.getOntologyDocumentIRI(ontology));
    }
View Full Code Here

    }

    @Test
    public void testCreateOntologyWithIdWithVersionIRI()
            throws OWLOntologyCreationException {
        OWLOntologyManager manager = createManager();
        IRI versionIRI = IRI("http://version/1");
        OWLOntologyID id = new OWLOntologyID(of(ONTOLOGY_IRI), of(versionIRI));
        OWLOntology ontology = manager.createOntology(id);
        assertEquals(ONTOLOGY_IRI, ontology.getOntologyID().getOntologyIRI()
                .get());
        assertEquals(versionIRI, ontology.getOntologyID().getVersionIRI().get());
        assertEquals(versionIRI, manager.getOntologyDocumentIRI(ontology));
    }
View Full Code Here

        assertEquals(versionIRI, manager.getOntologyDocumentIRI(ontology));
    }

    @Test
    public void testCreateOntologyWithId() throws OWLOntologyCreationException {
        OWLOntologyManager manager = createManager();
        OWLOntologyID id = new OWLOntologyID(of(ONTOLOGY_IRI), absent());
        OWLOntology ontology = manager.createOntology(id);
        assertEquals(ONTOLOGY_IRI, ontology.getOntologyID().getOntologyIRI()
                .get());
        assertEquals(ONTOLOGY_IRI, manager.getOntologyDocumentIRI(ontology));
    }
View Full Code Here

    public void testSubClassOfAxiomAccessors() {
        OWLOntology ont = getOWLOntology("ont");
        OWLClass clsA = Class(iri("A"));
        OWLClass clsB = Class(iri("B"));
        OWLObjectProperty prop = ObjectProperty(iri("prop"));
        OWLOntologyManager man = ont.getOWLOntologyManager();
        OWLSubClassOfAxiom ax = SubClassOf(clsA, clsB);
        man.addAxiom(ont, ax);
        OWLSubClassOfAxiom ax2 = SubClassOf(clsA,
                ObjectSomeValuesFrom(prop, clsB));
        man.addAxiom(ont, ax2);
        performAxiomTests(ont, ax, ax2);
        assertTrue(ont.getSubClassAxiomsForSubClass(clsA).contains(ax));
        assertTrue(ont.getSubClassAxiomsForSuperClass(clsB).contains(ax));
        assertTrue(ont.getAxioms(clsA, EXCLUDED).contains(ax));
        assertTrue(sup(ont.filterAxioms(subClassWithSub, clsA, INCLUDED))
View Full Code Here

        OWLClass clsA = Class(iri("A"));
        OWLClass clsB = Class(iri("B"));
        OWLClass clsC = Class(iri("C"));
        OWLClass clsD = Class(iri("D"));
        OWLObjectProperty prop = ObjectProperty(iri("prop"));
        OWLOntologyManager man = ont.getOWLOntologyManager();
        OWLEquivalentClassesAxiom ax = EquivalentClasses(clsA, clsB, clsC,
                ObjectSomeValuesFrom(prop, clsD));
        man.addAxiom(ont, ax);
        performAxiomTests(ont, ax);
        assertTrue(ont.getEquivalentClassesAxioms(clsA).contains(ax));
        assertTrue(ont.getEquivalentClassesAxioms(clsB).contains(ax));
        assertTrue(ont.getEquivalentClassesAxioms(clsC).contains(ax));
        assertTrue(ont.getAxioms(clsA, EXCLUDED).contains(ax));
View Full Code Here

        OWLClass clsA = Class(iri("A"));
        OWLClass clsB = Class(iri("B"));
        OWLClass clsC = Class(iri("C"));
        OWLClass clsD = Class(iri("D"));
        OWLObjectProperty prop = ObjectProperty(iri("prop"));
        OWLOntologyManager man = ont.getOWLOntologyManager();
        OWLDisjointClassesAxiom ax = DisjointClasses(clsA, clsB, clsC,
                ObjectSomeValuesFrom(prop, clsD));
        man.addAxiom(ont, ax);
        performAxiomTests(ont, ax);
        assertTrue(ont.getDisjointClassesAxioms(clsA).contains(ax));
        assertTrue(ont.getDisjointClassesAxioms(clsB).contains(ax));
        assertTrue(ont.getDisjointClassesAxioms(clsC).contains(ax));
        assertTrue(ont.getAxioms(clsA, EXCLUDED).contains(ax));
View Full Code Here

TOP

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

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.