Package com.github.jsonldjava.core
Class NormalizeUtils
java.lang.Object
com.github.jsonldjava.core.NormalizeUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNormalizeUtils
(List<Object> quads, Map<String, Object> bnodes, UniqueNamer namer, JsonLdOptions options) -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
encodeHex
(byte[] data) 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).hashBlankNodes
(Collection<String> unnamed_) 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.private static String
Hashes all of the quads about a blank node.private static String
sha1hash
(Collection<String> nquads) A helper class to sha1 hash all the strings in a collection
-
Field Details
-
namer
-
bnodes
-
quads
-
options
-
-
Constructor Details
-
NormalizeUtils
public NormalizeUtils(List<Object> quads, Map<String, Object> bnodes, UniqueNamer namer, JsonLdOptions options)
-
-
Method Details
-
hashBlankNodes
- 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
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
A helper class to sha1 hash all the strings in a collection- Parameters:
nquads
-- Returns:
-
encodeHex
-
getAdjacentBlankNodeName
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.
-