Neo4j中图形的元属性

时间:2018-03-16 16:35:05

标签: graph neo4j graph-databases tinkerpop

在遍历Neo4j图时,我想为图的每个属性设置一些key-val对。使用元属性很容易,但在Neo4j图形特征中,"元属性"功能是假的(不存在)。有没有其他方法可以做同样的事情?

1 个答案:

答案 0 :(得分:1)

由于Neo4j在其图形数据库中本身不支持该功能,因此元属性只能作为neo4j图实现的一部分进行模拟。默认情况下禁用它们,因此在使用gremlin.neo4j.metaProperties选项构建图形时,必须在配置中明确启用它们:

gremlin> conf = new BaseConfiguration()
==>org.apache.commons.configuration.BaseConfiguration@6c99bc97
gremlin> conf.setProperty('gremlin.neo4j.directory','/tmp/neo4j')
gremlin> conf.setProperty('gremlin.neo4j.metaProperties',true)
gremlin> graph = Neo4jGraph.open(conf)
==>neo4jgraph[community single [/tmp/neo4j]]

您可以阅读有关此here

的更多信息