/** @cond doxygenLibsbmlInternal */
void RenderPoint::readAttributes (const XMLAttributes& attributes, const ExpectedAttributes& expectedAttributes)
{
  SBase::readAttributes(attributes, expectedAttributes);
    std::string s;
    if(attributes.readInto("x",s, getErrorLog(), false, getLine(), getColumn()))
    {
        this->mXOffset=RelAbsVector(s);
    }
    else
    {
        this->mXOffset=RelAbsVector(std::numeric_limits<double>::quiet_NaN(),std::numeric_limits<double>::quiet_NaN());   
    }
    if(attributes.readInto("y",s, getErrorLog(), false, getLine(), getColumn()))
    {
        this->mYOffset=RelAbsVector(s);
    }
    else
    {
        this->mYOffset=RelAbsVector(std::numeric_limits<double>::quiet_NaN(),std::numeric_limits<double>::quiet_NaN());   
    }
    if(attributes.readInto("z",s, getErrorLog(), false, getLine(), getColumn()))
    {
        this->mZOffset=RelAbsVector(s);
    }
    else
    {
        this->mZOffset=RelAbsVector(0.0,0.0);
    }
}
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 */
void
CompositeDescription::readAttributes (const XMLAttributes& attributes)
{
	NMBase::readAttributes(attributes);

	const unsigned int level   = NMBase::getLevel  ();
	const unsigned int version = NMBase::getVersion();

	std::vector<std::string> expectedAttributes;
	expectedAttributes.clear();
	expectedAttributes.push_back("metaid");
	expectedAttributes.push_back("id");
	expectedAttributes.push_back("name");
	expectedAttributes.push_back("ontologyTerm");
	expectedAttributes.push_back("indexType");

	// check that all attributes are expected
	for (int i = 0; i < attributes.getLength(); i++)
	{
		std::vector<std::string>::const_iterator end = expectedAttributes.end();
		std::vector<std::string>::const_iterator begin = expectedAttributes.begin();

		std::string name = attributes.getName(i);
		if (std::find(begin, end, name) == end)
		{
			logUnknownAttribute(name, level, version, "<compositeDescription>");
		}
	}
	attributes.readInto("id", mId);
	attributes.readInto("name", mName);
	attributes.readInto("ontologyTerm", mOntologyTerm);
	attributes.readInto("indexType", mIndexType);

}
Example #3
0
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 */
void
Trigger::readL3Attributes (const XMLAttributes& attributes)
{
  const unsigned int level   = getLevel  ();
  const unsigned int version = getVersion();

  //
  // initailValue { use="required"}  (L3v1 ->)
  //
  mIsSetInitialValue = attributes.readInto("initialValue", 
                        mInitialValue, getErrorLog(), false, getLine(), getColumn());

  if (!mIsSetInitialValue)
  {
    logError(AllowedAttributesOnTrigger, level, version, 
             "The required attribute 'initialValue' is missing.");
  }

  //
  // persistent { use="required"}  (L3v1 ->)
  //
  mIsSetPersistent = attributes.readInto("persistent", 
                        mPersistent, getErrorLog(), false, getLine(), getColumn());

  if (!mIsSetPersistent)
  {
    logError(AllowedAttributesOnTrigger, level, version, 
             "The required attribute 'persistent' is missing.");
  }
}
Example #4
0
/*
 * Read values from the given XMLAttributes set into their specific fields.
 */
