Package org.incenp.obofoundry.sssom
Class SSSOMReader
java.lang.Object
org.incenp.obofoundry.sssom.SSSOMReader
- Direct Known Subclasses:
JSONReader,RDFReader,TSVReader
Base class to read a mapping set from any of the supported serialisation
formats.
This class should be derived into specialised classes that implement a precise serialisation format.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Versionprotected ExtraMetadataPolicyprotected PropagationPolicy -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfillPrefixMap(Map<String, String> map) Declares all prefix names in the specified map.abstract MappingSetread()Reads a mapping set from the source file.voidsetAssumedVersion(Version version) Sets the version of the SSSOM specification that the reader should assume the set is compliant with, if the set does not have asssom_versionslot.voidSets the policy to deal with non-standard metadata in the input file.voidsetPropagationEnabled(boolean enabled) Enables or disables the propagation of "propagatable slots".voidsetValidation(ValidationLevel validationType) Controls whether a mapping set should be validated after it has been parsed, and how.voidsetValidationEnabled(boolean enabled) Enables or disables post-parsing validation of mappings.protected voidvalidate(MappingSet mappingSet) Validates a mapping set.
-
Field Details
-
extraPolicy
-
propagationPolicy
-
assumedVersion
-
-
Constructor Details
-
SSSOMReader
public SSSOMReader()
-
-
Method Details
-
setExtraMetadataPolicy
Sets the policy to deal with non-standard metadata in the input file.- Parameters:
policy- The policy instructing the parser about what to do when encountering non-standard metadata. The default policy isExtraMetadataPolicy.NONE.
-
setPropagationEnabled
public void setPropagationEnabled(boolean enabled) Enables or disables the propagation of "propagatable slots".- Parameters:
enabled-Falseto disable propagation; it is enabled by default.
-
setAssumedVersion
Sets the version of the SSSOM specification that the reader should assume the set is compliant with, if the set does not have asssom_versionslot. The default is to assume that the set is compliant with version 1.0, as mandated by the specification.This parameter has no effect if the set does have a
sssom_versionslot: in that case, the set will be expected to be compliant with the version indicated in that slot.- Parameters:
version- The SSSOM version a set is assumed to be compliant with.
-
setValidationEnabled
public void setValidationEnabled(boolean enabled) Enables or disables post-parsing validation of mappings.- Parameters:
enabled-Falseto disable validation; it is enabled by default.
-
setValidation
Controls whether a mapping set should be validated after it has been parsed, and how.This method provides a finer control than
setValidationEnabled(boolean), which simply enables full validation or disables validation entirely.- Parameters:
validationType- The level of validation to use; set toValidationLevel.DISABLEDto disable validation entirely; the default isValidationLevel.FULL.
-
fillPrefixMap
Declares all prefix names in the specified map. Prefix names declared here complement the declarations from the file’s own prefix map, allowing the reader to parse a file with an incomplete prefix map.It is up to concrete implementations to actually do something with that map. Some of them may ignore it.
- Parameters:
map- The prefix map to use.
-
read
Reads a mapping set from the source file.- Returns:
- A complete SSSOM mapping set.
- Throws:
SSSOMFormatException- If encountering invalid SSSOM data.IOException- If any kind of non-SSSOM-related I/O error occurs.
-
validate
Validates a mapping set. This method performs all post-parsing checks to ensure the mapping set is valid according to the SSSOM specification.- Parameters:
mappingSet- The set to validate. It should be called by thereadmethod in concrete derived classes.- Throws:
SSSOMFormatException- If the mapping set is invalid.
-