知识库

如何在图数据库中获取对象的高级库存

以下 Cypher 可用于获取图数据库中对象数量的简单高级视图。如果要比较两个数据库的内容,可以使用此方法。

match (n) return 'Number of Nodes: ' + count(n) as output UNION
match ()-[]->() return 'Number of Relationships: ' + count(*) as output UNION
CALL db.labels() YIELD label RETURN 'Number of Labels: ' + count(*) AS output UNION
CALL db.relationshipTypes() YIELD relationshipType  RETURN 'Number of Relationships Types: ' + count(*) AS output UNION
CALL db.propertyKeys() YIELD propertyKey  RETURN 'Number of Property Keys: ' + count(*) AS output UNION
CALL db.constraints() YIELD description RETURN 'Number of Constraints:' + count(*) AS output UNION
CALL db.indexes() YIELD description RETURN 'Number of Indexes: ' + count(*) AS output UNION
CALL dbms.procedures() YIELD name RETURN 'Number of Procedures: ' + count(*) AS output

其示例输出如下所示

Number of Nodes: 50013
Number of Relationships: 4
Number of Labels: 4
Number of Relationships Types: 2
Number of Property Keys: 9
Number of Constraints:2
Number of Indexes: 7
Number of Procedures: 215