简体   繁体   English

使用 Gremlin 访问 Neptune 中的命名图

[英]Access Named Graph in Neptune with Gremlin

I need to save several Graphs in Neptune DB cluster.我需要在 Neptune 数据库集群中保存几个图形。

Named Graph is smths that is supported for SPARQL format in Neptune https://docs.aws.amazon.com/neptune/latest/userguide/best-practices-sparql-graph.html命名图是 Neptune 中 SPARQL 格式支持的 smths https://docs.aws.amazon.com/neptune/latest/userguide/best-practices-sparql-graph.html

Is that possible to query that Graph s with GREMLIN?那是可能的查询图表s的GREMLIN?

I found only this approach https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-rest.html but no any references to ability to access Named graph.我只发现了这种方法https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-rest.html但没有任何关于访问命名图能力的引用。 Maybe I missed some?也许我错过了一些?

When using the property graph model in Neptune you can only create a single graph.在 Neptune 中使用属性图模型时,您只能创建一个图。 There is no direct equivalent to a Named Graph for the property graph data model.属性图数据模型没有与命名图的直接等价物。

When using Amazon Neptune you have several options for this sort of multi-graph approach.使用 Amazon Neptune 时,您有多种选择可用于此类多图方法。

  1. If your use case makes sense for an RDF model you can use that model which has Named Graph support如果您的用例对 RDF 模型有意义,您可以使用具有命名图支持的模型
  2. If you need to use the property graph model, then you can look at using something like the Gremlin Partition Strategy to partition your single graph into multiple different graphs如果您需要使用属性图模型,那么您可以考虑使用Gremlin Partition Strategy 之类的东西将您的单个图划分为多个不同的图
  3. When neither of the above options work, then you may need to potentially use multiple clusters, one for each graph.当上述选项都不起作用时,您可能需要使用多个集群,每个图一个。

If you create a named, RDF graph, using Amazon Neptune then you can only query that graph using SPARQL queries.如果您使用 Amazon Neptune 创建命名的 RDF 图,则您只能使用 SPARQL 查询来查询该图。 Gremlin does not have a named graph concept but you can use a PartitionStrategy to automatically tag graph elements (nodes, edges) as being part of some logical 'partition'. Gremlin 没有命名图概念,但您可以使用PartitionStrategy自动将图元素(节点、边)标记为某个逻辑“分区”的一部分。 You can use this technique in Gremlin queries to essentially do what you would do with a named graph in RDF so long as you are careful that edges do not allow you to "jump" between the logical graphs.您可以在 Gremlin 查询中使用此技术来执行您在 RDF 中使用命名图所做的基本操作,只要您注意边不允许您在逻辑图之间“跳跃”。

See also: https://tinkerpop.apache.org/docs/current/reference/#_partitionstrategy另见: https : //tinkerpop.apache.org/docs/current/reference/#_partitionstrategy

and

https://tinkerpop.apache.org/docs/current/reference/#_subgraphstrategy https://tinkerpop.apache.org/docs/current/reference/#_subgraphstrategy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM