public void processEndDocument(SBMLDocument sbmlDocument) {
log4jLogger.debug("SBMLCoreParser : processEndDocument");
if (sbmlDocument.isSetModel()) {
Model model = sbmlDocument.getModel();
if (model.isSetAreaUnits() && !model.isSetAreaUnitsInstance()) {
log4jLogger.warn("No unitDefinition matches the areaUnitsID of Model.");
}
if (model.isSetConversionFactor()
&& !model.isSetConversionFactorInstance()) {
log4jLogger.warn("No parameter matches the conversionFactorID of Model.");
}
if (model.isSetExtentUnits() && !model.isSetExtentUnitsInstance()) {
log4jLogger.warn("No unitDefinition matches the extentUnitsID of Model.");
}
if (model.isSetLengthUnits() && !model.isSetLengthUnitsInstance()) {
log4jLogger.warn("No unitDefinition matches the lengthUnitsID of Model.");
}
if (model.isSetSubstanceUnits()
&& !model.isSetSubstanceUnitsInstance()) {
log4jLogger.warn("No unitDefinition matches the substanceUnitsID of Model.");
}
if (model.isSetTimeUnits() && !model.isSetTimeUnitsInstance()) {
log4jLogger.warn("No unitDefinition matches the timeUnitsID of Model.");
}
if (model.isSetVolumeUnits() && !model.isSetVolumeUnitsInstance()) {
log4jLogger.warn("No unitDefinition matches the volumeUnitsID of Model.");
}
if (model.isSetListOfRules()) {
if (model.getLevel() == 1) {
log4jLogger.debug("Transformed SBMLLevel1Rule : processEndDocument : model is level 1");
int i = 0;
for (Rule rule : model.getListOfRules().clone()) {
if (rule instanceof SBMLLevel1Rule) {
Rule realRule;
if (((SBMLLevel1Rule) rule).isScalar()) {
realRule = ((SBMLLevel1Rule) rule).cloneAsAssignmentRule();
log4jLogger.debug("Transformed SBMLLevel1Rule : " + ((SBMLLevel1Rule) rule).getVariable() + " into AssignmentRule.");
} else {
realRule = ((SBMLLevel1Rule) rule).cloneAsRateRule();
log4jLogger.debug("Transformed SBMLLevel1Rule : " + ((SBMLLevel1Rule) rule).getVariable() + " into RateRule.");
}
log4jLogger.debug("Transformed SBMLLevel1Rule : realRule = " + realRule);
model.getListOfRules().remove(i);
model.getListOfRules().add(i, realRule);
}
i++;
}
}
for (int i = 0; i < model.getNumRules(); i++) {
Rule rule = model.getRule(i);
if (rule instanceof AssignmentRule) {
AssignmentRule assignmentRule = (AssignmentRule) rule;
if (assignmentRule.isSetVariable()
&& !assignmentRule.isSetVariableInstance()) {
log4jLogger.warn("No Symbol matches the variableID of AssignmentRule.");
}
if (assignmentRule.isSetUnits()
&& !assignmentRule.isSetUnitsInstance()
&& assignmentRule.isParameter()) {
log4jLogger.warn("No UnitDefinition matches the unitsID of AssignmentRule.");
}
} else if (rule instanceof RateRule) {
RateRule rateRule = (RateRule) rule;
if (rateRule.isSetVariable()
&& !rateRule.isSetVariableInstance()) {
log4jLogger.warn("No Symbol matches the variableID of RateRule.");
}
}
}
}
if (model.isSetListOfCompartments()) {
for (int i = 0; i < model.getNumCompartments(); i++) {
Compartment compartment = model.getCompartment(i);
if (compartment.isSetCompartmentType()
&& !compartment.isSetCompartmentTypeInstance()) {
log4jLogger.warn("No CompartmentType matches the compartmentTypeID of compartment.");
}
if (compartment.isSetOutside()
&& !compartment.isSetOutsideInstance()) {
log4jLogger.warn("No Compartment matches the outsideID of compartment.");
}
if (compartment.isSetUnits()
&& !compartment.isSetUnitsInstance()) {
log4jLogger.warn("No UnitDefinition matches the unitsID of compartment.");
}
}
}
if (model.isSetListOfEvents()) {
for (int i = 0; i < model.getNumEvents(); i++) {
Event event = model.getEvent(i);
if (event.isSetTimeUnits()
&& !event.isSetTimeUnitsInstance()) {
log4jLogger.warn("No UnitDefinition matches the timeUnitsID of event.");
}
if (event.isSetListOfEventAssignments()) {
for (int j = 0; j < event.getNumEventAssignments(); j++) {
EventAssignment eventAssignment = event
.getEventAssignment(j);
if (eventAssignment.isSetVariable()
&& !eventAssignment.isSetVariableInstance()) {
log4jLogger.warn("No Symbol matches the variableID of eventAssignment.");
}
}
}
}
}
if (model.isSetListOfInitialAssignments()) {
for (int i = 0; i < model.getNumInitialAssignments(); i++) {
InitialAssignment initialAssignment = model
.getInitialAssignment(i);
if (initialAssignment.isSetVariable()
&& !initialAssignment.isSetVariableInstance()) {
log4jLogger.warn("No Symbol matches the symbolID of initialAssignment.");
}
}
}
if (model.isSetListOfReactions()) {
for (int i = 0; i < model.getNumReactions(); i++) {
Reaction reaction = model.getReaction(i);
if (reaction.isSetCompartment()
&& !reaction.isSetCompartmentInstance()) {
log4jLogger.warn("No Compartment matches the compartmentID of reaction.");
}
if (reaction.isSetListOfReactants()) {
for (int j = 0; j < reaction.getNumReactants(); j++) {
SpeciesReference speciesReference = reaction
.getReactant(j);
if (speciesReference.isSetSpecies()
&& !speciesReference.isSetSpeciesInstance()) {
log4jLogger.warn(String.format("No Species matches the speciesID '%s' of %s.",
speciesReference.getId(), speciesReference.getElementName()));
}
}
}
if (reaction.isSetListOfProducts()) {
for (int j = 0; j < reaction.getNumProducts(); j++) {
SpeciesReference speciesReference = reaction
.getProduct(j);
if (speciesReference.isSetSpecies()
&& !speciesReference.isSetSpeciesInstance()) {
log4jLogger.warn(String.format("No Species matches the speciesID '%s' of %s.",
speciesReference.getId(), speciesReference.getElementName()));
}
}
}
if (reaction.isSetListOfModifiers()) {
for (int j = 0; j < reaction.getNumModifiers(); j++) {
ModifierSpeciesReference modifierSpeciesReference = reaction
.getModifier(j);
if (modifierSpeciesReference.isSetSpecies()
&& !modifierSpeciesReference
.isSetSpeciesInstance()) {
log4jLogger.warn(String.format("No Species matches the speciesID '%s' of %s.",
modifierSpeciesReference.getId(), modifierSpeciesReference.getElementName()));
}
}
}
if (reaction.isSetKineticLaw()) {
KineticLaw kineticLaw = reaction.getKineticLaw();
if (kineticLaw.isSetTimeUnits()
&& !kineticLaw.isSetTimeUnitsInstance()) {
log4jLogger.warn("No UnitDefinition matches the timeUnitsID of kineticLaw.");
}
if (kineticLaw.isSetSubstanceUnits()
&& !kineticLaw.isSetSubstanceUnitsInstance()) {
log4jLogger.warn("No UnitDefinition matches the substanceUnitsID of kineticLaw.");
}
if (kineticLaw.isSetListOfLocalParameters()) {
for (int j = 0; j < kineticLaw.getNumLocalParameters(); j++) {
LocalParameter parameter = kineticLaw
.getLocalParameter(j);
if (parameter.isSetUnits()
&& !parameter.isSetUnitsInstance()) {
log4jLogger.warn(String.format(
"No UnitDefinition matches the unitsID '%s'of the parameter %s.",
parameter.getUnits(), parameter.getId()));
}
}
}
}
}
}
if (model.isSetListOfSpecies()) {
for (int i = 0; i < model.getNumSpecies(); i++) {
Species species = model.getSpecies(i);
if (species.isSetSubstanceUnits()
&& !species.isSetSubstanceUnitsInstance()) {
log4jLogger.warn("No UnitDefinition matches the subtsanceUnitsID of species.");
}
if (species.isSetSpeciesType()
&& !species.isSetSpeciesTypeInstance()) {
log4jLogger.warn("No SpeciesType matches the speciesTypeID of species.");
}
if (species.isSetConversionFactor()
&& !species.isSetConversionFactorInstance()) {
log4jLogger.warn("No Parameter matches the conversionFactorID of species.");
}
if (species.isSetCompartment()
&& !species.isSetCompartmentInstance()) {
log4jLogger.warn("No Compartment matches the compartmentID of species.");
}
if (species.isSetSpatialSizeUnits()
&& !species.isSetSpatialSizeUnitsInstance()) {
log4jLogger.warn("No UnitDefinition matches the spatialSizeUnitsID of species.");
}
}
}
if (model.isSetListOfParameters()) {
for (int i = 0; i < model.getNumParameters(); i++) {
Parameter parameter = model.getParameter(i);
if (parameter.isSetUnits()
&& !parameter.isSetUnitsInstance()) {
log4jLogger.warn("No UnitDefinition matches the unitsID of parameter.");
}
}