Hi again,
I'd like to parse some OBO that I have as a String in my code (it's
coming over HTTP in a REST app). The current OBO Parser code as
described on the "getting started" page [1] makes this difficult,
because the API needs a path to a file or URL. I need to write my OBO
to a temp file first, which is wasteful.
I tried patching OBOParseEngine to make it a bit more modular by
splitting doParse(String) into the part that creates the
BufferedReader and the part that uses it. That way, one could parse
anything one can instantiate a Reader for, like this:
public OBOSession parse(String obo) throws Exception
{
DefaultOBOParser parser = new DefaultOBOParser();
OBOParseEngine engine = new OBOParseEngine(parser);
parser.startParse();
engine.parse( new BufferedReader(new StringReader(obo)) );
parser.endParse();
return parser.getSession();
}
Unfortunately, the parser needs some namespace state that is
initialized via AbstractParseEngine.parse(String uri) ->
OBOSimpleParser.startFileParse(uri). So more work would be necessary
to break up these pieces.
1. Am I overlooking something?
2. Would there be interest in such a patch?
Thanks,
Thomas
[1]
http://wiki.geneontology.org/index.php/OBO-Edit:_OBO_Parser_-_Getting_Started
--
You received this message because you are subscribed to the Google Groups "OBO-Edit Developers Group" group.
To post to this group, send email to
obo-ed...@googlegroups.com.
To unsubscribe from this group, send email to
obo-edit-dev...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/obo-edit-dev?hl=en.