Class JsonLdUtils

java.lang.Object
com.github.jsonldjava.core.JsonLdUtils

public class JsonLdUtils extends Object
  • Field Details

  • Constructor Details

    • JsonLdUtils

      public JsonLdUtils()
  • Method Details

    • isKeyword

      static boolean isKeyword(Object key)
      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

      public static Boolean deepCompare(Object v1, Object v2, Boolean listOrderMatters)
    • deepCompare

      public static Boolean deepCompare(Object v1, Object v2)
    • deepContains

      public static boolean deepContains(List<Object> values, Object value)
    • mergeValue

      static void mergeValue(Map<String,Object> obj, String key, Object value)
    • laxMergeValue

      static void laxMergeValue(Map<String,Object> obj, String key, Object value)
    • isAbsoluteIri

      public static boolean isAbsoluteIri(String value)
    • isNode

      static boolean isNode(Object v)
      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

      static boolean isNodeReference(Object v)
      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

      public static boolean isRelativeIri(String value)
    • removePreserve

      static Object removePreserve(Context ctx, Object input, JsonLdOptions opts) throws JsonLdError
      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

      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.
      Parameters:
      input - the framed output before compaction
    • fillNodesToPrune

      static void fillNodesToPrune(Object input, Map<String,Object> toPrune)
      Gets the objects on which we'll prune the blank node ID
      Parameters:
      input - the framed output before compaction
      toPrune - the resulting object.
    • compareShortestLeast

      static int compareShortestLeast(String a, String b)
      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

      static boolean compareValues(Object v1, Object v2)
      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

      static boolean isBlankNode(Object v)
      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

      static Object clone(Object value)
    • isArray

      static Boolean isArray(Object v)
      Returns true if the given value is a JSON-LD Array
      Parameters:
      v - the value to check.
      Returns:
    • isList

      static Boolean isList(Object v)
      Returns true if the given value is a JSON-LD List
      Parameters:
      v - the value to check.
      Returns:
    • isObject

      static Boolean isObject(Object v)
      Returns true if the given value is a JSON-LD Object
      Parameters:
      v - the value to check.
      Returns:
    • isValue

      static Boolean isValue(Object v)
      Returns true if the given value is a JSON-LD value
      Parameters:
      v - the value to check.
      Returns:
    • isString

      static Boolean isString(Object v)
      Returns true if the given value is a JSON-LD string
      Parameters:
      v - the value to check.
      Returns: