-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to create an edge to existing vertex #233
Comments
Could you please share a small project that demonstrates this?
…-----Original Message-----
From: Laban Okune <[email protected]>
To: mpollmeier/gremlin-scala <[email protected]>
Cc: Subscribed <[email protected]>
Sent: Sun, 25 Feb 2018 5:55
Subject: [mpollmeier/gremlin-scala] Unable to create an edge to existing vertex (#233)
I am able to create the below graph in neo4j using this library - I can create a `Person` vertex, `Email` vertex and `Domain` vertex and the relationships.
![image](https://user-images.githubusercontent.com/12757919/36632627-6444c920-193d-11e8-861d-cdfd5c8e96f7.png)
Now, let's say the `Person` vertex is removed, I also remove the `Email` vertex but leave the `Domain` vertex. This is how my graph now looks.
![image](https://user-images.githubusercontent.com/12757919/36632662-c93b720c-193d-11e8-9b31-eae53a897081.png)
Now another `Person` vertex need to be created. Their email address has same `Domain` as the existing `Domain`. I am able to create the new `Person` vertex and `Email` vertex. I am also able to retrieve the existing `Domain` vertex with the following code.
`val existingDomainVertex: Vertex = graph.V.has(label = "Domain", key = Key[String]("domain"), predicate = P.eq[String]("www.gmail.com")).toList.head`
Just to make sure, `existingDomainVertex.toList.size` is 1. I can also convert this vertex to a my case class and it has all properties.
The problem is I cannot create an edge to this vertex from the newly created `Email` vertex.
`newEmailVertex --- ("DOMAIN") --> existingDomainVertex` does not work.
![image](https://user-images.githubusercontent.com/12757919/36632776-cec3a7ec-193f-11e8-8f31-8ba177f448e4.png)
What might be the issue? This is blocking me on my project because this is going to be a common use case and I have no idea why it works for new vertices by not to existing vertices.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#233
|
@mpollmeier thanks a lot for your response. The code snippets shared below. I hope this gives you a sense of what I am talking about. I have removed some extra code that is not related to the question. Kindly look at the comments to get context.
|
Other issues I have discovered:
|
The code snippets give me an idea, but a 'small project' including e.g. a build.sbt (with your dependencies) and the complete list of imports for the snippets above take out the guesswork. Can you share that as well please? |
@mpollmeier here we go. I have put together this project https://github.com/lokune/neo4j-scala-example Let me know if you have any question. |
The project builds and all tests are green - nothing for me to do I guess :) |
@mpollmeier my bad! I left some workarounds in there and assumed you'll just go through the code :) I just removed them, so tests are failing. Kindly pull the latest changes. Pardon me if there might be some minor mistakes, I rushed through it. |
Sorry, you'll have to make my life easier. There's far too many layers that I would have to get familiar with and unwrap in my head. The tests are failing with http responses etc. Just provide one test that only uses gremlin and neo4j, without calls to some DAO or calling HTTP routes, and assert what it's supposed to do. |
@mpollmeier this is just an Akka Http REST service that does CRUD on neo4j... I am traveling for two weeks, I will try to simplify when I get back. In the mean time, I will use Cypher with Neo4j driver directly. Thank you a lot for your time so far. |
@lokune Have you find a solution for this ? I can not manage to add edge between two retrieving vertices too
gives me at runtime:
I am working with a remote gremlin-server graph initialize this way :
I have try to by pass implicit function using :
node1 and node2 are well retrieved
|
without a full project setup to reproduce it's hard to help, but here's a working example with gremlin-server: I'm pretty sure the |
@mpollmeier I have posted a response, but failed to submit it.. |
Sweet. |
@bdine I am glad you were able to get assistance from @mpollmeier . I have been traveling a lot. For my case (I use Neo4j), I decided to use Cypher directly because it's the only reliable approach for now. I combined this with Scala macros for case class to/from graph mapping and that works perfect! |
@lokune Have you written macros yourself or used some library for mapping? |
@voroninp I got a lot of help from this link http://blog.echo.sh/2013/11/04/exploring-scala-macros-map-to-case-class-conversion.html |
I am able to create the below graph in neo4j using this library - I can create a
Person
vertex,Email
vertex andDomain
vertex and the relationships.Now, let's say the
Person
vertex is removed, I also remove theEmail
vertex but leave theDomain
vertex. This is how my graph now looks.Now another
Person
vertex need to be created. Their email address has sameDomain
as the existingDomain
. I am able to create the newPerson
vertex andEmail
vertex. I am also able to retrieve the existingDomain
vertex with the following code.val existingDomainVertex: Vertex = graph.V.has(label = "Domain", key = Key[String]("domain"), predicate = P.eq[String]("www.gmail.com")).toList.head
Just to make sure,
existingDomainVertex.toList.size
is 1. I can also convert this vertex to a my case class and it has all properties.The problem is I cannot create an edge to this vertex from the newly created
Email
vertex.newEmailVertex --- ("DOMAIN") --> existingDomainVertex
does not work.What might be the issue? This is blocking me on my project because this is going to be a common use case and I have no idea why it works for new vertices by not to existing vertices.
The text was updated successfully, but these errors were encountered: