Package com.github.jsonldjava.core
Class JsonLdUtils
java.lang.Object
com.github.jsonldjava.core.JsonLdUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static Object
(package private) static int
compareShortestLeast
(String a, String b) Compares two strings first based on length and then lexicographically.(package private) static boolean
compareValues
(Object v1, Object v2) Compares two JSON-LD values for equality.static Boolean
deepCompare
(Object v1, Object v2) static Boolean
deepCompare
(Object v1, Object v2, Boolean listOrderMatters) static boolean
deepContains
(List<Object> values, Object value) (package private) static void
fillNodesToPrune
(Object input, Map<String, Object> toPrune) Gets the objects on which we'll prune the blank node IDstatic boolean
isAbsoluteIri
(String value) (package private) static Boolean
Returns true if the given value is a JSON-LD Array(package private) static boolean
Returns true if the given value is a blank node.(package private) static boolean
Returns whether or not the given value is a keyword (or a keyword alias).(package private) static Boolean
Returns true if the given value is a JSON-LD List(package private) static boolean
Returns true if the given value is a subject with properties.(package private) static boolean
Returns true if the given value is a subject reference.(package private) static Boolean
Returns true if the given value is a JSON-LD Objectstatic boolean
isRelativeIri
(String value) (package private) static Boolean
Returns true if the given value is a JSON-LD string(package private) static Boolean
Returns true if the given value is a JSON-LD value(package private) static void
(package private) static void
(package private) static void
pruneBlankNodes
(Object input) Removes the @id member of each node object where the member value is a blank node identifier which appears only once in any property value within input.(package private) static Object
removePreserve
(Context ctx, Object input, JsonLdOptions opts) Removes the @preserve keywords as the last step of the framing algorithm.
-
Field Details
-
MAX_CONTEXT_URLS
private static final int MAX_CONTEXT_URLS- See Also:
-
-
Constructor Details
-
JsonLdUtils
public JsonLdUtils()
-
-
Method Details
-
isKeyword
Returns whether or not the given value is a keyword (or a keyword alias).- Parameters:
v
- the value to check.- Returns:
- true if the value is a keyword, false if not.
-
deepCompare
-
deepCompare
-
deepContains
-
mergeValue
-
laxMergeValue
-
isAbsoluteIri
-
isNode
Returns true if the given value is a subject with properties.- Parameters:
v
- the value to check.- Returns:
- true if the value is a subject with properties, false if not.
-
isNodeReference
Returns true if the given value is a subject reference.- Parameters:
v
- the value to check.- Returns:
- true if the value is a subject reference, false if not.
-
isRelativeIri
-
removePreserve
Removes the @preserve keywords as the last step of the framing algorithm.- Parameters:
ctx
- the active context used to compact the input.input
- the framed, compacted output.options
- the compaction options used.- Returns:
- the resulting output.
- Throws:
JsonLdError
-
pruneBlankNodes
Removes the @id member of each node object where the member value is a blank node identifier which appears only once in any property value within input.- Parameters:
input
- the framed output before compaction
-
fillNodesToPrune
Gets the objects on which we'll prune the blank node ID- Parameters:
input
- the framed output before compactiontoPrune
- the resulting object.
-
compareShortestLeast
Compares two strings first based on length and then lexicographically.- Parameters:
a
- the first string.b
- the second string.- Returns:
- -1 if a invalid input: '<' b, 1 if a > b, 0 if a == b.
-
compareValues
Compares two JSON-LD values for equality. Two JSON-LD values will be considered equal if: 1. They are both primitives of the same type and value. 2. They are both @values with the same @value, @type, and @language, OR 3. They both have @ids they are the same.- Parameters:
v1
- the first value.v2
- the second value.- Returns:
- true if v1 and v2 are considered equal, false if not.
-
isBlankNode
Returns true if the given value is a blank node.- Parameters:
v
- the value to check.- Returns:
- true if the value is a blank node, false if not.
-
clone
-
isArray
Returns true if the given value is a JSON-LD Array- Parameters:
v
- the value to check.- Returns:
-
isList
Returns true if the given value is a JSON-LD List- Parameters:
v
- the value to check.- Returns:
-
isObject
Returns true if the given value is a JSON-LD Object- Parameters:
v
- the value to check.- Returns:
-
isValue
Returns true if the given value is a JSON-LD value- Parameters:
v
- the value to check.- Returns:
-
isString
Returns true if the given value is a JSON-LD string- Parameters:
v
- the value to check.- Returns:
-