14 #include "WebServicesIssues/MiriamWebServicesSoapBinding.nsmap"
24 #include <sbml/xml/XMLNode.h>
25 #include <sbml/xml/XMLAttributes.h>
26 #include <sbml/xml/XMLToken.h>
27 #include <sbml/xml/XMLInputStream.h>
32 mpLastUpdateDate(NULL),
33 mpUpdateFrequency(NULL),
34 mpMIRIAMResources(NULL)
40 mpLastUpdateDate(NULL),
41 mpUpdateFrequency(NULL),
42 mpMIRIAMResources(NULL)
48 mpLastUpdateDate(NULL),
49 mpUpdateFrequency(NULL),
50 mpMIRIAMResources(NULL)
85 const std::string& filename)
91 std::string Name, URI, Deprecated, Pattern, IsDeprecated;
92 int itNames = 0, itURIs = 0, sizeNames = 0, sizeURIs = 0;
93 unsigned C_INT32 processStep = 0, processSteps = 1;
98 hUpdateStep = pProcessReport->
addItem(
"Parsing MIRIAM XML", processStep, &processSteps);
101 XMLInputStream stream(filename.c_str());
103 if (stream.isError())
return false;
105 XMLNode root(stream);
109 if (pProcessReport && !pProcessReport->
progressItem(hUpdateStep))
112 sizeNames = root.getNumChildren();
113 processSteps = sizeNames + 2;
116 hUpdateStep = pProcessReport->
addItem(
"Add Items", processStep, &processSteps);
118 if (pProcessReport && !pProcessReport->
progressItem(hUpdateStep))
122 for (itNames = 0; itNames < sizeNames; itNames++)
124 XMLNode dataType = root.getChild(itNames);
127 if (dataType.getName() !=
"datatype")
continue;
130 Name = dataType.getChild(
"name").getChild(0).getCharacters();
133 XMLNode uris = dataType.getChild(
"uris");
134 sizeURIs = uris.getNumChildren();
141 for (itURIs = 0; itURIs < sizeURIs; itURIs++)
143 XMLNode uri = uris.getChild(itURIs);
146 URI = uri.getChild(0).getCharacters();
148 Deprecated = uri.getAttrValue(
"deprecated");
150 if (Deprecated ==
"true")
158 if (URI.empty() || Name.empty())
161 delete pMIRIAMResource;
168 URI ==
"urn:miriam:doi" ||
169 URI ==
"urn:miriam:pubmed" ||
170 URI ==
"urn:miriam:isbn");
176 if (pProcessReport && !pProcessReport->
progressItem(hUpdateStep))
182 if (pProcessReport && !pProcessReport->
progressItem(hUpdateStep))
196 pdelete(pTmpCpyCMIRIAMResources);
200 if (pProcessReport && !pProcessReport->
progressItem(hUpdateStep))
209 pProcessReport->
setName(
"MIRIAM Resources Update...");
217 std::string Name, URI, Deprecated, Pattern, IsDeprecated;
218 int itNames = 0, itURIs = 0, sizeNames = 0, sizeURIs = 0;
219 unsigned C_INT32 processStep = 0, processSteps;
226 processSteps = sizeNames + 2;
227 hUpdateStep = pProcessReport->
addItem(
"Update Process", processStep, &processSteps);
229 if (pProcessReport && !pProcessReport->
progressItem(hUpdateStep))
232 for (itNames = 0; itNames < sizeNames; itNames++)
249 for (itURIs = 0; itURIs < sizeURIs; itURIs++)
253 if (Deprecated != URI)
262 URI ==
"urn:miriam:doi" ||
263 URI ==
"urn:miriam:pubmed" ||
264 URI ==
"urn:miriam:isbn");
273 if (pProcessReport && !pProcessReport->
progressItem(hUpdateStep))
279 if (pProcessReport && !pProcessReport->
progressItem(hUpdateStep))
301 pdelete(pTmpCpyCMIRIAMResources);
305 if (pProcessReport && !pProcessReport->
progressItem(hUpdateStep))
return false;
307 if (pProcessReport) pProcessReport->
finishItem(hUpdateStep);
321 {
return (
unsigned C_INT32) time(NULL);}
338 for (; it != end; ++it)
339 *it = elevate<CMIRIAMResource, CCopasiParameterGroup>(*it);
353 for (; it != end; ++it)
370 for (; it != end; ++it)
380 for (; itDeprecated != endDeprecated; ++itDeprecated)
382 std::string Deprecated = *(*itDeprecated)->getValue().pSTRING;
385 if (Deprecated[Deprecated.length() - 1] !=
'/')
409 std::map< std::string , size_t >::const_iterator it =
mURI2Resource.lower_bound(URI);
410 std::map< std::string , size_t >::const_iterator end =
mURI2Resource.upper_bound(URI);
417 for (; it != end; ++it)
420 if (URI.compare(0, it->first.length(), it->first) == 0)
433 std::map< std::string, size_t>::const_iterator it =
550 return "http://identifiers.org/" +
mpURI->substr(11);
const std::string & getMIRIAMURI() const
void initializeParameter()
std::string getIdentifiersOrgURL() const
void createDisplayNameMap()
const CMIRIAMResource & getMIRIAMMIRIAMResource() const
const CMIRIAMResource & getMIRIAMResource(const size_t index) const
virtual int getDataTypesName(struct ns2__getDataTypesNameResponse &_param_7)
Web service operation 'getDataTypesName' (returns error code or SOAP_OK)
const CMIRIAMResources & getMIRIAMResources() const
const CCopasiParameterGroup & getResourceList() const
CCopasiParameterGroup * mpDeprecated
virtual int getDataTypePattern(std::string _nickname, std::string &_getDataTypePatternReturn)
Web service operation 'getDataTypePattern' (returns error code or SOAP_OK)
std::string * mpDisplayName
void setMIRIAMURI(const std::string &URI)
virtual bool setName(const std::string &name)
CCopasiParameterGroup * mpMIRIAMResources
bool autoUpdateMIRIAMResources(CProcessReport *pProcessReport)
index_iterator endIndex() const
void setMIRIAMCitation(const bool &isCitation)
void addDeprecatedURL(const std::string &URL)
virtual int getDataTypeURIs(std::string _name, struct ns2__getDataTypeURIsResponse &_param_2)
Web service operation 'getDataTypeURIs' (returns error code or SOAP_OK)
void addMIRIAMResource(CMIRIAMResource *pMIRIAMResource)
virtual const char * soap_fault_string()
Get SOAP Fault string (NULL when absent)
const unsigned C_INT32 & getMIRIAMLastUpdateDate() const
bool updateMIRIAMResourcesFromFile(CProcessReport *pProcessReport, const std::string &filename)
const std::string & getMIRIAMPattern() const
virtual bool progressItem(const size_t &handle)
void setMIRIAMLastUpdateDate()
CMIRIAMResources(const std::string &name="MIRIAM Resources", const CCopasiContainer *pParent=NULL)
const std::string & getMIRIAMDisplayName() const
void setMIRIAMUpdateFrequencyInDays(const size_t &days)
void initializeParameter()
ArrayOf_USCORExsd_USCOREstring * getDataTypesNameReturn
virtual ~CMIRIAMResources()
const unsigned C_INT32 & getMIRIAMUpdateFrequency() const
size_t addItem(const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
CMIRIAMResource(const std::string &name="MIRIAM Resource", const CCopasiContainer *pParent=NULL)
ArrayOf_USCORExsd_USCOREstring * _getDataTypeURIsReturn
unsigned C_INT32 * mpUpdateFrequency
index_iterator beginIndex() const
const Value & getValue() const
void setMIRIAMPattern(const std::string &pattern)
CCopasiParameterGroup * assertGroup(const std::string &name)
virtual ~CMIRIAMResource()
const CCopasiParameterGroup & getMIRIAMDeprecated() const
virtual bool finishItem(const size_t &handle)
virtual bool elevateChildren()
size_t getResourceIndexFromDisplayName(const std::string &displayName) const
virtual const char * soap_fault_detail()
Get SOAP Fault detail as string (NULL when absent)
unsigned C_INT32 getActDateInSeconds()
static const CMIRIAMResource & getUnknownMiriamResource()
void setMIRIAMDisplayName(const std::string &displayName)
bool addParameter(const CCopasiParameter ¶meter)
virtual int getDataTypeURI(std::string _name, std::string &_getDataTypeURIReturn)
Web service operation 'getDataTypeURI' (returns error code or SOAP_OK)
CCopasiParameter * assertParameter(const std::string &name, const CCopasiParameter::Type type, const CType &defaultValue)
CCopasiParameterGroup * getGroup(const std::string &name)
unsigned C_INT32 * mpLastUpdateDate
size_t getMIRIAMResourceIndex(const std::string &URI) const
parameterGroup::iterator index_iterator
bool updateMIRIAMResources(CProcessReport *pProcessReport)
std::map< std::string, size_t > mURI2Resource
std::map< std::string, size_t > mDisplayName2Resource
const bool & getMIRIAMCitation() const