Gremlin query in Lambda not returning results

170 Views Asked by At

I am trying to execute a Neptune SparQl query inside a Lambda function.

Following the documentation : AWS Lambda function examples for Amazon Neptune

I have used the sample for nodeJS.

Running the sample I get in response :

{
  "value": "5403",
  "done": false
}

I am not familiar with the Gremlin syntax and while reading the following documentation : PRACTICAL GREMLIN there are some examples.

My working SparQl query in Jyppiter on AWS :

base <http://uri.name/>
prefix : <property/>
prefix class: <Class/>

SELECT *
from <graphs/Asset/EXTRA>
where {
    ?v ?e ?u
}
limit 100

Results like this :

http://uri.name/assets/1 || http://www.w3.org/1999/02/22-rdf-syntax-ns#type ||  http://uri.name/class/Class

Trying to translate to Gremlin :

    b: await g.V().hasLabel('assets').valueMap().toList(),
    c: await g.V().hasLabel('assets').values('assets').limit(20).next()

And several variants, however they all result like so :

"b": [
    {},
    {},
    {},
    {},
    {}
  ],
  "c": {
    "value": null,
    "done": true
  },

Is there something I'm missing with formatting or query related ?

1

There are 1 best solutions below

0
On BEST ANSWER

Amazon Neptune supports two data representations. RDF and Property Graph. Any data loaded as RDF must be queried using SPARQL. Data loaded as a property graph can be queried using Gremlin or openCypher. You cannot mix and match Gremlin and SPARQL over the same data.

To issue a SPARQL query from AWS Lambda, you will either need to just send an HTTP request to https:<neptune-cluster>:<port>/sparql or use a library such as SPARQLWrapper or RDFLib.