Package org.obolibrary.oboformat.model

Examples of org.obolibrary.oboformat.model.Frame


        OBODoc doc2 = parseOboToString(oboString);
        checkAllTrailingQualifiers(doc2);
    }

    private void checkAllTrailingQualifiers(@Nonnull OBODoc doc) {
        Frame headerFrame = doc.getHeaderFrame();
        assert headerFrame != null;
        hasQualifierClause(headerFrame, OboFormatTag.TAG_AUTO_GENERATED_BY);
        hasQualifierClause(headerFrame, OboFormatTag.TAG_SUBSETDEF);
        hasQualifierClause(headerFrame, OboFormatTag.TAG_SYNONYMTYPEDEF);
        hasQualifierClause(headerFrame, OboFormatTag.TAG_DEFAULT_NAMESPACE);
        hasQualifierClause(headerFrame, OboFormatTag.TAG_IDSPACE);
        hasQualifierClauses(headerFrame, OboFormatTag.TAG_PROPERTY_VALUE);
        Frame frame = doc.getTermFrame("TEST:0001");
        assert frame != null;
        hasQualifierClause(frame, OboFormatTag.TAG_NAME);
        hasQualifierClause(frame, OboFormatTag.TAG_NAMESPACE);
        hasQualifierClause(frame, OboFormatTag.TAG_ALT_ID);
        hasQualifierClause(frame, OboFormatTag.TAG_DEF);
View Full Code Here


public class IDsTest {

    @Test
    public void testIDs() throws OWLOntologyCreationException {
        OBODoc doc = new OBODoc();
        Frame header = new Frame(FrameType.HEADER);
        Clause c = new Clause(OboFormatTag.TAG_ONTOLOGY.getTag());
        c.setValue("test");
        header.addClause(c);
        doc.setHeaderFrame(header);
        OWLAPIObo2Owl obo2owl = new OWLAPIObo2Owl(
                OWLManager.createOWLOntologyManager());
        OWLAPIOwl2Obo owl2Obo = new OWLAPIOwl2Obo(
                OWLManager.createOWLOntologyManager());
View Full Code Here

    }

    @Test
    public void writeCurlyBracesInComments() throws Exception {
        OBODoc doc = new OBODoc();
        Frame h = new Frame(FrameType.HEADER);
        h.addClause(new Clause(OboFormatTag.TAG_ONTOLOGY, "test"));
        doc.setHeaderFrame(h);
        Frame t = new Frame(FrameType.TERM);
        String id = "TEST:0001";
        t.setId(id);
        t.addClause(new Clause(OboFormatTag.TAG_ID, id));
        String comment = "Comment with a '{' curly braces '}'";
        t.addClause(new Clause(OboFormatTag.TAG_COMMENT, comment));
        doc.addFrame(t);
        String oboString = renderOboToString(doc);
        assertTrue(oboString
                .contains("comment: Comment with a '\\{' curly braces '}'"));
        OBODoc doc2 = parseOboToString(oboString);
View Full Code Here

        OBODoc doc2 = parseOboToString(oboString);
        checkIdSpace(doc2);
    }

    private static void checkIdSpace(@Nonnull OBODoc doc) {
        Frame headerFrame = doc.getHeaderFrame();
        assertNotNull(headerFrame);
        Clause clause = headerFrame.getClause(OboFormatTag.TAG_IDSPACE);
        Collection<Object> values = clause.getValues();
        assertNotNull(values);
        assertEquals(3, values.size());
        Iterator<Object> it = values.iterator();
        assertEquals("GO", it.next());
View Full Code Here

    }

    public void checkOBODoc(@Nonnull OBODoc obodoc) {
        // OBODoc tests
        // test ECA between named classes is persisted using correct tag
        Frame tf = obodoc.getTermFrame("X:1");
        Collection<Clause> cs = tf.getClauses(OboFormatTag.TAG_EQUIVALENT_TO);
        assertEquals(1, cs.size());
        Object v = cs.iterator().next().getValue();
        assertEquals("X:2", v);
        // test ECA between named class and anon class is persisted as
        // genus-differentia intersection_of tags
        tf = obodoc.getTermFrame("X:1");
        cs = tf.getClauses(OboFormatTag.TAG_INTERSECTION_OF);
        assertEquals(2, cs.size());
        boolean okGenus = false;
        boolean okDifferentia = false;
        for (Clause c : cs) {
            Collection<Object> vs = c.getValues();
            if (vs.size() == 2) {
                if (c.getValue().equals("R:1") && c.getValue2().equals("Z:1")) {
                    okDifferentia = true;
                }
            } else if (vs.size() == 1) {
                if (c.getValue().equals("Y:1")) {
                    okGenus = true;
                }
            } else {
                fail();
            }
        }
        assertTrue(okGenus);
        assertTrue(okDifferentia);
        // check reciprocal direction
        Frame tf2 = obodoc.getTermFrame("X:2");
        Collection<Clause> cs2 = tf2.getClauses(OboFormatTag.TAG_EQUIVALENT_TO);
        Frame tf1 = obodoc.getTermFrame("X:1");
        Collection<Clause> cs1 = tf1.getClauses(OboFormatTag.TAG_EQUIVALENT_TO);
        boolean ok = false;
        if (cs2.size() == 1) {
            if (cs2.iterator().next().getValue(String.class).equals("X:1")) {
                ok = true;
            }
View Full Code Here

        OBODoc obodoc = parseOBOFile("treat_xrefs_test.obo");
        XrefExpander x = new XrefExpander(obodoc);
        x.expandXrefs();
        OBODoc tdoc = obodoc.getImportedOBODocs().iterator().next();
        assertTrue(!tdoc.getTermFrames().isEmpty());
        Frame termFrame = tdoc.getTermFrame("ZFA:0001689");
        assert termFrame != null;
        assertEquals(2, termFrame.getClauses(OboFormatTag.TAG_INTERSECTION_OF)
                .size());
        termFrame = tdoc.getTermFrame("EHDAA:571");
        assert termFrame != null;
        assertEquals("UBERON:0002539",
                termFrame.getClause(OboFormatTag.TAG_IS_A).getValue());
        termFrame = tdoc.getTermFrame("UBERON:0006800");
        assert termFrame != null;
        assertEquals("CARO:0000008", termFrame.getClause(OboFormatTag.TAG_IS_A)
                .getValue());
    }
View Full Code Here

        OBODoc obodoc = parseOBOFile("treat_xrefs_test.obo");
        XrefExpander x = new XrefExpander(obodoc, "bridge");
        x.expandXrefs();
        int n = 0;
        for (OBODoc tdoc : obodoc.getImportedOBODocs()) {
            Frame hf = tdoc.getHeaderFrame();
            if (hf == null) {
                continue;
            }
            Clause impClause = hf.getClause(OboFormatTag.TAG_ONTOLOGY);
            // if (impClause == null) {
            // continue;
            // }
            String tid = impClause.getValue(String.class)
                    .replace("bridge-", "");
            if (tid.equals("zfa")) {
                assertEquals(
                        2,
                        tdoc.getTermFrame("ZFA:0001689")
                                .getClauses(OboFormatTag.TAG_INTERSECTION_OF)
                                .size());
                Frame pf = tdoc.getTypedefFrame("part_of");
                assertEquals("BFO:0000050", pf.getClause(OboFormatTag.TAG_XREF)
                        .getValue().toString());
                n++;
            }
            if (tid.equals("ehdaa")) {
                assertEquals("UBERON:0002539", tdoc.getTermFrame("EHDAA:571")
View Full Code Here

public class IgnoreImportAnnotationsTest extends OboFormatTestBasics {

    @Test
    public void testIgnoreAnnotations() {
        OBODoc oboDoc = parseOBOFile("annotated_import.obo");
        Frame headerFrame = oboDoc.getHeaderFrame();
        Collection<Clause> imports = headerFrame
                .getClauses(OboFormatTag.TAG_IMPORT);
        assertEquals(1, imports.size());
        Clause clause = imports.iterator().next();
        Collection<QualifierValue> qualifierValues = clause
                .getQualifierValues();
View Full Code Here

    @Test
    public void testEscapeChars() {
        OBODoc obodoc = parseOBOFile("escape_chars_test.obo");
        assertEquals(3, obodoc.getTermFrames().size());
        Frame f1 = obodoc.getTermFrame("GO:0033942");
        assertEquals("GO:0033942", f1.getId());
        Clause nameClause = f1.getClause(OboFormatTag.TAG_NAME);
        assertEquals(
                "4-alpha-D-{(1->4)-alpha-D-glucano}trehalose trehalohydrolase activity",
                nameClause.getValue());
        Frame f2 = obodoc.getTermFrame("CL:0000096");
        assertEquals("CL:0000096", f2.getId());
        Clause defClause = f2.getClause(OboFormatTag.TAG_DEF);
        assertEquals("bla bla .\"", defClause.getValue());
        Clause commentClause = f2.getClause(OboFormatTag.TAG_COMMENT);
        assertEquals("bla bla bla.\nbla bla (bla).", commentClause.getValue());
    }
View Full Code Here

    @Test(expected = FrameStructureException.class)
    public void testParseOBOFile() throws Exception {
        OBODoc obodoc = parseOBOFile("single_intersection_of_tag_test.obo");
        assertEquals(2, obodoc.getTermFrames().size());
        Frame frame = obodoc.getTermFrames().iterator().next();
        assertNotNull(frame);
        renderOboToString(obodoc); // throws FrameStructureException
    }
View Full Code Here

TOP

Related Classes of org.obolibrary.oboformat.model.Frame

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.