void
SedSubTask::readAttributes(const XMLAttributes& attributes,
                           const ExpectedAttributes& expectedAttributes)
{
  SedBase::readAttributes(attributes, expectedAttributes);

  bool assigned = false;

  //
  // order int   ( use = "required" )
  //
  mIsSetOrder = attributes.readInto("order", mOrder, getErrorLog(), true);

  //
  // task SIdRef   ( use = "required" )
  //
  assigned = attributes.readInto("task", mTask, getErrorLog(), true);

  if (assigned == true)
    {
      // check string is not empty and correct syntax

      if (mTask.empty() == true)
        {
          logEmptyString(mTask, getLevel(), getVersion(), "<SedSubTask>");
        }
      else if (SyntaxChecker::isValidSBMLSId(mTask) == false)
        {
          logError(SedInvalidIdSyntax);
        }
    }

}
/** @cond doxygenLibsbmlInternal */
void
GeneAssociation::readAttributes (const XMLAttributes& attributes,
                        const ExpectedAttributes& expectedAttributes)
{
  SBase::readAttributes(attributes,expectedAttributes);

  const unsigned int sbmlLevel   = getLevel  ();
  const unsigned int sbmlVersion = getVersion();

  bool assigned = attributes.readInto("id", mId, getErrorLog(), true, getLine(), getColumn());
  if (assigned && mId.empty())
  {
    logEmptyString(mId, sbmlLevel, sbmlVersion, "<geneAssociation>");
  }
  if (!SyntaxChecker::isValidSBMLSId(mId)) 
    logError(InvalidIdSyntax, sbmlLevel, sbmlVersion, "The id '" + mId + "' does not conform to the syntax.");

  assigned = attributes.readInto("reaction", mReaction, getErrorLog(), true, getLine(), getColumn());
  if (assigned && mReaction.empty())
  {
    logEmptyString(mReaction, sbmlLevel, sbmlVersion, "<geneAssociation>");
  }
  if (!SyntaxChecker::isValidSBMLSId(mReaction)) 
    logError(InvalidIdSyntax, getLevel(), getVersion(), 
    "The syntax of the attribute reaction='" + mReaction + "' does not conform.");
}
Example #6
0
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 */
void
Domain::readAttributes (const XMLAttributes& attributes,
                        const ExpectedAttributes& expectedAttributes)
{
  SBase::readAttributes(attributes,expectedAttributes);

  const unsigned int sbmlLevel   = getLevel  ();
  const unsigned int sbmlVersion = getVersion();

  bool assigned = attributes.readInto("spatialId", mSpatialId, getErrorLog(), true, getLine(), getColumn());
  if (assigned && mSpatialId.empty())
  {
    logEmptyString(mSpatialId, sbmlLevel, sbmlVersion, "<Domain>");
  }
  if (!SyntaxChecker::isValidSBMLSId(mSpatialId)) 
    logError(InvalidIdSyntax, getLevel(), getVersion(), 
    "The syntax of the attribute spatialId='" + mSpatialId + "' does not conform.");

  assigned = attributes.readInto("domainType", mDomainType, getErrorLog(), true, getLine(), getColumn());
  if (assigned && mDomainType.empty())
  {
    logEmptyString(mDomainType, sbmlLevel, sbmlVersion, "<Domain>");
  }
  if (!SyntaxChecker::isValidSBMLSId(mDomainType)) 
    logError(InvalidIdSyntax, getLevel(), getVersion(), 
    "The syntax of the attribute domainType='" + mDomainType + "' does not conform.");
  
}
Example #7
0
/*
 * Read values from the given XMLAttributes set into their specific fields.
 */
