Package org.obolibrary.oboformat.model

Examples of org.obolibrary.oboformat.model.Frame


        assertTrue(okDeprecated);
        // CONVERT TO OWL FILE
        writeOWL(ontology, new RDFXMLDocumentFormat());
        // CONVERT BACK TO OBO
        OBODoc obodoc = convert(ontology);
        Frame tf = obodoc.getTermFrame("XX:0000034");
        Clause c = tf.getClause(OboFormatTag.TAG_IS_OBSELETE);
        Object v = c.getValue();
        assertEquals("true", v); // should this be a Boolean object? TODO
    }
View Full Code Here


        checkOBODoc(obodoc);
    }

    private static void checkOBODoc(@Nonnull OBODoc obodoc) {
        // OBODoc tests
        Frame tf = obodoc.getTermFrame("x1"); // TODO - may change
        @SuppressWarnings("null")
        Collection<Clause> cs = tf.getClauses(OboFormatTag.TAG_INTERSECTION_OF);
        assertTrue(cs.size() != 1);
        // there should NEVER be a situation with single intersection tags
        // TODO - add validation step prior to saving
    }
View Full Code Here

    }

    @Nonnull
    private static OBODoc createPVDoc() {
        OBODoc oboDoc = new OBODoc();
        Frame headerFrame = new Frame(FrameType.HEADER);
        headerFrame
                .addClause(new Clause(OboFormatTag.TAG_FORMAT_VERSION, "1.2"));
        headerFrame.addClause(new Clause(OboFormatTag.TAG_ONTOLOGY, "test"));
        addPropertyValue(headerFrame, "http://purl.org/dc/elements/1.1/title",
                "Ontology for Biomedical Investigation", "xsd:string");
        addPropertyValue(headerFrame, "defaultLanguage", "en", "xsd:string");
        oboDoc.setHeaderFrame(headerFrame);
        return oboDoc;
View Full Code Here

                .create("http://purl.obolibrary.org/obo/BAR_0000001"));
        assertTrue(!aaas.isEmpty());
        OWLAPIOwl2Obo revbridge = new OWLAPIOwl2Obo(
                OWLManager.createOWLOntologyManager());
        OBODoc d2 = revbridge.convert(owlOnt);
        Frame partOf = d2.getTypedefFrame("part_of");
        Collection<Clause> xrcs = partOf.getClauses(OboFormatTag.TAG_XREF);
        boolean okBfo = false;
        boolean okOboRel = false;
        for (Clause c : xrcs) {
            Xref value = c.getValue(Xref.class);
            if (value.getIdref().equals("BFO:0000050")) {
                okBfo = true;
            }
            if (value.getIdref().equals("OBO_REL:part_of")) {
                okOboRel = true;
            }
        }
        assertTrue(okBfo);
        assertTrue(okOboRel);
        Frame a = d2.getTermFrame("TEST:a");
        Clause rc = a.getClause(OboFormatTag.TAG_RELATIONSHIP);
        assertEquals("part_of", rc.getValue());
        assertEquals("TEST:b", rc.getValue2());
    }
View Full Code Here

    @Test
    public void testRequireEmptyXrefList() throws Exception {
        OBODoc obo = parseOBOFile("synonym_test.obo");
        // Get synonym clause with an empty xref list
        Frame frame = obo.getTermFrame("GO:0009579");
        assertNotNull(frame);
        // write frame
        StringWriter stringWriter = new StringWriter();
        BufferedWriter bufferedWriter = new BufferedWriter(stringWriter);
        OBOFormatWriter oboWriter = new OBOFormatWriter();
View Full Code Here

        // parse OBO
        OBOFormatParser p = new OBOFormatParser();
        OBODoc oboDoc2 = p
                .parse(new BufferedReader(new StringReader(oboString)));
        // check that the annotations are pre-served on the property values
        Frame typedefFrame = oboDoc2.getTypedefFrame("RO:0002224");
        @SuppressWarnings("null")
        Collection<Clause> propertyValues = typedefFrame
                .getClauses(OboFormatTag.TAG_PROPERTY_VALUE);
        boolean found = false;
        for (Clause clause : propertyValues) {
            if ("IAO:0000118".equals(clause.getValue())
                    && "started by".equals(clause.getValue2())) {
View Full Code Here

            }
        }
        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

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

    @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

        checkFrame(obodoc, "regulates", "regulates", "gene_ontology");
    }

    private static void checkFrame(@Nonnull OBODoc doc, String id, String name,
            String namespace) {
        Frame frame = doc.getTermFrame(id);
        if (frame == null) {
            frame = doc.getTypedefFrame(id);
        }
        assertNotNull(frame);
        assertEquals(name, frame.getTagValue(OboFormatTag.TAG_NAME));
        assertEquals(namespace, frame.getTagValue(OboFormatTag.TAG_NAMESPACE));
    }
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.