Examples of OWLOntology


Examples of org.semanticweb.owlapi.model.OWLOntology

@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

Examples of org.semanticweb.owlapi.model.OWLOntology

        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

Examples of org.semanticweb.owlapi.model.OWLOntology

public class RoundTripOboAnnotations extends RoundTripTest {

    @Test
    public void testIsInferredAnnotation() throws Exception {
        OBODoc input = parseOBOFile("is_inferred_annotation.obo");
        OWLOntology owl = convert(input);
        // check round trip
        OBODoc output = convert(owl);
        String outObo = renderOboToString(output);
        assertEquals(readResource("is_inferred_annotation.obo"), outObo);
        // check owl
        IRI t1 = IRI.create("http://purl.obolibrary.org/obo/TEST_0001");
        IRI t3 = IRI.create("http://purl.obolibrary.org/obo/TEST_0003");
        IRI isInferredIRI = IRI.create(Obo2OWLConstants.OIOVOCAB_IRI_PREFIX,
                "is_inferred");
        boolean hasAnnotation = false;
        Set<OWLSubClassOfAxiom> axioms = owl.getAxioms(AxiomType.SUBCLASS_OF);
        for (OWLSubClassOfAxiom axiom : axioms) {
            OWLClassExpression superClassCE = axiom.getSuperClass();
            OWLClassExpression subClassCE = axiom.getSubClass();
            if (!superClassCE.isAnonymous() && !subClassCE.isAnonymous()) {
                OWLClass superClass = (OWLClass) superClassCE;
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLOntology

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

    @Test
    public void testConvertCARO() {
        OWLOntology owlOnt = convertOBOFile("caro.obo");
        assertNotNull(owlOnt);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLOntology

        assertNotNull(owlOnt);
    }

    @Test
    public void testConvertXPWithQV() {
        OWLOntology owlOnt = convertOBOFile("testqvs.obo");
        assertNotNull(owlOnt);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLOntology

    }

    @Test
    public void testWriteReadConvertedOWL() throws Exception {
        OBODoc oboDoc = parseOBOFile("namespace-id-rule.obo");
        OWLOntology owlOntology = convert(oboDoc);
        OWLOntologyManager manager = owlOntology.getOWLOntologyManager();
        StringDocumentTarget documentTarget = new StringDocumentTarget();
        manager.saveOntology(owlOntology, new OWLXMLDocumentFormat(),
                documentTarget);
        String owlString = documentTarget.toString();
        OWLOntologyDocumentSource documentSource = new StringDocumentSource(
                owlString);
        OWLOntology reloadedOwl = OWLManager.createOWLOntologyManager()
                .loadOntologyFromOntologyDocument(documentSource);
        assertEquals(owlOntology.getAxiomCount(), reloadedOwl.getAxiomCount());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLOntology

public class TransitiveOverTest extends RoundTripTest {

    @Test
    public void testConvert() {
        // PARSE TEST FILE, CONVERT TO OWL
        OWLOntology ontology = convert(parseOBOFile("relation_shorthand_test.obo"));
        // TEST CONTENTS OF OWL ONTOLOGY
        IRI regulatesIRI = getIriByLabel(ontology, "regulates");
        assertNotNull(regulatesIRI);
        boolean ok = false;
        // test that transitive over is translated to a property chain
        Set<OWLSubPropertyChainOfAxiom> axioms = ontology
                .getAxioms(AxiomType.SUB_PROPERTY_CHAIN_OF);
        for (OWLSubPropertyChainOfAxiom axiom : axioms) {
            OWLObjectProperty p = (OWLObjectProperty) axiom.getSuperProperty();
            if (regulatesIRI.equals(p.getIRI())) {
                List<OWLObjectPropertyExpression> chain = axiom
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLOntology

    @Test
    public void testConvert() throws Exception {
        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
        String input = "Prefix(:=<http://www.example.org/#>)\nOntology(<http://example.org/>\nSubClassOf(:a :b) )";
        StringDocumentSource source = new StringDocumentSource(input);
        OWLOntology origOnt = manager.loadOntologyFromOntologyDocument(source);
        assertNotNull(origOnt);
        assertEquals(1, manager.getOntologies().size());
        assertFalse(origOnt.getOntologyID().getVersionIRI().isPresent());
        assertTrue(origOnt.getAxiomCount() > 0);
        Optional<IRI> ontologyIRI = origOnt.getOntologyID().getOntologyIRI();
        assertTrue(ontologyIRI.isPresent());
        OWLOntology newOnt = manager.getOntology(ontologyIRI.get());
        assertNotNull(newOnt);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLOntology

                        "Sequential hermaphroditic organism that produces\ngametes first of the male sex, and then later of the\nfemale sex."));
        oboDocSource.addTermFrame(sourceFrame);
        // convert to OWL and retrieve def
        OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(
                OWLManager.createOWLOntologyManager());
        OWLOntology owlOntology = bridge.convert(oboDocSource);
        OWLDataFactory factory = owlOntology.getOWLOntologyManager()
                .getOWLDataFactory();
        // IRI
        IRI iri = bridge.oboIdToIRI("CARO:0000049");
        OWLClass c = factory.getOWLClass(iri);
        // Def
        OWLAnnotationProperty defProperty = factory
                .getOWLAnnotationProperty(Obo2OWLVocabulary.IRI_IAO_0000115
                        .getIRI());
        int counter = 0;
        for (OWLAnnotationAssertionAxiom ax : owlOntology
                .getAnnotationAssertionAxioms(c.getIRI())) {
            if (ax.getProperty().equals(defProperty)) {
                counter++;
                assertTrue(ax.getValue() instanceof OWLLiteral);
                String owlDef = ((OWLLiteral) ax.getValue()).getLiteral();
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLOntology

public class GCIQualifierTest extends OboFormatTestBasics {

    @Test
    public void testConvert() {
        // PARSE TEST FILE, CONVERT TO OWL, AND WRITE TO OWL FILE
        OWLOntology ontology = convert(parseOBOFile("gci_qualifier_test.obo"));
        Set<OWLSubClassOfAxiom> scas = ontology
                .getAxioms(AxiomType.SUBCLASS_OF);
        boolean ok = !scas.isEmpty();
        assertTrue(ok);
        // CONVERT BACK TO OBO
        OBODoc obodoc = convert(ontology);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.