Semantically validates XML files using CVMappings and a ControlledVocabulary. More...
#include <OpenMS/FORMAT/VALIDATORS/SemanticValidator.h>
Classes | |
| struct | CVTerm |
| Representation of a parsed CV term. More... | |
Public Member Functions | |
| SemanticValidator (const CVMappings &mapping, const ControlledVocabulary &cv) | |
| Constructor. | |
| virtual | ~SemanticValidator () |
| Destructor. | |
| bool | validate (const String &filename, StringList &errors, StringList &warnings) |
| Semantically validates an XML file. | |
| bool | locateTerm (const String &path, const CVTerm &parsed_term) const |
| Checks if a CVTerm is allowed in a given path. | |
| void | setTag (const String &tag) |
| Sets the CV parameter tag name (default: 'cvParam'). | |
| void | setAccessionAttribute (const String &accession) |
| Sets the name of the attribute for accessions in the CV parameter tag name (default: 'accession'). | |
| void | setNameAttribute (const String &name) |
| Sets the name of the attribute for accessions in the CV parameter tag name (default: 'name'). | |
| void | setValueAttribute (const String &value) |
| Sets the name of the attribute for accessions in the CV parameter tag name (default: 'value'). | |
| void | setCheckTermValueTypes (bool check) |
| Set if CV term value types should be check (enabled by default). | |
| void | setCheckUnits (bool check) |
| Set if CV term units should be check (disabled by default). | |
| void | setUnitAccessionAttribute (const String &accession) |
| Sets the name of the unit accession attribute (default: 'unitAccession'). | |
| void | setUnitNameAttribute (const String &name) |
| Sets the name of the unit name attribute (default: 'unitName'). | |
Protected Member Functions | |
| void | startElement (const XMLCh *const , const XMLCh *const , const XMLCh *const qname, const xercesc::Attributes &attributes) |
| void | endElement (const XMLCh *const , const XMLCh *const , const XMLCh *const qname) |
| void | characters (const XMLCh *const chars, const XMLSize_t) |
| virtual String | getPath_ (UInt remove_from_end=0) const |
| Returns the current element path. | |
| virtual void | getCVTerm_ (const xercesc::Attributes &attributes, CVTerm &parsed_term) |
| Parses the CV term accession (required), name (required) and value (optional) from the XML attributes. | |
| virtual void | handleTerm_ (const String &path, const CVTerm &parsed_term) |
| Handling of the term. | |
Protected Attributes | |
| const CVMappings & | mapping_ |
| Reference to the mappings. | |
| const ControlledVocabulary & | cv_ |
| Reference to the CVs. | |
| StringList | errors_ |
| Validation erros. | |
| StringList | warnings_ |
| Validation warnings. | |
| StringList | open_tags_ |
| List of open tags. | |
| Map< String, std::vector < CVMappingRule > > | rules_ |
| Rules (location => rule). | |
| Map< String, Map< String, Map < String, UInt > > > | fulfilled_ |
Tag and attribute names | |
| String | cv_tag_ |
| String | accession_att_ |
| String | name_att_ |
| String | value_att_ |
| String | unit_accession_att_ |
| String | unit_name_att_ |
| bool | check_term_value_types_ |
| bool | check_units_ |
Private Member Functions | |
| SemanticValidator () | |
| Not implemented. | |
| SemanticValidator (const SemanticValidator &rhs) | |
| Not implemented. | |
| SemanticValidator & | operator= (const SemanticValidator &rhs) |
| Not implemented. | |
Semantically validates XML files using CVMappings and a ControlledVocabulary.
This is the general validator.
Specialized validators for specific file formats are derived from this class.
| SemanticValidator | ( | const CVMappings & | mapping, | |
| const ControlledVocabulary & | cv | |||
| ) |
Constructor.
| mapping | The mapping rules | |
| cv | All controlled vocabularies required for the mapping |
| virtual ~SemanticValidator | ( | ) | [virtual] |
Destructor.
| SemanticValidator | ( | ) | [private] |
Not implemented.
| SemanticValidator | ( | const SemanticValidator & | rhs | ) | [private] |
Not implemented.
| void characters | ( | const XMLCh *const | chars, | |
| const | XMLSize_t | |||
| ) | [protected] |
| void endElement | ( | const XMLCh * | const, | |
| const XMLCh * | const, | |||
| const XMLCh *const | qname | |||
| ) | [protected] |
| virtual void getCVTerm_ | ( | const xercesc::Attributes & | attributes, | |
| CVTerm & | parsed_term | |||
| ) | [protected, virtual] |
Parses the CV term accession (required), name (required) and value (optional) from the XML attributes.
Returns the current element path.
Reimplemented in MzMLValidator.
Handling of the term.
Reimplemented in MzDataValidator, and MzMLValidator.
Checks if a CVTerm is allowed in a given path.
| SemanticValidator& operator= | ( | const SemanticValidator & | rhs | ) | [private] |
Not implemented.
| void setAccessionAttribute | ( | const String & | accession | ) |
Sets the name of the attribute for accessions in the CV parameter tag name (default: 'accession').
| void setCheckTermValueTypes | ( | bool | check | ) |
| void setCheckUnits | ( | bool | check | ) |
| void setNameAttribute | ( | const String & | name | ) |
Sets the name of the attribute for accessions in the CV parameter tag name (default: 'name').
| void setTag | ( | const String & | tag | ) |
Sets the CV parameter tag name (default: 'cvParam').
| void setUnitAccessionAttribute | ( | const String & | accession | ) |
Sets the name of the unit accession attribute (default: 'unitAccession').
| void setUnitNameAttribute | ( | const String & | name | ) |
Sets the name of the unit name attribute (default: 'unitName').
| void setValueAttribute | ( | const String & | value | ) |
Sets the name of the attribute for accessions in the CV parameter tag name (default: 'value').
| void startElement | ( | const XMLCh * | const, | |
| const XMLCh * | const, | |||
| const XMLCh *const | qname, | |||
| const xercesc::Attributes & | attributes | |||
| ) | [protected] |
Reimplemented in MzMLValidator.
| bool validate | ( | const String & | filename, | |
| StringList & | errors, | |||
| StringList & | warnings | |||
| ) |
Semantically validates an XML file.
| filename | The file to validate | |
| errors | Errors during the validation are returned in this output parameter. | |
| warnings | Warnings during the validation are returned in this output parameter. |
| Exception::FileNotFound | is thrown if the file could not be opened |
String accession_att_ [protected] |
bool check_term_value_types_ [protected] |
bool check_units_ [protected] |
const ControlledVocabulary& cv_ [protected] |
Reference to the CVs.
StringList errors_ [protected] |
Validation erros.
Fulfilled rules (location => rule ID => term ID => term count ) When a tag is closed, the fulfilled rules of the current location are checked against the required rules The fulfilled rules for that location are then deleted.
const CVMappings& mapping_ [protected] |
Reference to the mappings.
StringList open_tags_ [protected] |
List of open tags.
Map<String, std::vector<CVMappingRule> > rules_ [protected] |
Rules (location => rule).
String unit_accession_att_ [protected] |
String unit_name_att_ [protected] |
String value_att_ [protected] |
StringList warnings_ [protected] |
Validation warnings.
| OpenMS / TOPP release 1.10.0 | Documentation generated on Thu Mar 7 2013 09:43:00 using doxygen 1.7.1 |