Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLOntology


    }

    @Nonnull
    protected OWLOntology getOntologyWithMissingDeclarations()
            throws OWLOntologyCreationException {
        OWLOntology o = m.createOntology(IRI.create("urn:missingDeclarations"));
        OWLObjectProperty op = df
                .getOWLObjectProperty(iri("testObjectProperty"));
        OWLAnnotationProperty ap = df
                .getOWLAnnotationProperty(iri("testAnnotationProperty"));
        m.addAxiom(o, df.getOWLTransitiveObjectPropertyAxiom(op));
View Full Code Here


    }

    @Test
    public void shouldNotAddDeclarationsForIllegalPunnings()
            throws OWLOntologyCreationException, OWLOntologyStorageException {
        OWLOntology o = getOntologyWithPunnedInvalidDeclarations();
        OWLOntology reloaded = roundTrip(o, format);
        OWLAnnotationProperty ap = df
                .getOWLAnnotationProperty(iri("testProperty"));
        OWLDeclarationAxiom ax = df.getOWLDeclarationAxiom(ap);
        assertFalse("ap testProperty should not have been declared",
                reloaded.containsAxiom(ax));
    }
View Full Code Here

    }

    @Test
    public void shouldDeclareMissingEntities()
            throws OWLOntologyCreationException, OWLOntologyStorageException {
        OWLOntology o = getOntologyWithMissingDeclarations();
        OWLOntology reloaded = roundTrip(o, format);
        OWLObjectProperty op = df
                .getOWLObjectProperty(iri("testObjectProperty"));
        OWLAnnotationProperty ap = df
                .getOWLAnnotationProperty(iri("testAnnotationProperty"));
        assertTrue(reloaded.containsAxiom(df.getOWLDeclarationAxiom(ap)));
        assertTrue(reloaded.containsAxiom(df.getOWLDeclarationAxiom(op)));
    }
