是否可以在同一个 Memgraph 实例中拥有逻辑上分离的图?
与关系数据库中同一数据库服务器上可以有多个数据库类似,是否可以在同一个 Memgraph 实例中保存多个图形?
如果不是,从逻辑上分离这些图的最佳方法是什么?
Similar to how in a relational database you could have multiple databases on the same DB server, is it possible to save multiple graphs in the same Memgraph instance?
If not, what would be the best way to logically separate such graphs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用标签来实现此行为。例如,您可以将标签
GraphOne
添加到第一个图的每个节点,将标签GraphTwo
添加到第二个图的每个节点,依此类推。节点可以有多个标签,因此您仍然可以保留原始标签和告诉您特定节点属于哪个图的新标签。您可以使用相同的技术来保存多层网络。除了此方法之外,唯一的其他选项是启动新实例。
如果您担心大量元数据,标签不会占用大量内存,因此不会增加太多开销。通过要求在每个查询中使用这些标签可以实现额外的安全性。例如,如果您使用 GQLAlchemy 连接,则检查每个查询以查看它是否包含适当的标签(GraphOne、GraphTwo 等),如果不包含则抛出错误。
You can achieve this behavior using labels. For example, you can add the label
GraphOne
to each node of the first graph, the labelGraphTwo
to each node of the second graph, and so on. Nodes can have multiple labels, so you can still keep the original labels and the new ones that tell you which graph a specific node belongs to. You can use the same technique to save multilayer networks.Aside from this method, the only other option is to fire up a new instance.
If you are worried about lots of metadata, the label will not use up a lot of memory, so not much overhead is added. Additional security can be implemented by requiring the use of these labels in each query. For example, if you are connecting with GQLAlchemy, you check each query to see if it contains an appropriate label (GraphOne, GraphTwo, etc.) and throw an error if it's not included.