public final class ODCSUtils extends Object
Modifier and Type | Field and Description |
---|---|
static long |
DAY_HOURS
Number of hours in a day.
|
static String |
DEFAULT_ENCODING
Default encoding - UTF-8.
|
static Pattern |
ESCAPE_LITERAL_CHARS_TO_ESCAPE
Pattern matching characters to be escaped in a literal when being escaped for a SPARQL query.
|
static Pattern |
ESCAPE_LITERAL_CHARS_TO_REMOVE
Pattern matching characters to be removed from a literal when being escaped for a SPARQL query.
|
static String |
JDBC_DRIVER
Jdbc driver class.
|
static long |
MILLISECONDS
Milliseconds in a second.
|
static long |
TIME_UNIT_60
Time unit 60.
|
Modifier and Type | Method and Description |
---|---|
static <T> List<T> |
addToListNullProof(T value,
List<T> list)
Add a value to the list given in parameter and return modified list; if list is null, create new instance.
|
static <T> Set<T> |
addToSetNullProof(T value,
Set<T> set)
Add a value to the set given in parameter and return modified set; if set is null, create new instance.
|
static String |
escapeSPARQLLiteral(String literalValue)
Escapes a literal for use in a SPARQL query.
|
static String |
extractUUID(String namedGraphURI)
Extracts the UUID part from a data named graph URI.
|
static String |
getVirtuosoURIForBlankNode(com.hp.hpl.jena.graph.Node bNode)
Return the URI identifying a blank node in Virtuoso.
|
static boolean |
isNullOrEmpty(String s)
Checks if a string is null or an empty string.
|
static boolean |
isPrefixedName(String uri)
Checks whether the given URI is a prefixed name.
|
static boolean |
isValidIRI(String uri)
Checks whether the given URI is a valid IRI.
|
static boolean |
isValidNamespacePrefix(String prefix)
Checks whether the given string is a valid namespace prefix.
|
static boolean |
isValidSparqlVar(String varName)
Checks whether the given string is a valid SPARQL variable name.
|
static <T> int |
nullProofCompare(Comparable<T> o1,
T o2)
Compare two values which may be null.
|
static boolean |
nullProofEquals(Object o1,
Object o2)
Compare two values which may be null for equality.
|
static String |
toAscii(CharSequence str)
Convert the given string to ASCII characters, removing diacritical marks.
|
static String |
toStringNullProof(Object obj)
Converts an object or null refrence to a string (null is converted to the empty string).
|
public static final long MILLISECONDS
public static final long TIME_UNIT_60
public static final long DAY_HOURS
public static final String JDBC_DRIVER
public static final String DEFAULT_ENCODING
public static final Pattern ESCAPE_LITERAL_CHARS_TO_REMOVE
public static final Pattern ESCAPE_LITERAL_CHARS_TO_ESCAPE
public static <T> int nullProofCompare(Comparable<T> o1, T o2)
T
- type of compared valueso1
- first compared value or nullo2
- second compared value or nullpublic static boolean nullProofEquals(Object o1, Object o2)
o1
- first compared value or nullo2
- second compared value or nullpublic static boolean isValidIRI(String uri)
uri
- the string to checkpublic static boolean isValidSparqlVar(String varName)
varName
- the string to checkpublic static boolean isPrefixedName(String uri)
uri
- the string to checkpublic static boolean isValidNamespacePrefix(String prefix)
prefix
- the string to checkpublic static boolean isNullOrEmpty(String s)
s
- tested stringpublic static String extractUUID(String namedGraphURI)
namedGraphURI
- URI of a payload/metadata/provenanceMetadata named graphpublic static String toAscii(CharSequence str)
str
- string to convertpublic static String escapeSPARQLLiteral(String literalValue)
literalValue
- value to be escapedpublic static String getVirtuosoURIForBlankNode(com.hp.hpl.jena.graph.Node bNode)
bNode
- blank nodeUnsupportedOperationException
- bNode is not a blank nodepublic static String toStringNullProof(Object obj)
obj
- object to stringifypublic static <T> Set<T> addToSetNullProof(T value, Set<T> set)
T
- item typevalue
- value to add to the setset
- set to add to or nullpublic static <T> List<T> addToListNullProof(T value, List<T> list)
T
- item typevalue
- value to add to the listlist
- list to add to or nullCopyright © 2013. All Rights Reserved.