Package de.isas.mztab2.validation
Class CvMappingValidator
- java.lang.Object
-
- de.isas.mztab2.validation.CvMappingValidator
-
- All Implemented Interfaces:
de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab>
public class CvMappingValidator extends Object implements de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab>
Validator implementation that uses a provided xml mapping file with rules for required, recommended and optional CV parameters to assert that an mzTab follows these rules. First, all preValidators are run, then, the cv parameter validation is executed, before finally, the postValidators are run. Each validator can add validation messages to the output.- Author:
- nilshoffmann
-
-
Constructor Summary
Constructors Constructor Description CvMappingValidator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CvMappingValidator
of(info.psidev.cvmapping.CvMapping mapping, CvParameterLookupService client, boolean errorIfTermNotInRule)
Create a new instance of CvMappingValidator.static CvMappingValidator
of(File mappingFile, boolean errorIfTermNotInRule)
Create a new instance of CvMappingValidator.static CvMappingValidator
of(File mappingFile, CvParameterLookupService client, boolean errorIfTermNotInRule)
Create a new instance of CvMappingValidator.static CvMappingValidator
of(URL mappingFile, boolean errorIfTermNotInRule)
Create a new instance of CvMappingValidator.static CvMappingValidator
of(URL mappingFile, CvParameterLookupService client, boolean errorIfTermNotInRule)
Create a new instance of CvMappingValidator.List<de.isas.mztab2.model.ValidationMessage>
validate(de.isas.mztab2.model.MzTab mzTab)
CvMappingValidator
withPostValidator(de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab> postValidator)
Add the provided validator implementation to the list of validators that run last.CvMappingValidator
withPreValidator(de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab> preValidator)
Add the provided validator implementation to the list of validators that run first.
-
-
-
Method Detail
-
of
public static CvMappingValidator of(File mappingFile, boolean errorIfTermNotInRule) throws JAXBException
Create a new instance of CvMappingValidator. Uses a default instance of theCvParameterLookupService
.- Parameters:
mappingFile
- the mapping file to useerrorIfTermNotInRule
- raise an error if a term is not defined within an otherwise matching rule for the element- Returns:
- a new CvMappingValidator instance
- Throws:
JAXBException
- if errors occur during unmarshalling of the mapping xml file.
-
of
public static CvMappingValidator of(File mappingFile, CvParameterLookupService client, boolean errorIfTermNotInRule) throws JAXBException
Create a new instance of CvMappingValidator. Uses the providedCvParameterLookupService
.- Parameters:
mappingFile
- the mapping file to useclient
- the ontology lookup service clienterrorIfTermNotInRule
- raise an error if a term is not defined within an otherwise matching rule for the element- Returns:
- a new CvMappingValidator instance
- Throws:
JAXBException
- if errors occur during unmarshalling of the mapping xml file.
-
withPreValidator
public CvMappingValidator withPreValidator(de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab> preValidator)
Add the provided validator implementation to the list of validators that run first.- Parameters:
preValidator
- the validator- Returns:
- an instance of this object
-
withPostValidator
public CvMappingValidator withPostValidator(de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab> postValidator)
Add the provided validator implementation to the list of validators that run last.- Parameters:
postValidator
- the validator- Returns:
- an instance of this object
-
of
public static CvMappingValidator of(URL mappingFile, boolean errorIfTermNotInRule) throws JAXBException
Create a new instance of CvMappingValidator. Uses a default instance of theCvParameterLookupService
.- Parameters:
mappingFile
- the mapping file URL to useerrorIfTermNotInRule
- raise an error if a term is not defined within an otherwise matching rule for the element- Returns:
- a new CvMappingValidator instance
- Throws:
JAXBException
- if errors occur during unmarshalling of the mapping xml file.
-
of
public static CvMappingValidator of(URL mappingFile, CvParameterLookupService client, boolean errorIfTermNotInRule) throws JAXBException
Create a new instance of CvMappingValidator. Uses the providedCvParameterLookupService
.- Parameters:
mappingFile
- the mapping file URL to useclient
- the ontology lookup service clienterrorIfTermNotInRule
- raise an error if a term is not defined within an otherwise matching rule for the element- Returns:
- a new CvMappingValidator instance
- Throws:
JAXBException
- if errors occur during unmarshalling of the mapping xml file.
-
of
public static CvMappingValidator of(info.psidev.cvmapping.CvMapping mapping, CvParameterLookupService client, boolean errorIfTermNotInRule)
Create a new instance of CvMappingValidator. Uses the providedCvParameterLookupService
.- Parameters:
mapping
- the cv mapping to useclient
- the ontology lookup service clienterrorIfTermNotInRule
- raise an error if a term is not defined within an otherwise matching rule for the element- Returns:
- a new CvMappingValidator instance
-
validate
public List<de.isas.mztab2.model.ValidationMessage> validate(de.isas.mztab2.model.MzTab mzTab)
- Specified by:
validate
in interfacede.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab>
-
-