void
SedRepeatedTask::readAttributes (const XMLAttributes& attributes,
                             const ExpectedAttributes& expectedAttributes)
{
	SedTask::readAttributes(attributes, expectedAttributes);

	bool assigned = false;

	//
	// rangeId SIdRef   ( use = "optional" )
	//
	assigned = attributes.readInto("range", mRangeId, getErrorLog(), false);

	if (assigned == true)
	{
		// check string is not empty and correct syntax

		if (mRangeId.empty() == true)
		{
			logEmptyString(mRangeId, getLevel(), getVersion(), "<SedRepeatedTask>");
		}
		else if (SyntaxChecker::isValidSBMLSId(mRangeId) == false)
		{
			logError(SedInvalidIdSyntax);
		}
	}

	//
	// resetModel bool   ( use = "optional" )
	//
	mIsSetResetModel = attributes.readInto("resetModel", mResetModel, getErrorLog(), false);

}
Example #8
0
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 */
void
DomainType::readAttributes (const XMLAttributes& attributes,
                        const ExpectedAttributes& expectedAttributes)
{
  SBase::readAttributes(attributes,expectedAttributes);

  const unsigned int sbmlLevel   = getLevel  ();
  const unsigned int sbmlVersion = getVersion();

  bool assigned = attributes.readInto("spatialId", mSpatialId, getErrorLog(), true, getLine(), getColumn());
  if (assigned && mSpatialId.empty())
  {
    logEmptyString(mSpatialId, sbmlLevel, sbmlVersion, "<DomainType>");
  }
  if (!SyntaxChecker::isValidSBMLSId(mSpatialId)) 
    logError(InvalidIdSyntax, getLevel(), getVersion(), 
    "The syntax of the attribute spatialId='" + mSpatialId + "' does not conform.");

  //
  // spatialDimensions { maxInclusive="3" minInclusive="0" use="optional"
  //                     default="3" }  (L2v1 ->)
  // spatialDimensions { use="optional"}  (L3v1 ->)
  //
  mIsSetSpatialDimensions= attributes.readInto("spatialDimensions", mSpatialDimensions, getErrorLog(), false, getLine(), getColumn());
  if (mSpatialDimensions > 3)
  {
    std::string message = "The spatialDimensions attribute on ";
    message += "a <DomainType> may only have values 0, 1, 2 or 3.";
    getErrorLog()->logError(NotSchemaConformant, sbmlLevel, sbmlVersion, message);
  }
}
/** @cond doxygenLibsbmlInternal */
void RenderCurve::readAttributes (const XMLAttributes& attributes, const ExpectedAttributes& expectedAttributes)
{
  GraphicalPrimitive1D::readAttributes(attributes, expectedAttributes);
    std::string s;
    attributes.readInto("startHead", this->mStartHead, getErrorLog(), false, getLine(), getColumn());
    attributes.readInto("endHead", this->mEndHead, getErrorLog(), false, getLine(), getColumn());
}
Example #10
0
/*
 * Read values from the given XMLAttributes set into their specific fields.
 */
void
SedUniformTimeCourse::readAttributes (const XMLAttributes& attributes,
                             const ExpectedAttributes& expectedAttributes)
{
	SedSimulation::readAttributes(attributes, expectedAttributes);

	bool assigned = false;

	//
	// initialTime double   ( use = "required" )
	//
	mIsSetInitialTime = attributes.readInto("initialTime", mInitialTime, getErrorLog(), true);

	//
	// outputStartTime double   ( use = "required" )
	//
	mIsSetOutputStartTime = attributes.readInto("outputStartTime", mOutputStartTime, getErrorLog(), true);

	//
	// outputEndTime double   ( use = "required" )
	//
	mIsSetOutputEndTime = attributes.readInto("outputEndTime", mOutputEndTime, getErrorLog(), true);

	//
	// numberOfPoints int   ( use = "required" )
	//
	mIsSetNumberOfPoints = attributes.readInto("numberOfPoints", mNumberOfPoints, getErrorLog(), true);

}
void SpeciesReferenceGlyph::readAttributes (const XMLAttributes& attributes,
                                            const ExpectedAttributes& expectedAttributes)
{
  GraphicalObject::readAttributes(attributes,expectedAttributes);

  const unsigned int sbmlLevel   = getLevel  ();
  const unsigned int sbmlVersion = getVersion();

  bool assigned = attributes.readInto("speciesReference", mSpeciesReference);
  if (assigned && mSpeciesReference.empty())
  {
    logEmptyString(mSpeciesReference, sbmlLevel, sbmlVersion, "<" + getElementName() + ">");
  }
  if (!SyntaxChecker::isValidInternalSId(mSpeciesReference)) logError(InvalidIdSyntax);

  assigned = attributes.readInto("speciesGlyph", mSpeciesGlyph);
  if (assigned && mSpeciesGlyph.empty())
  {
    logEmptyString(mSpeciesGlyph, sbmlLevel, sbmlVersion, "<" + getElementName() + ">");
  }
  if (!SyntaxChecker::isValidInternalSId(mSpeciesGlyph)) logError(InvalidIdSyntax);  
  
  std::string role;
  if(attributes.readInto("role", role))
  {
    this->setRole(role);
  }
  else
  {
    this->setRole(SPECIES_ROLE_UNDEFINED);
  }
  
}
Example #12
0
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 */
void
DiffusionCoefficient::readAttributes (const XMLAttributes& attributes,
                        const ExpectedAttributes& expectedAttributes)
{
  SBase::readAttributes(attributes,expectedAttributes);

  const unsigned int sbmlLevel   = getLevel  ();
  const unsigned int sbmlVersion = getVersion();

  bool assigned = attributes.readInto("variable", mVariable, getErrorLog(), true, getLine(), getColumn());
  if (assigned && mVariable.empty())
  {
    logEmptyString(mVariable, sbmlLevel, sbmlVersion, "<DiffusionCoefficient>");
  }
  if (!SyntaxChecker::isValidSBMLSId(mVariable)) 
    logError(InvalidIdSyntax, getLevel(), getVersion(), 
    "The syntax of the attribute variable='" + mVariable + "' does not conform.");

  mIsSetCoordinateIndex = attributes.readInto("coordinateIndex", mCoordinateIndex, getErrorLog(), false, getLine(), getColumn());
  /*if (mCoordinateIndex < 0)
  {
    std::string message = "The coordinateIndex attribute on ";
    message += "a <DiffusionCoefficient> can only have values > 0.";
    getErrorLog()->logError(NotSchemaConformant, sbmlLevel, sbmlVersion, message);
  }*/
}
Example #13
0
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 *
 * @param attributes the XMLAttributes object to use
 */
