Validator Tutorial: Wiring It Together - Bringing All Components Together

 

Previous: Building Your Own Rules

Next: Download Validator's tutorial source code


 

Not that you have created your CV Mapping rules and/or your own object rules, the next logical step is to create your own validator.

Here is a graphical representation of the process of building a validator given the separate components:

 

As you can see in the above representation, in order to build your own validator, you will have to bring together your configuration files in order to define ontologies, cv mapping rules, and object rules (for which you also have to provide your rules). Once you have brought all of this together inside a project, you can create your own validator as follow :

 

 

In this code example, one can see that two methods have been written:

  • The constructor of the SPE Validator that essentially passes the 3 configuration files to the generic validator,
  • The validate method that takes an Experiment and run the cv mapping validation as well as the object rule validation. Any message generated in this process is stored into a collection and returned to the calling process.

Now that we have put everything together, it's time to run our validator on some data and display the result of this validation. Obviously, the aim of this tutorial is not to give a lecture on user interface or even how to write them in Java so we are going to aim at a simple, basic user interface that allows to print the result of our validation on the command line.

 

 

Here is what our little program output:

Validation run collected 3 message(s): 

ValidatorMessage{message='The result found at: /molecules/modifications/@id for which the values are ''BLA:0000X'' didn't match any of the 1 specified CV term:
- MOD:01157 (protein modification categorized by amino acid modified) or any of its children. The term can be repeated. The matching value has to be the identifier of the term, not its name.', level=WARN, context=Context(/molecules/modifications/@id ), rule=}

ValidatorMessage{message='The result found at: /molecules/type/@id for which the values are ''SPE:0328'' didn't match any of the 2 specified CV terms:
- The sole term SPE:0326 (protein) or any of its children. A single instance of this term can be specified. The matching value has to be the identifier of the term, not its name.
- SPE:0318 (nucleic acid) or any of its children. A single instance of this term can be specified. The matching value has to be the identifier of the term, not its name.', level=ERROR, context=Context(/molecules/type/@id ), rule=}

ValidatorMessage{message='Experiment id:3 doesn't have a name.', level=WARN, context=null, rule=null}

 

 

 


Previous : Building Your Own Rules

Next: Download Validator's tutorial source code

 

Tags: