[英]Can Nodes in py2neo be inherited?
I am building an application in Flask using py2neo as a graph database. 我正在使用py2neo作为图形数据库在Flask中构建应用程序。 I have a node for a generic item, and a node for a specific implementation of that item.
我有一个用于通用项目的节点,以及一个用于该项目的特定实现的节点。 What I want is that if I search for all the generic nodes, that the specific implementation of those nodes also appear in the results.
我想要的是,如果我搜索所有通用节点,那么这些节点的特定实现也将出现在结果中。 I would usually just inherit the Node as an object, but according to this question , py2neo throws an exception.
我通常只继承Node作为对象,但是根据这个问题 ,py2neo抛出异常。 The answer given in that question is specific for Django, so it is not useful for me since I am using Flask.
该问题中给出的答案是特定于Django的,因此对我来说没有用,因为我正在使用Flask。
How would this be implemented? 如何实施?
I am able to implement this by using node.labels.add()
function as described in this documentation and just add labels to that node. 我可以通过使用本文档中介绍的
node.labels.add()
函数来实现此目的,并且只需向该节点添加标签即可。 It achieves the same purpose. 它达到了相同的目的。 This can also be done in Cypher as described in this reference document by using the
SET n:Label
command. 也可以使用
SET n:Label
命令在Cypher中完成此参考文档中所述的操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.