Class ParserOptions


  • public final class ParserOptions
    extends java.lang.Object

    Options for RDF parsing.

    Since:
    1.0
    Version:
    1.0
    Author:
    Michael Grove
    • Field Detail

      • BASE_IRI

        public static final Option<java.lang.String> BASE_IRI
      • NAMESPACES

        public static final Option<java.lang.Iterable<Namespace>> NAMESPACES
      • VERIFY_DATATYPES

        public static final Option<java.lang.Boolean> VERIFY_DATATYPES
      • VERIFY_LANG

        public static final Option<java.lang.Boolean> VERIFY_LANG
      • VERIFY_RELATIVE_IRIS

        public static final Option<java.lang.Boolean> VERIFY_RELATIVE_IRIS
      • VERIFY_IRI_SYNTAX

        public static final Option<java.lang.Boolean> VERIFY_IRI_SYNTAX
      • NORMALIZE_DATATYPES

        public static final Option<java.lang.Boolean> NORMALIZE_DATATYPES
      • NORMALIZE_LANG

        public static final Option<java.lang.Boolean> NORMALIZE_LANG
      • LANG_HANDLER

        public static final Option<LanguageHandler> LANG_HANDLER
        Lnaguage handler that will be used for verification and normalization.
      • PRESERVE_BNODE_IDS

        public static final Option<java.lang.Boolean> PRESERVE_BNODE_IDS

        This option controls if the parser should preserve bnode identifiers specified in the source. Preserving bnode identifiers help speed parsing and loading time but it also has an important side-effect that if two distinct files using the same bnode identifier are loaded to the same database, the bnode in different files will end up pointing to the same node in the database. If the input files do not use bnode identifiers (e.g. in Turtle syntax only [] are used for bnodes) then this configuration option has no effect since such bnodes are always assigned a unique identifier. But if input files use explicit bnode identifiers (e.g. _:bnode1 in Turtle syntax) and multiple files may use same bnode identifiers then this configuration option should be turned off.

      • CASE_INSENSITIVE_DIRECTIVES

        public static final Option<java.lang.Boolean> CASE_INSENSITIVE_DIRECTIVES
      • FAIL_ON_INVALID_LINES

        public static final Option<java.lang.Boolean> FAIL_ON_INVALID_LINES
      • SECURE_PROCESSING

        public static final Option<java.lang.Boolean> SECURE_PROCESSING
        Parser setting for the secure processing feature of XML parsers to avoid DOS and XXE attacks. Setting this option will enable the XMLConstants.FEATURE_SECURE_PROCESSING setting for the XML parser and disable the following settings that can be used in XML External Entity (XXE) attacks:
        • http://apache.org/xml/features/nonvalidating/load-external-dtd
        • http://xml.org/sax/features/external-general-entities
        • http://xml.org/sax/features/external-parameter-entities
        WARNING:Disabling this option is strongly discouraged as it would create a security vulnerability. Secure processing should be disabled only in cases where the input XML files are known to be coming from a trustworthy location.

        Defaults to true

      • FAIL_ON_SAX_NON_FATAL_ERRORS

        public static final Option<java.lang.Boolean> FAIL_ON_SAX_NON_FATAL_ERRORS
        Parser setting to determine whether to ignore non-fatal errors that come from SAX parsers.

        Defaults to true

      • FAIL_ON_NON_STANDARD_ATTRIBUTES

        public static final Option<java.lang.Boolean> FAIL_ON_NON_STANDARD_ATTRIBUTES
        Parser setting to determine whether to ignore non-standard attributes that are found in an XML document.

        Defaults to true

      • FAIL_ON_INVALID_NCNAME

        public static final Option<java.lang.Boolean> FAIL_ON_INVALID_NCNAME
        Parser setting to determine whether to ignore XML documents containing invalid NCNAMEs.

        Defaults to true

      • FAIL_ON_DUPLICATE_RDF_ID

        public static final Option<java.lang.Boolean> FAIL_ON_DUPLICATE_RDF_ID
        Parser setting to determine whether to throw an error for duplicate uses of rdf:ID in a single document.

        Defaults to true

      • FAIL_ON_INVALID_QNAME

        public static final Option<java.lang.Boolean> FAIL_ON_INVALID_QNAME
        Parser setting to determine whether to ignore XML documents containing invalid QNAMEs.

        Defaults to true

      • FAIL_ON_MISMATCHED_TAGS

        public static final Option<java.lang.Boolean> FAIL_ON_MISMATCHED_TAGS
        Parser setting to determine whether to throw an error for XML documents containing mismatched tags

        Defaults to true

    • Method Detail

      • defaults

        @Nonnull
        public static Options defaults()
        Default parser options
        Returns:
        the default options
      • namespaces

        @Nonnull
        public static Options namespaces​(@Nonnull
                                         java.lang.Iterable<Namespace> theNamespaces)
        Return the default options with namespaces set to the given value
        Parameters:
        theNamespaces - the namespaces
        Returns:
        the options
      • baseIRI

        @Nonnull
        public static Options baseIRI​(@Nonnull
                                      java.lang.String theIRI)
        Return the default options with the base IRI set to the given value
        Parameters:
        theIRI - the base IRI
        Returns:
        the options
      • strict

        @Nonnull
        public static Options strict()
        Return a set of `Options` which correspond to default settings for a strict RDF parsing mode
        Returns:
        strict parsing options
      • lax

        @Nonnull
        public static Options lax()
        Return a set of `Options` which correspond to default settings for a strict RDF parsing mode
        Returns:
        strict parsing options