Class SSSOMReader

  • Direct Known Subclasses:
    JSONReader, RDFReader, TSVReader

    public abstract class SSSOMReader
    extends Object
    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.

    • Constructor Detail

      • SSSOMReader

        public SSSOMReader()
    • Method Detail

      • setExtraMetadataPolicy

        public void setExtraMetadataPolicy​(ExtraMetadataPolicy policy)
        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 is ExtraMetadataPolicy.NONE.
      • setPropagationEnabled

        public void setPropagationEnabled​(boolean enabled)
        Enables or disables the propagation of "propagatable slots".
        Parameters:
        enabled - False to disable propagation; it is enabled by default.
      • setAssumedVersion

        public void setAssumedVersion​(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 a sssom_version slot. 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_version slot: 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 - False to disable validation; it is enabled by default.
      • setValidation

        public void setValidation​(ValidationLevel validationType)
        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 to ValidationLevel.DISABLED to disable validation entirely; the default is ValidationLevel.FULL.
      • fillPrefixMap

        public void fillPrefixMap​(Map<String,​String> map)
        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.
      • validate

        protected void validate​(MappingSet mappingSet)
                         throws SSSOMFormatException
        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 the read method in concrete derived classes.
        Throws:
        SSSOMFormatException - If the mapping set is invalid.