apoc.hashing.fingerprinting函数
语法 |
|
||
描述 |
计算 |
||
参数 |
名称 |
类型 |
描述 |
|
|
要进行哈希处理的节点或关系。 |
|
|
|
{ digestAlgorithm = "MD5" :: STRING, strategy = "LAZY" :: STRING, nodeAllowMap = [] :: MAP<STRING, LIST<STRING>>, relAllowMap = [] :: MAP<STRING, LIST<STRING>>, relDisallowMap = [] :: MAP<STRING, LIST<STRING>>, mapAllowList = [] :: LIST<STRING>, mapDisallowList = [] :: LIST<STRING>, allNodesAllowList = [] :: LIST<STRING>, allNodesDisallowList = [] :: LIST<STRING>, allRelsAllowList = [] :: LIST<STRING>, allRelsDisallowList = [] :: LIST<STRING> } 默认值为: |
|
返回 |
|
||
配置参数
| 名称 (name) | type | 默认 | description(描述) |
|---|---|---|---|
digestAlgorithm |
STRING |
"MD5" |
用于计算指纹的算法。支持的值包括: |
strategy |
STRING |
"LAZY" |
定义节点/关系的过滤行为。支持的值包括:
|
nodeAllowMap |
MAP<STRING, LIST<STRING>> |
{} |
节点标签名称映射到该标签允许的属性列表。 |
nodeDisallowMap |
MAP<STRING, LIST<STRING>> |
[] |
节点标签名称映射到该标签需忽略的属性列表。 |
relAllowMap |
MAP<STRING, LIST<STRING>> |
{} |
关系类型名称映射到该类型允许的属性列表。 |
relDisallowMap |
MAP<STRING, LIST<STRING>> |
[] |
关系类型名称映射到该类型需忽略的属性列表。 |
mapAllowList |
LIST<STRING> |
[] |
当被哈希的对象是 map 时,允许的键列表。 |
mapDisallowList |
LIST<STRING> |
[] |
当被哈希的对象是 map 时,需忽略的键列表。 |
allNodesAllowList |
LIST<STRING> |
[] |
全局允许的节点属性列表。 |
allNodesDisallowList |
LIST<STRING> |
[] |
全局忽略的节点属性列表。 |
allRelsAllowList |
LIST<STRING> |
[] |
全局允许的关系属性列表。 |
allRelsDisallowList |
LIST<STRING> |
[] |
全局忽略的关系属性列表。 |
使用示例
本节中的示例基于以下示例图
MERGE (joe:Person {name: "Joe"})
MERGE (ryan:Person {name: "Ryan"})
MERGE (ryan)-[:FOLLOWS {since: datetime("2020-11-04")}]->(joe);
以下示例为 Ryan 生成指纹
MATCH (person:Person {name: "Ryan"})
RETURN apoc.hashing.fingerprinting(person) AS output;
| 输出 |
|---|
"D41D8CD98F00B204E9800998ECF8427E" |
以下示例使用 EAGER 策略为 Ryan 生成指纹,该策略包含节点属性
MATCH (person:Person {name: "Ryan"})
RETURN apoc.hashing.fingerprinting(person, {
strategy: "EAGER"
}) AS output;
| 输出 |
|---|
"81C99DD6C9382C4E01A1873F9E818CE0" |
以下示例为 Ryan 生成指纹,排除了 name 属性
MATCH (person:Person {name: "Ryan"})
RETURN apoc.hashing.fingerprinting(person, {
allNodesDisallowList: ["name"]
}) AS output;
| 输出 |
|---|
"D41D8CD98F00B204E9800998ECF8427E" |
以下示例使用 SHA-256 算法为 Ryan 生成指纹
MATCH (person:Person {name: "Ryan"})
RETURN apoc.hashing.fingerprinting(person, {
digestAlgorithm: "SHA-256"
}) AS output;
| 输出 |
|---|
"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855" |
如果您希望对指纹生成过程进行较少的控制,请参阅 apoc.hashing.fingerprint。