Package com.apicatalog.rdf.nquads
Class NQuadsAlphabet
- java.lang.Object
-
- com.apicatalog.rdf.nquads.NQuadsAlphabet
-
public final class NQuadsAlphabet extends java.lang.ObjectUtility class defining character predicates and escaping rules for N-Quads syntax. This class provides predefinedIntPredicateinstances 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.IntPredicateASCII_ALPHAstatic java.util.function.IntPredicateASCII_ALPHA_NUMstatic java.util.function.IntPredicateASCII_DIGITstatic java.lang.StringDIR_LANG_STRINGstatic java.util.function.IntPredicateEOLstatic java.util.function.IntPredicateHEXstatic java.lang.StringI18N_BASEstatic java.lang.StringLANG_STRINGstatic java.util.function.IntPredicatePN_CHARSstatic java.util.function.IntPredicatePN_CHARS_BASEstatic java.util.function.IntPredicatePN_CHARS_Ustatic java.util.function.IntPredicateWHITESPACEstatic java.lang.StringXSD_STRING
-
Constructor Summary
Constructors Modifier Constructor Description privateNQuadsAlphabet()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringescape(java.lang.String value)Escapes special characters in the given string according to N-Quads syntax.
-
-
-
Field Detail
-
I18N_BASE
public static final java.lang.String I18N_BASE
- See Also:
- Constant Field Values
-
LANG_STRING
public static final java.lang.String LANG_STRING
- See Also:
- Constant Field Values
-
DIR_LANG_STRING
public static final java.lang.String DIR_LANG_STRING
- See Also:
- Constant Field Values
-
XSD_STRING
public static final java.lang.String XSD_STRING
- See Also:
- Constant Field Values
-
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
-
-
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
-
-