Skip to content

Cannot map path using SDN 6.0.3 #2128

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

Closed
sureshpw opened this issue Jan 26, 2021 · 9 comments
Closed

Cannot map path using SDN 6.0.3 #2128

sureshpw opened this issue Jan 26, 2021 · 9 comments
Assignees
Labels
status: needs-investigation An issue that has been triaged but needs further investigation

Comments

@sureshpw
Copy link

Similar to issue: #2119. But using apoc.path.expand to get all the paths.
Given a sample model: https://neo4j.com/labs/apoc/4.1/graph-querying/expand-paths/

MATCH (p:Person {name: "Alicia"})
CALL apoc.path.expand(p, "FOLLOWS>|KNOWS", ">Engineering", 1, 3)
YIELD path
RETURN path

Previously this can be mapped using a custom @Query returning a Person node (Spring Boot 2.3.4). That in turn will contain all the relationships and connected nodes. With Spring Boot 2.4.2 and SDN 6.0.3 it is not working.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 26, 2021
@meistermeier meistermeier self-assigned this Jan 26, 2021
@meistermeier
Copy link
Collaborator

Neo4j-OGM that was used in SDN version < 6 collected all the returned data and mapped it in a batch afterwards.
With targeting real immutability and reactive support in SDN 6, this cannot be done anymore but needs a more record-oriented.
As you have seen at the other issue(s) we currently improving the path mapping but you need also to take action and return a list of path by collecting all resulting parts (collect(path)).
You could include the vmware snapshot repositories

    <repository>
      <id>spring-snapshots</id>
      <name>Spring Snapshots</name>
      <url>https://repo.spring.io/snapshot</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>

and try the 6.0.4-SNAPSHOT with the updated query. Would be helpful to get any feedback from your side if this would work or more improvements are needed. Our situation is that we cannot foresee all the ways users create paths. Our improvement unifies paths but there could also be some data inside the path objects that might lead to problems and we are eager to fix those for you.

@meistermeier meistermeier added blocked: awaiting feedback and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 26, 2021
@sureshpw
Copy link
Author

sureshpw commented Jan 26, 2021

Thanks for the suggestion. Snapshot works fine on one-to-many relationships. But not fetching one-to-one relationships

@Node("A")
class A {
    @Relationship("TO_B")
    B b;

    @Relationship("TO_C")
    Set<C> cset;
}

In this case collect(path) correctly obtains all the elements of cset. But not the TO_B relationship.

@meistermeier meistermeier added status: needs-investigation An issue that has been triaged but needs further investigation and removed blocked: awaiting feedback labels Jan 26, 2021
@mrksph
Copy link

mrksph commented Jan 26, 2021

Wow, just found this. It really broke our expand functionality. Thanks for the collect tip

@meistermeier
Copy link
Collaborator

@sureshpw could you provide the query you are using to retrieve A, B and C?

@mrksph That is all due to the record-focused mapping as described in #2128 (comment)
This was done intentionally because this is the only way that allows us to not brake a (possible) reactive flow.

@sureshpw
Copy link
Author

sureshpw commented Jan 27, 2021

Not only the one-to-one relationships, collect(path) not returning the grand children (depth > 1) either. Here is a sample project reproducing these problems:

https://github.com/sureshpw/neo4j-path-issue

@mrksph
Copy link

mrksph commented Jan 28, 2021

@meistermeier Hi Gerrit, if I use "collect(path)" when expanding a node that has many first level relationships (14k+) I can't LIMIT the results because they are one big row.

How'd you do it?

@meistermeier
Copy link
Collaborator

@sureshpw There were a problem with the snapshot repository. It did not pick up the latest changes. I re-published the current 6.0.4-SNAPSHOT and from what I see with your test project, everything seems to work. I even migrated the Child and GrandChild relationships from Set to a scalar one and the result stayed the same.

>>>From APOC Path>>>Neo4jApplication.Person(id=20, name=person-1, location=Neo4jApplication.Location(id=23, address=123 Main Street), children=Neo4jApplication.Child(id=21, name=child-1, grandChildren=Neo4jApplication.GrandChild(id=22, name=gchild-1)))

@sureshpw
Copy link
Author

sureshpw commented Jan 29, 2021

@meistermeier I ran the tests again and seeing the correct results. But when I add a one-to-one relationship for the grand-child, that relationship is not being returned. Updated the project. Please check. Thanks.

@meistermeier Updated the model ran the tests again and everything works correctly. When is the ETA for releasing SDN 6.0.4 with this fix? Thanks.

@meistermeier
Copy link
Collaborator

I do not have any official at hand (the calendar is down) but since the next milestone of the next released is scheduled for Feb.,17th (https://github.com/spring-projects/spring-data-commons/wiki/Release-Train-2021.0-(Pascal)) I assume that also the next service release of 2020.0 will happen that day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-investigation An issue that has been triaged but needs further investigation
Projects
None yet
Development

No branches or pull requests

4 participants