Michael Z
Michael Z

Reputation: 4013

Access Named Graph in Neptune with Gremlin

I need to save several Graphs in Neptune DB cluster.

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

Is that possible to query that Graphs with 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. Maybe I missed some?

Upvotes: 2

Views: 1502

Answers (2)

bechbd
bechbd

Reputation: 6341

When using the property graph model in Neptune you can only create a single graph. 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.

  1. If your use case makes sense for an RDF model you can use that model which has Named Graph support
  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
  3. When neither of the above options work, then you may need to potentially use multiple clusters, one for each graph.

Upvotes: 3

Kelvin Lawrence
Kelvin Lawrence

Reputation: 14391

If you create a named, RDF graph, using Amazon Neptune then you can only query that graph using SPARQL queries. 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'. 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.

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

and

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

Upvotes: 2

Related Questions