Menu

Tutorials

Maxwell Neal

Reading models into the API

Read an OWL-formatted SemSim model file into the API

File afile = new File("path/to/OWL/file.owl");
SemSimModel model = new SemSimOWLreader().readFromFile(afile);

Read a CellML model file into the API

File afile = new File("path/to/CellML/file.cellml");
SemSimModel model = new CellMLreader().readFromFile(afile);

Read an MML model file into the API

// MMLreader calls the JSim API, which requires some JSim-specific files to read MML models.
// You can point the way to these files using a path to the "jsimhome" directory that is provided in the SemSimAPI source code
// Specifically, the JSim API is looking for a directory with a sub-directory
// called "common" that includes files such as "nsrunit.mod", etc.

File afile = new File("path/to/MML/file.mod");
String jsimHomeDir = "path/to/jsimhome";  
SemSimModel model = new MMLreader(jsimhomeDir).readFromFile(afile);

Read an SBML model file into the API

File afile = new File("path/to/SBML/file.xml");
String jsimHomeDir = "path/to/jsimhome"; 
SemSimModel model = new MMLreader(jsimHomeDir).readFromFile(afile);

// Currently, the SemSimAPI uses MML as an intermediary language to convert from
// SBML to the SemSim object model.
// This process leaves out most of the semantic content of the SBML model. 
// To include the semantic content, a bit more effort is required:

// Determine whether the user has a live connection to the web
boolean online = false;

// A table that relates ontology URIs to their free-text descriptions
Hashtable<String,String[]> ontologyTermsAndNamesCache = new Hashtable<String,String[]>();
SBMLAnnotator.annotate(afile, model, online, ontologyTermsAndNamesCache);

// optional step to cache free-text names
ontologyTermsAndNamesCache.putAll(ReferenceTermNamer.getNamesForOntologyTermsInModel(model,online));    
SBMLAnnotator.setFreeTextDefinitionsForDataStructuresAndSubmodels(model);


MongoDB Logo MongoDB