3

I am accessing a neptune DataBase instance from a Lambda, I have successfully configured the connection of the neptune database from the lambda using the following

Cluster.Builder builder = Cluster.build();
builder.addContactPoint("endpoint");
builder.port(8182);
builder.enableSsl(true);
builder.keyCertChainFile("SFSRootCAG2.pem"); 

I have even sent update and insert statements to the database using

GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using(cluster));
g.addV("Custom Label").property(T.id, "CustomId1").property("name", "Custom id vertex 1").next();

But when I try to retrieve properties of the vertex

Vertex vertex = g.V().has(T.id, "CustomId1").next(); System.out.println((String) vertex.value("name"));

I receive the error that the property name doesn't not exist on that vertex:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: The property does not exist as the key has no associated value for the provided element: v[CustomId1]:name

Can someone please let me know that is the mistake i am making here?

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
Rishit Ratan
  • 95
  • 1
  • 2
  • 7

1 Answers1

3

The vertex you get back from the query is known as a reference vertex. It will only contain an ID and a label. For properties you need you should explicitly ask for them using a step like values, project or valueMap.

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
  • Hi Kelvin, what is the best way to configure the gremlin server to create UUID by default for vertices? – Adi Ohana Apr 21 '21 at 11:09
  • It would be best to ask that as a new question as this one was on a different topic. The Gremlin Server has configurable ID managers. – Kelvin Lawrence Apr 21 '21 at 12:47