Skip to content
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

Add NodeEntity to abstract node classes to get them persisted to neo4j #1374

Merged
merged 4 commits into from
Nov 25, 2023

Conversation

konradweiss
Copy link
Collaborator

Solves #1373

By adding the @NodeEntity to abstract classes of nodes, neo4j again persists labels like Type, Expression, Declaration. This is only necessary for abstract classes as super classes that are not abstract get the label persisted.

@konradweiss konradweiss requested a review from oxisto as a code owner November 25, 2023 10:16
@konradweiss konradweiss requested a review from KuechA November 25, 2023 10:18
…fer-AISEC/cpg into bugfix/add-abstract-labels-neo4j
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@oxisto oxisto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering why Node does not have the @NodeEntity. Can you check, whether this also solve the issue?

@konradweiss
Copy link
Collaborator Author

I was wondering why Node does not have the @NodeEntity. Can you check, whether this also solve the issue?

Checked it, unfortunately it did not solve it. Node is an open class and apparently adding the annotation does not propagate to the abstract classes. The Node label, however, was also present before adding the annotation. so the behavior is as what I expected after seeing the FunctionDeclaration label at a ConstructorDeclaration. The OGM assumes that a non-abstract Class represents a label and NodeEntity is only needed in the abstract class case.

@konradweiss konradweiss merged commit bb1bfae into main Nov 25, 2023
@konradweiss konradweiss deleted the bugfix/add-abstract-labels-neo4j branch November 25, 2023 19:57
@oxisto oxisto linked an issue Nov 26, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Label from abstract classes are not persisted to Neo4j
2 participants