Package org.obolibrary.oboformat.model

Examples of org.obolibrary.oboformat.model.OBODoc


                }
            }
        }
        assertTrue(ok);
        // reverse translation
        OBODoc obodoc = convert(owlOntology);
        Frame fr = obodoc.getTermFrame("X:1");
        Collection<Clause> clauses = fr
                .getClauses(OboFormatTag.TAG_INTERSECTION_OF);
        assertEquals(2, clauses.size());
    }
View Full Code Here


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

    @Test
    public void testConversion() throws Exception {
        OBODoc obo = parseOBOFile("comment_remark_conversion.obo", true);
        Frame headerFrame = obo.getHeaderFrame();
        Collection<String> remarks = headerFrame.getTagValues(
                OboFormatTag.TAG_REMARK, String.class);
        OWLAPIObo2Owl obo2Owl = new OWLAPIObo2Owl(
                OWLManager.createOWLOntologyManager());
        OWLOntology owlOntology = obo2Owl.convert(obo);
        Set<OWLAnnotation> annotations = owlOntology.getAnnotations();
        Set<String> comments = new HashSet<>();
        for (OWLAnnotation owlAnnotation : annotations) {
            OWLAnnotationProperty property = owlAnnotation.getProperty();
            if (property.isComment()) {
                OWLAnnotationValue value = owlAnnotation.getValue();
                if (value instanceof OWLLiteral) {
                    OWLLiteral literal = (OWLLiteral) value;
                    comments.add(literal.getLiteral());
                }
            }
        }
        // check that all remarks have been translated to rdfs:comment
        assertEquals(remarks.size(), comments.size());
        assertTrue(comments.containsAll(remarks));
        assertTrue(remarks.containsAll(comments));
        OWLAPIOwl2Obo owl2Obo = new OWLAPIOwl2Obo(
                OWLManager.createOWLOntologyManager());
        OBODoc oboRoundTrip = owl2Obo.convert(owlOntology);
        Frame headerFrameRoundTrip = oboRoundTrip.getHeaderFrame();
        Collection<String> remarksRoundTrip = headerFrameRoundTrip
                .getTagValues(OboFormatTag.TAG_REMARK, String.class);
        assertEquals(remarks.size(), remarksRoundTrip.size());
        assertTrue(remarksRoundTrip.containsAll(remarks));
        assertTrue(remarks.containsAll(remarksRoundTrip));
View Full Code Here

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

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

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

    @Test
    public void testParseOBOFile() {
        OBODoc obodoc = parseOBOFile("simplego.obo");
        assertEquals(3, obodoc.getTermFrames().size());
        assertEquals(5, obodoc.getTypedefFrames().size());
        checkFrame(obodoc, "GO:0018901",
                "2,4-dichlorophenoxyacetic acid metabolic process",
                "biological_process");
        checkFrame(obodoc, "GO:0055124", "premature neural plate formation",
                "biological_process");
View Full Code Here

public class TrailingQualifierTest extends OboFormatTestBasics {

    @Test
    public void testReadTrailingQualifiers() throws Exception {
        // load test file with trailing qualifiers
        OBODoc doc = parseOBOFile("trailing_qualifier.obo");
        checkAllTrailingQualifiers(doc);
        // write to OBO
        String oboString = renderOboToString(doc);
        // parse written OBO
        OBODoc doc2 = parseOboToString(oboString);
        checkAllTrailingQualifiers(doc2);
    }
View Full Code Here

@SuppressWarnings("javadoc")
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());
        OWLOntology ontology = obo2owl.convert(doc);
View Full Code Here

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

    @Test
    public void testEmptyFirstLine() {
        OBODoc obodoc = parseOBOFile("empty_lines.obo");
        Collection<Frame> frames = obodoc.getTermFrames();
        assertEquals(1, frames.size());
        assertEquals("GO:0009555", frames.iterator().next().getId());
    }
View Full Code Here

        parseOBOFile("fbbt_comment_test.obo");
    }

    @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);
        assertEquals(comment,
                doc2.getTermFrame(id).getTagValue(OboFormatTag.TAG_COMMENT));
    }
View Full Code Here

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

    @Test
    public void testIdSpace() throws Exception {
        OBODoc doc1 = parseOBOFile("idspace_test.obo");
        checkIdSpace(doc1);
        String oboString = renderOboToString(doc1);
        assertTrue(oboString
                .contains("idspace: GO urn:lsid:bioontology.org:GO: \"gene ontology terms\""));
        OBODoc doc2 = parseOboToString(oboString);
        checkIdSpace(doc2);
    }
View Full Code Here

                .getAxioms(AxiomType.EQUIVALENT_CLASSES);
        assertEquals(2, ecas.size());
        // CONVERT BACK TO OBO
        OWLAPIOwl2Obo owl2obo = new OWLAPIOwl2Obo(
                OWLManager.createOWLOntologyManager());
        OBODoc obodoc = owl2obo.convert(ontology);
        checkOBODoc(obodoc);
        // ROUNDTRIP AND TEST AGAIN
        OBOFormatWriter w = new OBOFormatWriter();
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        OutputStreamWriter osw = new OutputStreamWriter(os, "UTF-8");
View Full Code Here

TOP

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

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.