View Full Code Here

        // create minimal ontology
        OBODoc oboDocSource = parseOBOFile("roundtrip_cardinality.obo");
        // convert to OWL and retrieve def
        OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(
                OWLManager.createOWLOntologyManager());
        OWLOntology owlOntology = bridge.convert(oboDocSource);
        OWLDataFactory factory = owlOntology.getOWLOntologyManager()
                .getOWLDataFactory();
        OWLClass c = factory.getOWLClass(bridge.oboIdToIRI("PR:000027136"));
        // Relations
        boolean foundRel1 = false;
        boolean foundRel2 = false;
        Set<OWLSubClassOfAxiom> axioms = owlOntology
                .getSubClassAxiomsForSubClass(c);
        assertEquals(3, axioms.size());
        for (OWLSubClassOfAxiom axiom : axioms) {
            OWLClassExpression superClass = axiom.getSuperClass();
            if (superClass instanceof OWLObjectExactCardinality) {
View Full Code Here

@SuppressWarnings({ "javadoc", "null" })
public class DanglingRoundTripTest extends OboFormatTestBasics {

    @Test
    public void testConvertXPs() throws Exception {
        OWLOntology owlOnt = convertOBOFile("dangling_roundtrip_test.obo");
        OWLAPIOwl2Obo revbridge = new OWLAPIOwl2Obo(
                OWLManager.createOWLOntologyManager());
        OBODoc d2 = revbridge.convert(owlOnt);
        Frame f = d2.getTermFrame("UBERON:0000020");
        Clause rc = f.getClause(OboFormatTag.TAG_NAME);
View Full Code Here

        roundTripOBOFile("multiple_def_xref_test.obo", true);
    }

    @Test
    public void testDefinitions() {
        OWLOntology owlOnt = convertOBOFile("multiple_def_xref_test.obo");
        int n = 0;
        for (OWLAxiom ax : owlOnt.getAxioms()) {
            // System.out.println(ax);
            for (OWLAnnotation ann : ax.getAnnotations()) {
                OWLAnnotationProperty p = ann.getProperty();
                if (p.getIRI()
                        .equals(IRI
View Full Code Here

@SuppressWarnings("javadoc")
public class XrefIRITest extends OboFormatTestBasics {

    @Test
    public void testConversion() throws Exception {
        OWLOntology ontology = parseOWLFile("xrefIRItest.owl");
        OBODoc doc = convert(ontology);
        doc.getTermFrame("FOO:1");
        writeOBO(doc);
    }
View Full Code Here

        roundTripOBOFile("version_iri_test.obo", true);
    }

    @Test
    public void testConvert() {
        OWLOntology owlOnt = convertOBOFile("version_iri_test.obo");
        assertNotNull(owlOnt);
        IRI v = owlOnt.getOntologyID().getVersionIRI().get();
        assertEquals("http://purl.obolibrary.org/obo/go/2012-01-01/go.owl",
                v.toString());
    }
View Full Code Here

@SuppressWarnings("javadoc")
public class UntranslatableAxiomsInHeaderTest extends OboFormatTestBasics {

    @Test
    public void testUntranslatableAxioms() throws Exception {
        OWLOntology original = parseOWLFile("untranslatable_axioms.owl");
        OWLAPIOwl2Obo owl2Obo = new OWLAPIOwl2Obo(
                OWLManager.createOWLOntologyManager());
        OBODoc obo = owl2Obo.convert(original);
        renderOboToString(obo);
        Frame headerFrame = obo.getHeaderFrame();
        String owlAxiomString = headerFrame.getTagValue(
                OboFormatTag.TAG_OWL_AXIOMS, String.class);
        assertNotNull(owlAxiomString);
        OWLAPIObo2Owl obo2Owl = new OWLAPIObo2Owl(
                OWLManager.createOWLOntologyManager());
        OWLOntology converted = obo2Owl.convert(obo);
        Set<OWLEquivalentClassesAxiom> originalEqAxioms = original
                .getAxioms(AxiomType.EQUIVALENT_CLASSES);
        Set<OWLEquivalentClassesAxiom> convertedEqAxioms = converted
                .getAxioms(AxiomType.EQUIVALENT_CLASSES);
        assertEquals(originalEqAxioms.size(), convertedEqAxioms.size());
        assertTrue(originalEqAxioms.containsAll(convertedEqAxioms));
        assertTrue(convertedEqAxioms.containsAll(originalEqAxioms));
    }
View Full Code Here

        assertTrue(convertedEqAxioms.containsAll(originalEqAxioms));
    }

    @Test
    public void testUntranslatableAxioms2() throws Exception {
        OWLOntology original = parseOWLFile("untranslatable_axioms2.owl");
        OWLAPIOwl2Obo owl2Obo = new OWLAPIOwl2Obo(
                OWLManager.createOWLOntologyManager());
        OBODoc obo = owl2Obo.convert(original);
        renderOboToString(obo);
        Frame headerFrame = obo.getHeaderFrame();
        String owlAxiomString = headerFrame.getTagValue(
                OboFormatTag.TAG_OWL_AXIOMS, String.class);
        assertNotNull(owlAxiomString);
        OWLAPIObo2Owl obo2Owl = new OWLAPIObo2Owl(
                OWLManager.createOWLOntologyManager());
        OWLOntology converted = obo2Owl.convert(obo);
        Set<OWLEquivalentClassesAxiom> originalEqAxioms = original
                .getAxioms(AxiomType.EQUIVALENT_CLASSES);
        Set<OWLEquivalentClassesAxiom> convertedEqAxioms = converted
                .getAxioms(AxiomType.EQUIVALENT_CLASSES);
        assertEquals(originalEqAxioms.size(), convertedEqAxioms.size());
        assertTrue(originalEqAxioms.containsAll(convertedEqAxioms));
        assertTrue(convertedEqAxioms.containsAll(originalEqAxioms));
    }
View Full Code Here

TOP

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

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.