void
Parameter::readL3Attributes (const XMLAttributes& attributes)
{
  const unsigned int level   = getLevel  ();
  const unsigned int version = getVersion();

  //   id: SId     { use="required" }  (L2v1, L2v2)
  //
  bool assigned = attributes.readInto("id", mId, getErrorLog(), false, getLine(), getColumn());
  if (!assigned)
  {
    if (this->getTypeCode() == SBML_PARAMETER)
    {
      logError(AllowedAttributesOnParameter, level, version);
    }
    else
    {
      logError(AllowedAttributesOnLocalParameter, 
                              level, version);
    }
  }
  if (assigned && mId.size() == 0)
  {
    logEmptyString("id", level, version, "<parameter>");
  }
  if (!SyntaxChecker::isValidInternalSId(mId)) logError(InvalidIdSyntax);

  //
  // value: double  { use="optional" }  (L1v2->)
  //
  mIsSetValue = attributes.readInto("value", mValue, getErrorLog(), false, getLine(), getColumn());

  //
  // units: SId    { use="optional" }  (L2v1, L2v2)
  //
  assigned = attributes.readInto("units", mUnits, getErrorLog(), false, getLine(), getColumn());
  if (assigned && mUnits.size() == 0)
  {
    logEmptyString("units", level, version, "<parameter>");
  }
  if (!SyntaxChecker::isValidInternalUnitSId(mUnits))
  {
    logError(InvalidUnitIdSyntax);
  }

  //
  // name: string  { use="optional" }  (L2v1 ->)
  //
  attributes.readInto("name", mName, getErrorLog(), false, getLine(), getColumn());

  if (this->getTypeCode() == SBML_PARAMETER)
  {
    mIsSetConstant = attributes.readInto("constant", mConstant,
                                          getErrorLog(), false, getLine(), getColumn());
    if (!mIsSetConstant)
    {
      logError(AllowedAttributesOnParameter, level, version);
    }
  }
}
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 */
void
SpeciesReference::readL1Attributes (const XMLAttributes& attributes)
{
  //
  // stoichiometry: integer  { use="optional" default="1" }  (L1v1, L1v2)
  // stoichiometry: double   { use="optional" default="1" }  (L2v1->)
  //
  mIsSetStoichiometry = attributes.readInto("stoichiometry", mStoichiometry, getErrorLog(), false, getLine(), getColumn());
  if (!mIsSetStoichiometry)
  {
    //  
    // setting default value
    //
    mStoichiometry = 1;
    mIsSetStoichiometry = true;
  }
  else
  {
    mExplicitlySetStoichiometry = true;
  }

  //
  // denominator: integer  { use="optional" default="1" }  (L1v1, L1v2)
  //
  mExplicitlySetDenominator = attributes.readInto("denominator", mDenominator,getErrorLog(), false, getLine(), getColumn());

}
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 */
void
SpeciesReference::readL3Attributes (const XMLAttributes& attributes)
{
  const unsigned int level = 3;
  const unsigned int version = getVersion();
  //
  // stoichiometry: double   { use="optional" default="1" }  (L2v1->)
  //
  mIsSetStoichiometry = attributes.readInto("stoichiometry", mStoichiometry, getErrorLog(), false, getLine(), getColumn());

  string elplusid = "<" + getElementName() + ">";
  if (!mId.empty()) {
    elplusid += " with the id '" + mId + "'";
  }
  SBase* rxn = getAncestorOfType(SBML_REACTION);
  if (rxn && rxn->isSetId()) 
  {
    elplusid += " from the <reaction> with the id '" + rxn->getId() + "'";
  }
  //
  // constant: bool { use="required" } (L3v1 -> )
  //
  mIsSetConstant = attributes.readInto("constant", mConstant, getErrorLog(), false, getLine(), getColumn());
  if (!mIsSetConstant && !isModifier())
  {
    logError(AllowedAttributesOnSpeciesReference, level, version, 
             "The required attribute 'constant' is missing from the "
             + elplusid + ".");
  }

}
/** @cond doxygenLibsbmlInternal */
void ColorDefinition::readAttributes (const XMLAttributes& attributes, const ExpectedAttributes& expectedAttributes)
{
  SBase::readAttributes(attributes,expectedAttributes);
  std::string valueString;
  attributes.readInto("id", mId, getErrorLog(), false, getLine(), getColumn());
  attributes.readInto("value", valueString, getErrorLog(), false, getLine(), getColumn());
  this->setColorValue(valueString);
}
Example #17
0
/** @cond doxygenLibsbmlInternal */
void Style::readAttributes (const XMLAttributes& attributes, const ExpectedAttributes& expectedAttributes)
{
    SBase::readAttributes(attributes, expectedAttributes);
    attributes.readInto("id", mId, getErrorLog(), false, getLine(), getColumn());
    attributes.readInto("name", mName, getErrorLog(), false, getLine(), getColumn());
    readListOfRoles(attributes);
    readListOfTypes(attributes);
}
Example #18
0
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 */
void
CSGScale::readAttributes (const XMLAttributes& attributes,
                        const ExpectedAttributes& expectedAttributes)
{
  CSGTransformation::readAttributes(attributes,expectedAttributes);

  mIsSetScaleX = attributes.readInto("scaleX", mScaleX, getErrorLog(), true, getLine(), getColumn());
  mIsSetScaleY = attributes.readInto("scaleY", mScaleY, getErrorLog(), true, getLine(), getColumn());
  mIsSetScaleZ = attributes.readInto("scaleZ", mScaleZ, getErrorLog(), true, getLine(), getColumn());

}
Example #19
0
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 */
void
Event::readL2Attributes (const XMLAttributes& attributes)
{
  const unsigned int level = getLevel();
  const unsigned int version = getVersion();
  //
  // id: SId  { use="optional" }  (L2v1 ->)
  //
  bool assigned = attributes.readInto("id", mId, getErrorLog(), false, getLine(), getColumn());
  if (assigned && mId.size() == 0)
  {
    logEmptyString("id", level, version, "<event>");
  }
  if (!SyntaxChecker::isValidInternalSId(mId)) logError(InvalidIdSyntax);

  //
  // name: string  { use="optional" }  (L2v1 ->)
  //
  attributes.readInto("name", mName, getErrorLog(), false, getLine(), getColumn());

  //
  // timeUnits: SId  { use="optional" }  (L2v1, L2v2)
  // removed in l2v3
  //
  if (version < 3)
  {
    assigned = attributes.readInto("timeUnits", mTimeUnits, getErrorLog(), false, getLine(), getColumn());
    if (assigned && mTimeUnits.size() == 0)
    {
      logEmptyString("timeUnits", level, version, "<event>");
    }
    if (!SyntaxChecker::isValidInternalUnitSId(mTimeUnits))
    {
      logError(InvalidUnitIdSyntax);
    }
  }

  //
  // sboTerm: SBOTerm { use="optional" }  (L2v2 ->)
  //
  if (version == 2) 
    mSBOTerm = SBO::readTerm(attributes, this->getErrorLog(), level, version,
				getLine(), getColumn());

  //
  // useValuesFromTriggerTime: bool {use="optional" default="true"} (L2V4 ->)
  // useValuesFromTriggerTime: bool {use="optional" } (L3 ->)
  //
  if (version  == 4)
  {
    mExplicitlySetUVFTT = attributes.readInto("useValuesFromTriggerTime", 
                                                mUseValuesFromTriggerTime, getErrorLog(), false, getLine(), getColumn());
  }
}
Example #20
0
void Point::readAttributes (const XMLAttributes& attributes)
{
  SBase::readAttributes(attributes);

  attributes.readInto("x", mXOffset,this->getErrorLog(),true);
  attributes.readInto("y", mYOffset,this->getErrorLog(),true);
  if(!attributes.readInto("z", mZOffset))
  {
      this->mZOffset=0.0;
  }
}
/** @cond doxygenLibsbmlInternal */
void
ReplacedElement::readAttributes (const XMLAttributes& attributes,
                                 const ExpectedAttributes& expectedAttributes)
{
  const unsigned int sbmlLevel   = getLevel  ();
  const unsigned int sbmlVersion = getVersion();

  // look to see whether an unknown attribute error was logged
  // during the read of the ListOfReplacedElements - which will have
  // happened immediately prior to this read
  if (getErrorLog() != NULL && 
    static_cast<ListOfReplacedElements*>(getParentSBMLObject())->size() < 2)
  {
    unsigned int numErrs = getErrorLog()->getNumErrors();
    for (int n = numErrs-1; n >= 0; n--)      
    {
      if (getErrorLog()->getError(n)->getErrorId() == UnknownPackageAttribute)
      {
        const std::string details = 
          getErrorLog()->getError(n)->getMessage();
        getErrorLog()->remove(UnknownPackageAttribute);
        getErrorLog()->logPackageError("comp", CompLOReplacedElementsAllowedAttribs,
          getPackageVersion(), sbmlLevel, sbmlVersion, details);
      } 
      else if (getErrorLog()->getError(n)->getErrorId() == UnknownCoreAttribute)
      {
        const std::string details = 
          getErrorLog()->getError(n)->getMessage();
        getErrorLog()->remove(UnknownCoreAttribute);
        getErrorLog()->logPackageError("comp", CompLOReplacedElementsAllowedAttribs,
          getPackageVersion(), sbmlLevel, sbmlVersion, details);
      } 
    }
  }


  XMLTriple tripleDeletion("deletion", mURI, getPrefix());
  if (attributes.readInto(tripleDeletion, mDeletion, getErrorLog(), false, getLine(), getColumn())) {
    if (!SyntaxChecker::isValidSBMLSId(mDeletion)) {
      logInvalidId("comp:deletion", mDeletion);
    }
  }
  XMLTriple tripleConversionFactor("conversionFactor", mURI, getPrefix());
  if(attributes.readInto(tripleConversionFactor, mConversionFactor, getErrorLog(), false, getLine(), getColumn())) {
    if (!SyntaxChecker::isValidSBMLSId(mConversionFactor)) {
      logInvalidId("comp:conversionFactor", mConversionFactor);
    }
  }

  //We call the base class version here because of the error checking for having set exactly one of the mutually-exclusive attributes, and two of them (deletion and conversionFactor) only exist for ReplacedElements, not SBaseRef.
  Replacing::readAttributes(attributes,expectedAttributes);
}
Example #22
0
void 
SpatialSpeciesRxnPlugin::readAttributes (const XMLAttributes& attributes,
                                    const ExpectedAttributes& expectedAttributes)
{
  SBasePlugin::readAttributes(attributes, expectedAttributes);
  
  mIsSetSpatial = attributes.readInto("isSpatial", mIsSpatial, getErrorLog(), 
    mParent != NULL && mParent->getTypeCode() == SBML_SPECIES, 
    getLine(), getColumn());
  mIsSetLocal = attributes.readInto("isLocal", mIsLocal, getErrorLog(), 
    mParent != NULL && mParent->getTypeCode() == SBML_REACTION, 
    getLine(), getColumn());
}
Example #23
0
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 *
 * @param attributes the XMLAttributes object to use
 */
