apoc.schema.properties.distinctCount过程
|
语法 |
|
||
描述 |
返回给定键的所有不同属性值及其计数。 |
||
输入参数 |
名称 |
类型 |
描述 |
|
|
要统计不同属性的节点标签。如果设置为 |
|
|
|
要统计不同值的属性名称。如果设置为 |
|
返回参数 |
名称 |
类型 |
描述 |
|
|
节点的标签。 |
|
|
|
属性键的名称。 |
|
|
|
不同的值。 |
|
|
|
该值出现的次数。 |
|
使用示例
本节中的示例基于以下示例图
CREATE (:Person {name: "Michael", age: 45});
CREATE (:Person {name: "Ryan", age: 33});
CREATE (:Person {name: "Michael", age: 42});
CREATE (:Dog {name: "Shadow", age: 11});
特定标签和属性名称
CALL apoc.schema.properties.distinctCount("Person", "name");
| 标签 (label) | 键 (key) | 值 | count |
|---|---|---|---|
"Person" |
"name" |
“Michael” |
2 |
"Person" |
"name" |
"Ryan" |
1 |
所有标签和特定属性名称
将输入参数 label 设置为 `` 将返回所有标签和指定属性名称的不同属性值及其计数。
CALL apoc.schema.properties.distinctCount("", "name");
| 标签 (label) | 键 (key) | 值 | count |
|---|---|---|---|
"Person" |
"name" |
“Michael” |
2 |
"Person" |
"name" |
"Ryan" |
1 |
"Dog" |
"name" |
"Shadow" |
1 |
特定标签和所有属性名称
将输入参数 key 设置为 `` 将返回指定标签和所有属性名称的不同属性值及其计数。
CALL apoc.schema.properties.distinctCount("Person", "");
| 标签 (label) | 键 (key) | 值 | count |
|---|---|---|---|
"Person" |
"name" |
“Michael” |
2 |
"Person" |
"name" |
"Ryan" |
1 |
"Person" |
"age" |
45 |
1 |
"Person" |
"age" |
33 |
1 |
"Person" |
"age" |
42 |
1 |
所有标签和所有属性名称
将输入参数 label 和 key 设置为 `` 将返回所有标签和所有属性名称的不同属性值及其计数。
CALL apoc.schema.properties.distinctCount("", "");
| 标签 (label) | 键 (key) | 值 | count |
|---|---|---|---|
"Person" |
"name" |
“Michael” |
2 |
"Person" |
"name" |
"Ryan" |
1 |
"Dog" |
"name" |
"Shadow" |
1 |
"Person" |
"age" |
45 |
1 |
"Person" |
"age" |
33 |
1 |
"Person" |
"age" |
42 |
1 |
"Dog" |
"age" |
11 |
1 |
|
在 APOC 2025.11 版本中,此过程经过了重大重构,包含多项错误修复。因此,在多种情况下,其行为与以前的版本相比发生了变化。
|