Examples of OBODoc


Examples of org.obolibrary.oboformat.model.OBODoc

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

Examples of org.obolibrary.oboformat.model.OBODoc

@SuppressWarnings("javadoc")
public class RoundTripLabeledXrefsTest extends RoundTripTest {

    @Test
    public void testRoundTrip() throws Exception {
        OBODoc source = parseOBOFile("labeled_xrefs.obo");
        String written = renderOboToString(source);
        OBODoc parsed = parseOboToString(written);
        List<Diff> diffs = OBODocDiffer.getDiffs(source, parsed);
        assertEquals(0, diffs.size());
    }
View Full Code Here

Examples of org.obolibrary.oboformat.model.OBODoc

public class DanglingRestrictionOwl2OboTest extends OboFormatTestBasics {

    @Test
    public void testConversion() throws Exception {
        // this is a test ontology that has had its imports axioms removed
        OBODoc doc = convert(parseOWLFile("dangling_restriction_test.owl"));
        Frame f = doc.getTermFrame("FUNCARO:0000014");
        Clause rc = f.getClause(OboFormatTag.TAG_NAME);
        assertEquals("digestive system", rc.getValue());
        Collection<Clause> isas = f.getClauses(OboFormatTag.TAG_IS_A);
        assertEquals(1, isas.size());
        Collection<Clause> rs = f.getClauses(OboFormatTag.TAG_RELATIONSHIP);
View Full Code Here

Examples of org.obolibrary.oboformat.model.OBODoc

    @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());
View Full Code Here

Examples of org.obolibrary.oboformat.model.OBODoc

    @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());
View Full Code Here

Examples of org.obolibrary.oboformat.model.OBODoc

@SuppressWarnings("javadoc")
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");
View Full Code Here

Examples of org.obolibrary.oboformat.model.OBODoc

@SuppressWarnings("javadoc")
public class RoundTripNamespaceIdRule extends RoundTripTest {

    @Test
    public void testWrite() throws Exception {
        OBODoc oboDoc = parseOBOFile("namespace-id-rule.obo");
        String oboString = renderOboToString(oboDoc);
        assertTrue(oboString
                .contains("\nnamespace-id-rule: * test:$sequence(7,0,9999999)$\n"));
    }
View Full Code Here

Examples of org.obolibrary.oboformat.model.OBODoc

        roundTripOBOFile("namespace-id-rule.obo", true);
    }

    @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);
View Full Code Here

Examples of org.obolibrary.oboformat.model.OBODoc

                ok = true;
            }
        }
        assertTrue(ok);
        // CONVERT BACK TO OBO
        OBODoc obodoc = convert(ontology);
        // test that transitive over is converted back
        Frame tf = obodoc.getTypedefFrame("regulates");
        assert tf != null;
        assertEquals(3, tf.getClauses().size());
        assertEquals("regulates", tf.getTagValue(OboFormatTag.TAG_ID));
        assertEquals("regulates", tf.getTagValue(OboFormatTag.TAG_NAME));
        Clause clause = tf.getClause(OboFormatTag.TAG_TRANSITIVE_OVER);
View Full Code Here

Examples of org.obolibrary.oboformat.model.OBODoc

public class RoundTripMultiLineDefTest extends OboFormatTestBasics {

    @Test
    public void testMultiLineDefinitions() throws Exception {
        // create minimal ontology
        OBODoc oboDocSource = new OBODoc();
        oboDocSource.setHeaderFrame(new Frame(FrameType.HEADER));
        oboDocSource.addDefaultOntologyHeader("caro");
        // add source frame that contains at least one new line
        Frame sourceFrame = new Frame(FrameType.TERM);
        sourceFrame.setId("CARO:0000049");
        sourceFrame
                .addClause(new Clause(
                        OboFormatTag.TAG_DEF,
                        "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();
                // check that owl def also contains at least one new line
                assertTrue(owlDef.indexOf('\n') > 0);
            }
        }
        assertEquals(1, counter);
        // convert back to OBO
        OWLAPIOwl2Obo owl2Obo = new OWLAPIOwl2Obo(
                OWLManager.createOWLOntologyManager());
        OBODoc convertedOboDoc = owl2Obo.convert(owlOntology);
        Frame convertedFrame = convertedOboDoc.getTermFrame("CARO:0000049");
        String convertedDef = convertedFrame.getTagValue(OboFormatTag.TAG_DEF,
                String.class);
        // check that round trip still contains newlines
        assertTrue(convertedDef.indexOf('\n') > 0);
    }
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.