Class NQuadsAlphabet


  • public final class NQuadsAlphabet
    extends java.lang.Object
    Utility class defining character predicates and escaping rules for N-Quads syntax. This class provides predefined IntPredicate instances to identify specific character sets used in N-Quads processing, as well as a method to escape special characters in string values.

    Character predicates include:

    • ASCII_ALPHA - Matches ASCII alphabetic characters (A-Z, a-z).
    • ASCII_DIGIT - Matches ASCII digits (0-9).
    • ASCII_ALPHA_NUM - Matches alphanumeric characters.
    • WHITESPACE - Matches whitespace characters (tab, space).
    • EOL - Matches end-of-line characters (LF, CR).
    • HEX - Matches hexadecimal digits (0-9, A-F, a-f).
    • PN_CHARS_BASE - Matches base name characters as per RDF standard.
    • PN_CHARS_U - Matches base characters plus underscore and colon.
    • PN_CHARS - Matches all valid name characters.

    The escape(String) method provides a way to escape special characters in string values according to N-Quads formatting rules.

    See Also:
    RDF 1.1 N-Quads
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.function.IntPredicate ASCII_ALPHA  
      static java.util.function.IntPredicate ASCII_ALPHA_NUM  
      static java.util.function.IntPredicate ASCII_DIGIT  
      static java.lang.String DIR_LANG_STRING  
      static java.util.function.IntPredicate EOL  
      static java.util.function.IntPredicate HEX  
      static java.lang.String I18N_BASE  
      static java.lang.String LANG_STRING  
      static java.util.function.IntPredicate PN_CHARS  
      static java.util.function.IntPredicate PN_CHARS_BASE  
      static java.util.function.IntPredicate PN_CHARS_U  
      static java.util.function.IntPredicate WHITESPACE  
      static java.lang.String XSD_STRING  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private NQuadsAlphabet()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String escape​(java.lang.String value)
      Escapes special characters in the given string according to N-Quads syntax.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ASCII_ALPHA

        public static final java.util.function.IntPredicate ASCII_ALPHA
      • ASCII_DIGIT

        public static final java.util.function.IntPredicate ASCII_DIGIT
      • ASCII_ALPHA_NUM

        public static final java.util.function.IntPredicate ASCII_ALPHA_NUM
      • WHITESPACE

        public static final java.util.function.IntPredicate WHITESPACE
      • EOL

        public static final java.util.function.IntPredicate EOL
      • HEX

        public static final java.util.function.IntPredicate HEX
      • PN_CHARS_BASE

        public static final java.util.function.IntPredicate PN_CHARS_BASE
      • PN_CHARS_U

        public static final java.util.function.IntPredicate PN_CHARS_U
      • PN_CHARS

        public static final java.util.function.IntPredicate PN_CHARS
    • Constructor Detail

      • NQuadsAlphabet

        private NQuadsAlphabet()
    • Method Detail

      • escape

        public static final java.lang.String escape​(java.lang.String value)
        Escapes special characters in the given string according to N-Quads syntax. This method replaces control characters, backslashes, and quotes with their corresponding escape sequences.
        Parameters:
        value - the string to be escaped
        Returns:
        the escaped string with special characters replaced