apoc.create.virtual.fromNode函数
语法 |
|
||
描述 |
从给定的现有 |
||
参数 |
名称 |
类型 |
描述 |
|
|
用于生成虚拟节点的原始节点。 |
|
|
|
需要复制到虚拟节点的属性。 |
|
|
|
|
|
返回 |
|
||
使用示例
本节中的示例基于以下图数据
CREATE (a:Account {type: 'checking', ownerName: 'Maria Perez', ownerId: '123456789', accountNumber: 101010101, routingNumber: 10101010, amount: 1000.00, bank: 'Best Bank'});
CREATE (p:Person {name: 'Jane Doe', birthdate: date('1990-01-13'), favoriteColor: 'green', favoriteDessert: 'ice cream', favoriteMusic: 'classical', favoriteBand: 'The Beatles', favoriteVacation: 'beach', favoriteAnimal: 'horse', favoriteBeverage: 'coffee', favoriteFlower: 'lily'});
apoc.create.virtual.fromNode 过程提供了一种仅可视化或返回所需数据的方法,从而隐藏任何不必要或敏感的部分。
下面的示例展示了如何使用该过程仅返回上述节点中非敏感的属性:
apoc.create.virtual.fromNode
MATCH (a:Account {accountNumber: 101010101})
RETURN apoc.create.virtual.fromNode(a, ['type','bank']);
| account |
|---|
{"type":"checking","bank":"Best Bank"} |
apoc.create.virtual.fromNode 过程还可用于简化具有大量属性的节点,只需显示对查询重要的属性即可。
下面的示例展示了这种用法:
apoc.create.virtual.fromNode
MATCH (p:Person {name: 'Jane Doe'})
RETURN apoc.create.virtual.fromNode(p, ['favoriteColor','favoriteAnimal','favoriteMusic']);
| favorites |
|---|
{"favoriteAnimal":"horse","favoriteMusic":"classical","favoriteColor":│ |
"green"} |