Package org.obolibrary.oboformat.parser

Examples of org.obolibrary.oboformat.parser.OBOFormatParser


     */
    public static void convertURL(@Nonnull String iri, @Nonnull String outFile,
            @Nonnull OWLOntologyManager manager) throws IOException,
            OWLOntologyCreationException, OWLOntologyStorageException {
        OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(manager);
        OBOFormatParser p = new OBOFormatParser();
        OBODoc obodoc = p.parse(new URL(iri));
        OWLOntology ontology = bridge.convert(obodoc);
        IRI outputStream = IRI.create(outFile);
        OWLDocumentFormat format = new RDFXMLDocumentFormat();
        LOG.info("saving to {} fmt={}", outputStream, format);
        manager.saveOntology(ontology, format, outputStream);
View Full Code Here


    public static void convertURL(String iri, @Nonnull String outFile,
            String defaultOnt, @Nonnull OWLOntologyManager manager)
            throws IOException, OWLOntologyCreationException,
            OWLOntologyStorageException {
        OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(manager);
        OBOFormatParser p = new OBOFormatParser();
        OBODoc obodoc = p.parse(new URL(iri));
        obodoc.addDefaultOntologyHeader(defaultOnt);
        OWLOntology ontology = bridge.convert(obodoc);
        IRI outputStream = IRI.create(outFile);
        OWLDocumentFormat format = new RDFXMLDocumentFormat();
        LOG.info("saving to {} fmt={}", outputStream, format);
View Full Code Here

     *         the oWL ontology creation exception
     */
    public OWLOntology convert(@Nonnull String oboFile)
            throws OWLOntologyCreationException {
        try {
            OBOFormatParser p = new OBOFormatParser();
            return convert(p.parse(oboFile));
        } catch (IOException ex) {
            throw new OWLOntologyCreationException(
                    "Error Occured while parsing OBO '" + oboFile + '\'', ex);
        } catch (OBOFormatParserException ex) {
            throw new OWLOntologyCreationException(
View Full Code Here

    }

    @Nonnull
    private static Clause parseLine(@Nonnull String line) {
        StringReader sr = new StringReader(line);
        OBOFormatParser p = new OBOFormatParser();
        BufferedReader br = new BufferedReader(sr);
        p.setReader(br);
        return p.parseTermFrameClause();
    }
View Full Code Here

    }

    @Nonnull
    private static OBODoc parseFrames(@Nonnull String s) {
        StringReader sr = new StringReader(s);
        OBOFormatParser p = new OBOFormatParser();
        BufferedReader br = new BufferedReader(sr);
        p.setReader(br);
        OBODoc obodoc = new OBODoc();
        p.parseTermFrame(obodoc);
        return obodoc;
    }
View Full Code Here

    }

    @Nonnull
    private static OBODoc parseOBODoc(@Nonnull String s) {
        StringReader sr = new StringReader(s);
        OBOFormatParser p = new OBOFormatParser();
        BufferedReader br = new BufferedReader(sr);
        p.setReader(br);
        OBODoc obodoc = new OBODoc();
        p.parseOBODoc(obodoc);
        return obodoc;
    }
View Full Code Here

        OWLOntology oo1 = parseOWLFile("ro.owl");
        OBODoc oboDoc1 = convert(oo1);
        // write OBO
        String oboString = renderOboToString(oboDoc1);
        // 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
View Full Code Here

        OutputStreamWriter osw = new OutputStreamWriter(os, "UTF-8");
        BufferedWriter bw = new BufferedWriter(osw);
        w.setCheckStructure(true);
        w.write(obodoc, bw);
        bw.close();
        OBOFormatParser p = new OBOFormatParser();
        obodoc = p.parse(new BufferedReader(new InputStreamReader(
                new ByteArrayInputStream(os.toByteArray()))));
        checkOBODoc(obodoc);
    }
View Full Code Here

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

    @Nonnull
    protected OBODoc parseOBOURL(String fn) throws IOException {
        OBOFormatParser p = new OBOFormatParser();
        OBODoc obodoc = p.parseURL(fn);
        assertTrue(!obodoc.getTermFrames().isEmpty());
        return obodoc;
    }
View Full Code Here

    @SuppressWarnings("resource")
    @Nonnull
    protected OBODoc parseOBOFile(String fn, boolean allowEmptyFrames) {
        InputStream inputStream = getInputStream(fn);
        OBOFormatParser p = new OBOFormatParser();
        OBODoc obodoc;
        try {
            obodoc = p.parse(new BufferedReader(new InputStreamReader(
                    inputStream)));
            assertNotNull("The obodoc should not be null", obodoc);
            if (obodoc.getTermFrames().isEmpty() && !allowEmptyFrames) {
                fail("Term frames should not be empty.");
            }
View Full Code Here

TOP

Related Classes of org.obolibrary.oboformat.parser.OBOFormatParser

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.