Class NormalizeUtils

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

class NormalizeUtils extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • hashBlankNodes

      public Object hashBlankNodes(Collection<String> unnamed_) throws JsonLdError
      Throws:
      JsonLdError
    • hashPaths

      private static NormalizeUtils.HashResult hashPaths(String id, Map<String,Object> bnodes, UniqueNamer namer, UniqueNamer pathNamer)
      Produces a hash for the paths of adjacent bnodes for a bnode, incorporating all information about its subgraph of bnodes. This method will recursively pick adjacent bnode permutations that produce the lexicographically-least 'path' serializations.
      Parameters:
      id - the ID of the bnode to hash paths for.
      bnodes - the map of bnode quads.
      namer - the canonical bnode namer.
      pathNamer - the namer used to assign names to adjacent bnodes.
      callback - (err, result) called once the operation completes.
    • hashQuads

      private static String hashQuads(String id, Map<String,Object> bnodes, UniqueNamer namer)
      Hashes all of the quads about a blank node.
      Parameters:
      id - the ID of the bnode to hash quads for.
      bnodes - the mapping of bnodes to quads.
      namer - the canonical bnode namer.
      Returns:
      the new hash.
    • sha1hash

      private static String sha1hash(Collection<String> nquads)
      A helper class to sha1 hash all the strings in a collection
      Parameters:
      nquads -
      Returns:
    • encodeHex

      private static String encodeHex(byte[] data)
    • getAdjacentBlankNodeName

      private static String getAdjacentBlankNodeName(Map<String,Object> node, String id)
      A helper function that gets the blank node name from an RDF quad node (subject or object). If the node is a blank node and its value does not match the given blank node ID, it will be returned.
      Parameters:
      node - the RDF quad node.
      id - the ID of the blank node to look next to.
      Returns:
      the adjacent blank node name or null if none was found.