void
Parameter::readL2Attributes (const XMLAttributes& attributes)
{
  const unsigned int level   = getLevel  ();
  const unsigned int version = getVersion();

  //   id: SId     { use="required" }  (L2v1, L2v2)
  //
  bool assigned = attributes.readInto("id", mId, getErrorLog(), true, getLine(), getColumn());
  if (assigned && mId.size() == 0)
  {
    logEmptyString("id", level, version, "<parameter>");
  }
  if (!SyntaxChecker::isValidInternalSId(mId)) logError(InvalidIdSyntax);

  //
  // value: double  { use="optional" }  (L1v2->)
  //
  mIsSetValue = attributes.readInto("value", mValue, getErrorLog(), false, getLine(), getColumn());

  //
  // units: SId    { use="optional" }  (L2v1, L2v2)
  //
  assigned = attributes.readInto("units", mUnits, getErrorLog(), false, getLine(), getColumn());
  if (assigned && mUnits.size() == 0)
  {
    logEmptyString("units", level, version, "<parameter>");
  }
  if (!SyntaxChecker::isValidInternalUnitSId(mUnits))
  {
    logError(InvalidUnitIdSyntax);
  }

  //
  // name: string  { use="optional" }  (L2v1 ->)
  //
  attributes.readInto("name", mName, getErrorLog(), false, getLine(), getColumn());

  //
  // constant: boolean  { use="optional" default="true" }  (L2v1->)
  //
  mExplicitlySetConstant = attributes.readInto("constant", mConstant, getErrorLog(), false, getLine(), getColumn());

  //
  // sboTerm: SBOTerm { use="optional" }  (L2v2->)
  //
  if (version == 2) 
    mSBOTerm = SBO::readTerm(attributes, this->getErrorLog(), level, version,
				getLine(), getColumn());

}
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 */
void
InitialAssignment::readL2Attributes (const XMLAttributes& attributes)
{
    const unsigned int level   = getLevel  ();
    const unsigned int version = getVersion();

    //
    // symbol: SId  { use="required" }  (L2v2 -> )
    //
    bool assigned = attributes.readInto("symbol", mSymbol, getErrorLog(), true, getLine(), getColumn());
    if (assigned && mSymbol.size() == 0)
    {
        logEmptyString("symbol", level, version, "<initialAssignment>");
    }
    if (!SyntaxChecker::isValidInternalSId(mSymbol))
        logError(InvalidIdSyntax, getLevel(), getVersion(),
                 "The syntax of the attribute symbol='" + mSymbol + "' does not conform to the syntax.");

    //
    // sboTerm: SBOTerm { use="optional" }  (L2v2 ->)
    //
    if (version == 2)
        mSBOTerm = SBO::readTerm(attributes, this->getErrorLog(), level, version,
                                 getLine(), getColumn());
}
Example #25
0
/** @cond doxygenLibsbmlInternal */
void
Replacing::readAttributes (const XMLAttributes& attributes,
                                 const ExpectedAttributes& expectedAttributes)
{
  const unsigned int sbmlLevel   = getLevel  ();
  const unsigned int sbmlVersion = getVersion();

  XMLTriple tripleSubmodelRef("submodelRef", mURI, getPrefix());
  bool assigned = attributes.readInto(tripleSubmodelRef, mSubmodelRef);
  if (assigned == false)
  {
    if (getElementName() == "replacedElement")
    {
      std::string message = "Comp attribute 'submodelRef' is missing.";
      getErrorLog()->logPackageError("comp", CompReplacedElementAllowedAttributes, 
        getPackageVersion(), sbmlLevel, sbmlVersion, message);
    }
    else
    {
      std::string message = "Comp attribute 'submodelRef' is missing.";
      getErrorLog()->logPackageError("comp", CompReplacedByAllowedAttributes, 
        getPackageVersion(), sbmlLevel, sbmlVersion, message);
    }
  }
  else
  {
     if (!SyntaxChecker::isValidSBMLSId(mSubmodelRef)) 
     {
      logInvalidId("comp:submodelRef", mSubmodelRef);
     }
  }
  //We call the base class version here because of the error checking for having set exactly one of the mutually-exclusive attributes, and one of them (deletion) only exists for Replacings, not SBaseRef.
  SBaseRef::readAttributes(attributes,expectedAttributes);
}
void 
SBMLDocumentPlugin::readAttributes (const XMLAttributes& attributes,
                                    const ExpectedAttributes& expectedAttributes)
{
  if (&attributes == NULL || &expectedAttributes == NULL ) return;
  
  SBasePlugin::readAttributes(attributes, expectedAttributes);

  if ( mSBMLExt->getLevel(mURI) > 2)
  {  
    // check level of document version smaller than plugin
    // and report invalid if it is
    if (this->getSBMLDocument() != NULL &&
        this->getSBMLDocument()->getLevel() < mSBMLExt->getLevel(mURI))
    {
      // we should not have a package ns in an l2 document
      this->getSBMLDocument()->getErrorLog()->logError(L3PackageOnLowerSBML, 
                                      this->getSBMLDocument()->getLevel(), 
                                      this->getSBMLDocument()->getVersion());
    }
    else
    {
      XMLTriple tripleRequired("required", mURI, mPrefix);
      if (attributes.readInto(tripleRequired, mRequired, getErrorLog(), 
                              true, getLine(), getColumn())) 
      {
        mIsSetRequired = true;
      }
    }
  }
}
Example #27
0
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 */
void
Rule::readL2Attributes (const XMLAttributes& attributes)
{
  const unsigned int level   = getLevel  ();
  const unsigned int version = getVersion();

  if (isAssignment() || isRate())
  {
    //
    // variable: SId  { use="required" }  (L2v1 ->)
    //
    bool assigned = attributes.readInto("variable", mVariable, getErrorLog(), true, getLine(), getColumn());
    if (assigned && mVariable.size() == 0)
    {
      logEmptyString("variable", level, version, "<rule>");
    }
    if (!SyntaxChecker::isValidInternalSId(mVariable)) 
      logError(InvalidIdSyntax, level, version, "The id '" + mVariable + "' does not conform to the syntax.");
  }

  //
  // sboTerm: SBOTerm { use="optional" }  (L2v2 ->)
  //
  if (version == 2) 
    mSBOTerm = SBO::readTerm(attributes, this->getErrorLog(), level, version,
				getLine(), getColumn());
}
Example #28
0
bool 
ASTCnBase::readAttributes(const XMLAttributes& attributes,
                       const ExpectedAttributes& expectedAttributes,
                               XMLInputStream& stream, const XMLToken& element)
{
  bool read = ASTBase::readAttributes(attributes, expectedAttributes,
                                      stream, element);

  if (read == false)
  {
    return read;
  }

  string units;
  attributes.readInto( "units"        , units );

  // cannot put up the prefix here as we need the stream
  // to establish the sbml ns uri
  if (!units.empty())
  {
    setUnits(units);
  }

  return true;
}
Example #29
0
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.  Be sure to call your
 * parents implementation of this method as well.
 */
void
Rule::readL3Attributes (const XMLAttributes& attributes)
{
  const unsigned int level   = getLevel  ();
  const unsigned int version = getVersion();

  if (isAssignment() || isRate())
  {
    //
    // variable: SId  { use="required" }  (L2v1 ->)
    //
    bool assigned = attributes.readInto("variable", mVariable, getErrorLog(), false, getLine(), getColumn());
    if (!assigned)
    {
      if (isAssignment())
        logError(AllowedAttributesOnAssignRule, level, 
                                version, "The required attribute 'variable' is missing.");
      else
        logError(AllowedAttributesOnRateRule, level, 
                                version, "The required attribute 'variable' is missing.");

    }
    if (assigned && mVariable.size() == 0)
    {
      logEmptyString("variable", level, version, "<rule>");
    }
    if (!SyntaxChecker::isValidInternalSId(mVariable)) 
      logError(InvalidIdSyntax, level, version, "The id '" + mVariable + "' does not conform to the syntax.");
  }
}
Example #30
0
/*
 * Read values from the given XMLAttributes set into their specific fields.
 */
void
SedFunctionalRange::readAttributes(const XMLAttributes& attributes,
                                   const ExpectedAttributes& expectedAttributes)
{
  SedRange::readAttributes(attributes, expectedAttributes);

  bool assigned = false;

  //
  // range SIdRef   ( use = "required" )
  //
  assigned = attributes.readInto("range", mRange, getErrorLog(), true);

  if (assigned == true)
    {
      // check string is not empty and correct syntax

      if (mRange.empty() == true)
        {
          logEmptyString(mRange, getLevel(), getVersion(), "<SedFunctionalRange>");
        }
      else if (SyntaxChecker::isValidSBMLSId(mRange) == false)
        {
          logError(SedInvalidIdSyntax);
        }
    }

}