diff --git a/src/sbml/packages/spatial/sbml/AdvectionCoefficient.cpp b/src/sbml/packages/spatial/sbml/AdvectionCoefficient.cpp index 4cb8c3558d..bfffeda079 100644 --- a/src/sbml/packages/spatial/sbml/AdvectionCoefficient.cpp +++ b/src/sbml/packages/spatial/sbml/AdvectionCoefficient.cpp @@ -750,7 +750,7 @@ AdvectionCoefficient::readAttributes(const XMLAttributes& attributes, msg += " is '" + mVariable + "', which does not conform to the syntax."; log->logPackageError("spatial", - SpatialAdvectionCoefficientVariableMustBeSpecies, pkgVersion, level, + SpatialAdvectionCoefficientVariableMustBeSpeciesOrParam, pkgVersion, level, version, msg, getLine(), getColumn()); } } diff --git a/src/sbml/packages/spatial/sbml/DiffusionCoefficient.cpp b/src/sbml/packages/spatial/sbml/DiffusionCoefficient.cpp index 1d4f463049..6041d4d039 100644 --- a/src/sbml/packages/spatial/sbml/DiffusionCoefficient.cpp +++ b/src/sbml/packages/spatial/sbml/DiffusionCoefficient.cpp @@ -968,7 +968,7 @@ DiffusionCoefficient::readAttributes(const XMLAttributes& attributes, msg += " is '" + mVariable + "', which does not conform to the syntax."; log->logPackageError("spatial", - SpatialDiffusionCoefficientVariableMustBeSpecies, pkgVersion, level, + SpatialDiffusionCoefficientVariableMustBeSpeciesOrParam, pkgVersion, level, version, msg, getLine(), getColumn()); } } diff --git a/src/sbml/packages/spatial/validator/SpatialSBMLError.h b/src/sbml/packages/spatial/validator/SpatialSBMLError.h index 680c656447..d6f3d502cc 100644 --- a/src/sbml/packages/spatial/validator/SpatialSBMLError.h +++ b/src/sbml/packages/spatial/validator/SpatialSBMLError.h @@ -315,7 +315,7 @@ typedef enum , SpatialDiffusionCoefficientAllowedCoreAttributes = 1223401 , SpatialDiffusionCoefficientAllowedCoreElements = 1223402 , SpatialDiffusionCoefficientAllowedAttributes = 1223403 -, SpatialDiffusionCoefficientVariableMustBeSpecies = 1223404 +, SpatialDiffusionCoefficientVariableMustBeSpeciesOrParam = 1223404 , SpatialDiffusionCoefficientTypeMustBeDiffusionKindEnum = 1223405 , SpatialDiffusionCoefficientCoordinateReference1MustBeCoordinateKindEnum= 1223406 , SpatialDiffusionCoefficientCoordinateReference2MustBeCoordinateKindEnum= 1223407 @@ -327,13 +327,15 @@ typedef enum , SpatialDiffusionCoefficientCoordinateReferenceNoYIn1D = 1223455 , SpatialDiffusionCoefficientCoordinateReferenceNoZIn2D = 1223456 , SpatialNoDiffusionCoefficientOverlap = 1223457 +, SpatialDiffusionCoefficientVariableMustNotBeSelf = 1223458 , SpatialAdvectionCoefficientAllowedCoreAttributes = 1223501 , SpatialAdvectionCoefficientAllowedCoreElements = 1223502 , SpatialAdvectionCoefficientAllowedAttributes = 1223503 -, SpatialAdvectionCoefficientVariableMustBeSpecies = 1223504 +, SpatialAdvectionCoefficientVariableMustBeSpeciesOrParam = 1223504 , SpatialAdvectionCoefficientCoordinateMustBeCoordinateKindEnum= 1223505 , SpatialAdvectionCoefficientUnits = 1223550 , SpatialAdvectionCoefficientsMustBeUnique = 1223551 +, SpatialAdvectionCoefficientVariableMustNotBeSelf = 1223552 , SpatialBoundaryConditionAllowedCoreAttributes = 1223601 , SpatialBoundaryConditionAllowedCoreElements = 1223602 , SpatialBoundaryConditionAllowedAttributes = 1223603 diff --git a/src/sbml/packages/spatial/validator/SpatialSBMLErrorTable.h b/src/sbml/packages/spatial/validator/SpatialSBMLErrorTable.h index 1cb16e7687..efca1d7c24 100644 --- a/src/sbml/packages/spatial/validator/SpatialSBMLErrorTable.h +++ b/src/sbml/packages/spatial/validator/SpatialSBMLErrorTable.h @@ -2931,12 +2931,12 @@ static const packageErrorTableEntry spatialErrorTable[] = }, // 1223404 - { SpatialDiffusionCoefficientVariableMustBeSpecies, - "The attribute 'variable' must point to Species object.", + { SpatialDiffusionCoefficientVariableMustBeSpeciesOrParam, + "The attribute 'variable' must point to Species or Parameter object.", LIBSBML_CAT_GENERAL_CONSISTENCY, LIBSBML_SEV_ERROR, "The value of the attribute 'spatial:variable' of a " - "object must be the identifier of an existing object defined in " + "object must be the identifier of an existing or object defined in " "the enclosing object.", { "L3V1 Spatial V1 Section" } @@ -3056,10 +3056,21 @@ static const packageErrorTableEntry spatialErrorTable[] = // 1223457 { SpatialNoDiffusionCoefficientOverlap, - "No overlapping diffusion coefficients for the same species.", + "No overlapping diffusion coefficients for the same species or parameter.", LIBSBML_CAT_GENERAL_CONSISTENCY, LIBSBML_SEV_ERROR, - "Any may only have a single that applies to any given cardinal axis or plane. A of type 'anisotropic' applies to the axis it references, and any plane in the that contains that axis. A of type 'tensor' applies to the plane defined by the two axes it references. A of type 'isotropic' applies to all axes and planes in the .", + "Any or may only have a single that applies to any given cardinal axis or plane. A of type 'anisotropic' applies to the axis it references, and any plane in the that contains that axis. A of type 'tensor' applies to the plane defined by the two axes it references. A of type 'isotropic' applies to all axes and planes in the .", + { "L3V1 Spatial V1 Section" + } + }, + + // 1223458 + { SpatialDiffusionCoefficientVariableMustNotBeSelf, + "The attribute 'variable' must not point to itself.", + LIBSBML_CAT_GENERAL_CONSISTENCY, + LIBSBML_SEV_ERROR, + "The value of the attribute 'spatial:variable' of a " + "object must not be the identifier of its parent .", { "L3V1 Spatial V1 Section" } }, @@ -3101,12 +3112,12 @@ static const packageErrorTableEntry spatialErrorTable[] = }, // 1223504 - { SpatialAdvectionCoefficientVariableMustBeSpecies, - "The attribute 'variable' must point to Species object.", + { SpatialAdvectionCoefficientVariableMustBeSpeciesOrParam, + "The attribute 'variable' must point to Species or Parameter object.", LIBSBML_CAT_GENERAL_CONSISTENCY, LIBSBML_SEV_ERROR, "The value of the attribute 'spatial:variable' of an " - "object must be the identifier of an existing object defined in " + "object must be the identifier of an existing or object defined in " "the enclosing object.", { "L3V1 Spatial V1 Section" } @@ -3141,7 +3152,18 @@ static const packageErrorTableEntry spatialErrorTable[] = "The 'coordinate' and 'variable' attributes must be unique.", LIBSBML_CAT_GENERAL_CONSISTENCY, LIBSBML_SEV_ERROR, - "No two elements in the same may have the same values for the attributes 'species:variable' and 'species:coordinate'. Only one advection coefficient may be defined per species per axis.", + "No two elements in the same may have the same values for the attributes 'spatial:variable' and 'spatial:coordinate'. Only one advection coefficient may be defined per species (or parameter) per axis.", + { "L3V1 Spatial V1 Section" + } + }, + + // 1223552 + { SpatialAdvectionCoefficientVariableMustNotBeSelf, + "The attribute 'variable' must not point to itself.", + LIBSBML_CAT_GENERAL_CONSISTENCY, + LIBSBML_SEV_ERROR, + "The value of the attribute 'spatial:variable' of an " + "object must not be the identifier of its parent object.", { "L3V1 Spatial V1 Section" } }, diff --git a/src/sbml/packages/spatial/validator/constraints/SpatialConsistencyConstraints.cpp b/src/sbml/packages/spatial/validator/constraints/SpatialConsistencyConstraints.cpp index 5057536885..918324dca8 100644 --- a/src/sbml/packages/spatial/validator/constraints/SpatialConsistencyConstraints.cpp +++ b/src/sbml/packages/spatial/validator/constraints/SpatialConsistencyConstraints.cpp @@ -907,7 +907,7 @@ START_CONSTRAINT(SpatialDiffusionCoefficientCoordinateReferenceNoYIn1D, Diffusio } END_CONSTRAINT -// 1223455 +// 1223456 START_CONSTRAINT(SpatialDiffusionCoefficientCoordinateReferenceNoZIn2D, DiffusionCoefficient, dc) { bool fail = false; @@ -952,12 +952,12 @@ START_CONSTRAINT(SpatialDiffusionCoefficientCoordinateReferenceNoZIn2D, Diffusio END_CONSTRAINT // 1223504 -START_CONSTRAINT(SpatialAdvectionCoefficientVariableMustBeSpecies, AdvectionCoefficient, ac) +START_CONSTRAINT(SpatialAdvectionCoefficientVariableMustBeSpeciesOrParam, AdvectionCoefficient, ac) { bool fail = false; pre(ac.isSetVariable()); - if (m.getSpecies(ac.getVariable()) == NULL) { + if (m.getSpecies(ac.getVariable()) == NULL && m.getParameter(ac.getVariable()) == NULL) { fail = true; stringstream ss_msg; ss_msg << "An "; @@ -965,7 +965,7 @@ START_CONSTRAINT(SpatialAdvectionCoefficientVariableMustBeSpecies, AdvectionCoef { ss_msg << " with id '" << ac.getId() << "'"; } - ss_msg << " references a variable '" << ac.getVariable() << "', which is not the ID of a in the ."; + ss_msg << " references a variable '" << ac.getVariable() << "', which is not the ID of a or in the ."; msg = ss_msg.str(); } @@ -974,6 +974,28 @@ START_CONSTRAINT(SpatialAdvectionCoefficientVariableMustBeSpecies, AdvectionCoef END_CONSTRAINT +// 1223552 +START_CONSTRAINT(SpatialAdvectionCoefficientVariableMustNotBeSelf, AdvectionCoefficient, ac) +{ + bool fail = false; + pre(ac.isSetVariable()); + const SBase* parent = ac.getParentSBMLObject(); + pre(parent != NULL); + pre(parent->getId() == ac.getVariable()); + + stringstream ss_msg; + ss_msg << "An "; + if (ac.isSetId()) + { + ss_msg << " with id '" << ac.getId() << "'"; + } + ss_msg << " references its parent parameter '" << ac.getVariable() << "'."; + msg = ss_msg.str(); + inv(false); +} +END_CONSTRAINT + + // 1223604 START_CONSTRAINT(SpatialBoundaryConditionVariableMustBeSpecies, BoundaryCondition, bc) { @@ -2611,22 +2633,43 @@ END_CONSTRAINT // 1223404 -START_CONSTRAINT(SpatialDiffusionCoefficientVariableMustBeSpecies, DiffusionCoefficient, dc) +START_CONSTRAINT(SpatialDiffusionCoefficientVariableMustBeSpeciesOrParam, DiffusionCoefficient, dc) { pre(dc.isSetVariable()); string variable = dc.getVariable(); - pre(m.getSpecies(variable)==NULL); + pre(m.getSpecies(variable)==NULL && m.getParameter(variable)==NULL); msg = "A "; if (dc.isSetId()) { msg += " with the id '" + dc.getId() + "'"; } - msg += " has a value of '" + variable + "' for its 'variable', but the model does not contain a with that id."; + msg += " has a value of '" + variable + "' for its 'variable', but the model does not contain a or with that id."; inv(false); } END_CONSTRAINT +// 1223458 +START_CONSTRAINT(SpatialDiffusionCoefficientVariableMustNotBeSelf, DiffusionCoefficient, dc) +{ + pre(dc.isSetVariable()); + const SBase* parent = dc.getParentSBMLObject(); + pre(parent != NULL); + pre(parent->getId() == dc.getVariable()); + + stringstream ss_msg; + ss_msg << "A "; + if (dc.isSetId()) + { + ss_msg << " with id '" << dc.getId() << "'"; + } + ss_msg << " references its parent parameter '" << dc.getVariable() << "'."; + msg = ss_msg.str(); + inv(false); +} +END_CONSTRAINT + + // 1223606 START_CONSTRAINT(SpatialBoundaryConditionCoordinateBoundaryMustBeBoundary, BoundaryCondition, bc) { diff --git a/src/sbml/packages/spatial/validator/constraints/SpatialConsistencyConstraintsDeclared.cxx b/src/sbml/packages/spatial/validator/constraints/SpatialConsistencyConstraintsDeclared.cxx index 29cd6b664a..445801c606 100644 --- a/src/sbml/packages/spatial/validator/constraints/SpatialConsistencyConstraintsDeclared.cxx +++ b/src/sbml/packages/spatial/validator/constraints/SpatialConsistencyConstraintsDeclared.cxx @@ -76,7 +76,8 @@ addConstraint(new VConstraintDiffusionCoefficientSpatialDiffusionCoefficientOneC addConstraint(new VConstraintDiffusionCoefficientSpatialDiffusionCoefficientCoordinateReferenceDifference(*this)); addConstraint(new VConstraintDiffusionCoefficientSpatialDiffusionCoefficientCoordinateReferenceNoYIn1D(*this)); addConstraint(new VConstraintDiffusionCoefficientSpatialDiffusionCoefficientCoordinateReferenceNoZIn2D(*this)); -addConstraint(new VConstraintAdvectionCoefficientSpatialAdvectionCoefficientVariableMustBeSpecies(*this)); +addConstraint(new VConstraintAdvectionCoefficientSpatialAdvectionCoefficientVariableMustBeSpeciesOrParam(*this)); +addConstraint(new VConstraintAdvectionCoefficientSpatialAdvectionCoefficientVariableMustNotBeSelf(*this)); addConstraint(new VConstraintBoundaryConditionSpatialBoundaryConditionVariableMustBeSpecies(*this)); addConstraint(new VConstraintCoordinateComponentSpatialBoundaryMinLessThanMax(*this)); addConstraint(new VConstraintParameterSpatialBoundaryMustBeConstant(*this)); @@ -133,7 +134,8 @@ addConstraint(new VConstraintAnalyticVolumeSpatialAnalyticVolumeDomainTypeMustBe addConstraint(new VConstraintParametricObjectSpatialParametricObjectDomainTypeMustBeDomainType(*this)); addConstraint(new VConstraintCSGObjectSpatialCSGObjectDomainTypeMustBeDomainType(*this)); addConstraint(new VConstraintBoundaryConditionSpatialBoundaryConditionBoundaryDomainTypeMustBeDomainType(*this)); -addConstraint(new VConstraintDiffusionCoefficientSpatialDiffusionCoefficientVariableMustBeSpecies(*this)); +addConstraint(new VConstraintDiffusionCoefficientSpatialDiffusionCoefficientVariableMustBeSpeciesOrParam(*this)); +addConstraint(new VConstraintDiffusionCoefficientSpatialDiffusionCoefficientVariableMustNotBeSelf(*this)); addConstraint(new VConstraintBoundaryConditionSpatialBoundaryConditionCoordinateBoundaryMustBeBoundary(*this)); addConstraint(new VConstraintGeometrySpatialOneGeometryDefinitionMustBeActive(*this)); addConstraint(new VConstraintBoundaryConditionSpatialBoundaryConditionBoundaryDomainTypeOrCoordinateBoundary(*this)); diff --git a/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223404-fail-01-02.xml b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223404-fail-01-02.xml index 13d16365dc..d54d905a13 100644 --- a/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223404-fail-01-02.xml +++ b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223404-fail-01-02.xml @@ -66,9 +66,21 @@ + + + + + + + + 2 + + + + - + diff --git a/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223404-pass-00-02.xml b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223404-pass-00-02.xml new file mode 100644 index 0000000000..3853a72908 --- /dev/null +++ b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223404-pass-00-02.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223404-pass-00-03.xml b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223404-pass-00-03.xml new file mode 100644 index 0000000000..03f50aace1 --- /dev/null +++ b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223404-pass-00-03.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223458-fail-01-01.xml b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223458-fail-01-01.xml new file mode 100644 index 0000000000..2755583125 --- /dev/null +++ b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223458-fail-01-01.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + diff --git a/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223458-pass-00-01.xml b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223458-pass-00-01.xml new file mode 100644 index 0000000000..3853a72908 --- /dev/null +++ b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223458-pass-00-01.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223504-pass-00-02.xml b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223504-pass-00-02.xml new file mode 100644 index 0000000000..ffe1e11d60 --- /dev/null +++ b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223504-pass-00-02.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223504-pass-00-03.xml b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223504-pass-00-03.xml new file mode 100644 index 0000000000..d59b155ff7 --- /dev/null +++ b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223504-pass-00-03.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223504-pass-00-04.xml b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223504-pass-00-04.xml new file mode 100644 index 0000000000..ab91427f19 --- /dev/null +++ b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223504-pass-00-04.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223552-fail-01-01.xml b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223552-fail-01-01.xml new file mode 100644 index 0000000000..1109a53ff9 --- /dev/null +++ b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223552-fail-01-01.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223552-pass-00-01.xml b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223552-pass-00-01.xml new file mode 100644 index 0000000000..e7ba58402c --- /dev/null +++ b/src/sbml/packages/spatial/validator/test/test-data/general-constraints/1223552-pass-00-01.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +