use of org.jlibsedml.SedMLError in project vcell by virtualcell.
the class KisaoIDValidator method validate.
/**
* Validates the syntax of the KiSAO identifier for uniform time course descriptions.
* @see org.jlibsedml.validation.ISedMLValidator#validate()
*/
public List<SedMLError> validate() {
List<SedMLError> errs = new ArrayList<SedMLError>();
for (Simulation sim : sims) {
String kisaoID = sim.getAlgorithm().getKisaoID();
if (KisaoOntology.getInstance().getTermById(kisaoID) == null) {
int line = getLineNumberOfError(SEDMLTags.SIMUL_UTC_KIND, sim);
errs.add(new SedMLError(line, " The supplied KisaoID [" + kisaoID + "] for simulation [" + sim.getId() + "] is not a recognized KISAO identifier.\n" + " Identifiers should be the format 'KISAO:0000001' ", SedMLError.ERROR_SEVERITY.WARNING));
}
}
return errs;
}
use of org.jlibsedml.SedMLError in project vcell by virtualcell.
the class ModelCyclesDetector method validate.
/**
* @see ISedMLValidator
*/
public List<SedMLError> validate() throws XMLException {
List<SedMLError> errs = new ArrayList<SedMLError>();
List<Model> models = sedml.getModels();
for (Model model : models) {
String src = model.getSource();
String id = model.getId();
Set<String> ids = new HashSet<String>();
ids.add(id);
while (sedml.getModelWithId(src) != null) {
String newID = sedml.getModelWithId(src).getId();
if (ids.contains(newID)) {
int line = getLineNumberOfError(SEDMLTags.MODEL_TAG, model);
errs.add(new SedMLError(line, "Cycles detected in source references for model " + newID + " and " + sedml.getModelWithId(newID).getSource(), ERROR_SEVERITY.ERROR));
return errs;
} else {
ids.add(newID);
src = sedml.getModelWithId(src).getSource();
}
}
}
return errs;
}
use of org.jlibsedml.SedMLError in project vcell by virtualcell.
the class MathMLValidator method checkMathIds.
private List<SedMLError> checkMathIds() {
List<SedMLError> errors = new ArrayList<SedMLError>();
List<? extends IIdentifiable> vars = mathContainer.getListOfVariables();
List<? extends IIdentifiable> params = mathContainer.getListOfParameters();
Set<ASTCi> identifiers = mathContainer.getMath().getIdentifiers();
for (ASTCi var : identifiers) {
if (!(check(var, vars) || check(var, params))) {
errors.add(new SedMLError(0, "Math ml in [" + mathContainer.getId() + "] refers to a variable not defined in the model", ERROR_SEVERITY.WARNING));
}
}
return errors;
}
use of org.jlibsedml.SedMLError in project vcell by virtualcell.
the class MathMLValidator method checkFunctions.
private List<SedMLError> checkFunctions() {
List<SedMLError> errors = new ArrayList<SedMLError>();
ASTNode node = mathContainer.getMath();
EvaluationContext cont = new EvaluationContext();
for (IIdentifiable id : mathContainer.getListOfParameters()) {
cont.setValueFor(id.getId(), 0.0);
}
for (IIdentifiable id : mathContainer.getListOfVariables()) {
cont.setValueFor(id.getId(), 0.0);
}
if (!node.canEvaluate(cont)) {
errors.add(new SedMLError(0, "This node [" + node.getName() + "] cannot be evaluated", ERROR_SEVERITY.WARNING));
}
return errors;
}
use of org.jlibsedml.SedMLError in project vcell by virtualcell.
the class SEDMLSchemaValidator method validate.
/**
* @throws XMLException
* @see ISedMLValidator
*/
public List<SedMLError> validate() throws XMLException {
final List<SedMLError> errors = new ArrayList<SedMLError>();
String xmlAsString = new SEDMLDocument(sedml).writeDocumentToString();
new SchemaValidatorImpl().validateSedMLString(errors, xmlAsString);
return errors;
}
Aggregations