0
votes

I was able to successfully populate Named Graph over HTTP REST as shown here https://docs.aws.amazon.com/neptune/latest/userguide/load-api-reference-load.html

curl -d "@data.json" -H "Content-Type: application/json" -X POST https://co-neptune-db-cluster-myname.cluster-xxxxxxxxxx.us-east-1.neptune.amazonaws.com:8182/loader

where data.json file is:

{
  "source": "s3://my-bucket-name/dir/",
  "format": "csv",
  "iamRoleArn": "arn:aws:iam::xxxxxxxxxx:role/co-neptune-to-s3-access-role-dev-myname",
  "mode": "AUTO",
  "region": "us-east-1",
  "failOnError": "FALSE",
  "parallelism": "OVERSUBSCRIBE",
  "parserConfiguration": {
    "baseUri": "http://aws.amazon.com/neptune/default",
    "namedGraphUri": "http://aws.amazon.com/account-123456789012-temp"
  },
  "updateSingleCardinalityProperties": "FALSE"
}

so I expect my data be stored in Graph named as http://aws.amazon.com/account-123456789012-temp with content from source S3 bucket s3://my-bucket-name/dir/.

I can see those data while querying with HTTP REST with Gremlin as explained here https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-rest.html

curl -X POST -d '{"gremlin":"g.V().limit(10)"}' https://co-neptune-db-cluster-myname.cluster-xxxxxxxxxx.us-east-1.neptune.amazonaws.com:8182?gremlin

But while querying with SPARQL as described here https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-sparql-http-rest.html I can not see any data in my Neptune:

$ curl -X POST --data-binary 'query=select ?s ?p ?o where {?s ?p ?o} limit 10' https://co-neptune-db-cluster-myname.cluster-xxxxxxxxxx.us-east-1.neptune.amazonaws.com:8182/sparql

How can I query same data with SPARQL? Taking into account that I will have different Named Graphs so need to set Name of specific Graph in my Request.

1

1 Answers

1
votes

Today, Neptune doesn't support interoperability between Property Graph and RDF. You need to choose which framework you are going to use before loading data into the cluster. If you load data in via CSV, it can only be used in the Property Graph model (using Gremlin to query it). If you load the data in using one of the RDF file formats (turtle, rdfxml, ntriples, or nquads), then you can only query it via SPARQL.

Neptune does support storing data for both models in the same cluster, but you would need to effectively load two copies of the data (one in Property Graph and the other in RDF).

Also, the parserConfiguration parameter of the bulk loader is only supported when bulk loading one of the RDF file formats. It has no impact on loading Property Graph (CSV) data.

There is a utility provided to convert Property Graph CSV files to RDF nquads files [1].

[1] https://github.com/aws/amazon-neptune-csv-to-rdf-converter