SemBioProcess / SemGen

A tool for semantics-based annotation and composition of biosimulation models
18 stars 3 forks source link

ModelAccessor for string? #309

Closed 0u812 closed 5 years ago

0u812 commented 6 years ago

Hi all, it would be useful for Tellurium interop to pass a string of raw SBML content instead of a file. It looks like there currently isn't a ModelAccessor for a string, correct?

maxneal commented 5 years ago

This functionality has been added to the SemSim code base. Needs some additional testing. @0u812 if you could build a new version of the API and try this out, that would be awesome.

Example usage:

ModelAccessor test = FileAccessorFactory.getModelAccessorForString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + 
                "<sbml xmlns=\"http://www.sbml.org/sbml/level2/version4\" level=\"2\" version=\"4\">\n" + 
                "<model id=\"BIOMD0000000001\" name=\"Edelstein1996 - EPSP ACh event\" metaid=\"_000001\">\n" +
                "</model>\n" + "</sbml>", ModelType.SBML_MODEL);

SemSimModel ssm = new SBMLreader(test).read();
System.out.println(ssm.getMetadataID());
0u812 commented 5 years ago

This appears to be working great, thanks Max!