最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

gremlin - Retrieve AWS Neptune T.id with Neo4j OGM - Stack Overflow

programmeradmin2浏览0评论

In AWS Neptune, I have created a Vertex with the help of Gremlin library (Java) :

var createdVertex = g.addV(vertex.getArtifactType());
createdVertex.property(T.id, vertexId); => UUID String
createdVertex.property(Cardinality.single, ARN, vertex.getArn()); => String
createdVertex.property(Cardinality.single, ARTIFACT_TYPE, vertex.getArtifactType());  => String
createdVertex.property(Cardinality.single, DISPLAY_NAME, vertex.getDisplayName());  => String
createdVertex.property(Cardinality.single, CREATED_AT, vertex.getCreatedAt());  => Timestamp 
createdVertex.property(Cardinality.single, UPDATED_AT, vertex.getUpdatedAt());  => Timestamp

Until here, everything works as expected !

Now, I would like to have a try on an other library which allows me to benefit from CRUD operation and automatic mapping like JPA/Hibernate does. I then have a look at the Neo4j OGM library.

I do a simple session.loadAll(Class class)

My problem occurs in the automatic mapping done by neo4j-ogm. I think neo4j is mainly developed to meet neo4j server with cypher base. But since AWS Neptune is compliant for both (Open)Cypher and Gremlin Apache/TinkerPop, I thought i could easily use neo4j ogm with AWS Neptune.

The probleme I currently faced is the following :

Using the below class with Neo4j annotations

@NodeEntity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Vertex {

    private String id; 

    @NotBlank
    private String arn;

    @NotBlank
    private String artifactType;

    @NotBlank
    private String displayName;

    @NotNull
    private Long createdAt;

    @NotNull
    private Long updatedAt;

    private Map<String, Object> properties;

I am not able to retrieve to previous UUID inserted with Gremlin. Instead it retrieved i think an internal neptune long id

I try with the following

@Id
@Property(name = "id")
private String id;
@Id
@Property(name = "~id")
private String id;
@Id
@Property(name = "`~id`")
private String id;
@Id
@Property(name = "nodeId")
private String nodeId;
@Id
@Property(name = "~nodeId")
private String nodeId;
@Id
@Property(name = "`~nodeId`")
private String nodeId;

None of the aboved solutions allow me to retrieve (through OGM) the full vertex object with the String uuid.

Do I miss or missunderstand something ?

Thanks for any suggestion

In AWS Neptune, I have created a Vertex with the help of Gremlin library (Java) :

var createdVertex = g.addV(vertex.getArtifactType());
createdVertex.property(T.id, vertexId); => UUID String
createdVertex.property(Cardinality.single, ARN, vertex.getArn()); => String
createdVertex.property(Cardinality.single, ARTIFACT_TYPE, vertex.getArtifactType());  => String
createdVertex.property(Cardinality.single, DISPLAY_NAME, vertex.getDisplayName());  => String
createdVertex.property(Cardinality.single, CREATED_AT, vertex.getCreatedAt());  => Timestamp 
createdVertex.property(Cardinality.single, UPDATED_AT, vertex.getUpdatedAt());  => Timestamp

Until here, everything works as expected !

Now, I would like to have a try on an other library which allows me to benefit from CRUD operation and automatic mapping like JPA/Hibernate does. I then have a look at the Neo4j OGM library.

I do a simple session.loadAll(Class class)

My problem occurs in the automatic mapping done by neo4j-ogm. I think neo4j is mainly developed to meet neo4j server with cypher base. But since AWS Neptune is compliant for both (Open)Cypher and Gremlin Apache/TinkerPop, I thought i could easily use neo4j ogm with AWS Neptune.

The probleme I currently faced is the following :

Using the below class with Neo4j annotations

@NodeEntity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Vertex {

    private String id; 

    @NotBlank
    private String arn;

    @NotBlank
    private String artifactType;

    @NotBlank
    private String displayName;

    @NotNull
    private Long createdAt;

    @NotNull
    private Long updatedAt;

    private Map<String, Object> properties;

I am not able to retrieve to previous UUID inserted with Gremlin. Instead it retrieved i think an internal neptune long id

I try with the following

@Id
@Property(name = "id")
private String id;
@Id
@Property(name = "~id")
private String id;
@Id
@Property(name = "`~id`")
private String id;
@Id
@Property(name = "nodeId")
private String nodeId;
@Id
@Property(name = "~nodeId")
private String nodeId;
@Id
@Property(name = "`~nodeId`")
private String nodeId;

None of the aboved solutions allow me to retrieve (through OGM) the full vertex object with the String uuid.

Do I miss or missunderstand something ?

Thanks for any suggestion

Share Improve this question edited 13 hours ago cybersam 67k6 gold badges57 silver badges80 bronze badges asked yesterday dr0psdr0ps 193 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The Neo4j OGM library targets Neo4j servers, and is not compatible with AWS Neptune. The two DBMS systems are too different.

You should not assume that any tools designed to work only with Neo4j will work for any other DBMS, even if they claim to support openCypher, which is not the same as Cypher. And Cypher is only one part of the entire Neo4j ecosystem anyway.

Also, to quote the Neptune User Guide: "In spite of being compatible in many ways, Neptune is not a drop-in replacement for Neo4j."

发布评论

评论列表(0)

  1. 暂无评论