-
Notifications
You must be signed in to change notification settings - Fork 228
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
Return correct subclass from relationship #262
Comments
Hmm if you add |
There are a number of bugs related to this.
What is going on here is that If you don't use the cardinality attribute you're left with problem 2 mentioned above. |
Thinking about this some more... I think the correct solution is that you need to keep the |
@robinedwards The idea behind #263 is to apply this logic:
This logic works for me. I think it is valid in the general case. Perhaps enabling this could be a config option? |
Hey apologies my brain wasn't in gear yesterday. We need to be a little bit careful as I think there is some existing functionality built around assuming abstract nodes dont have labels.. However your case above (relation to abstract node) should definitely raise a friendly error message in the current release of neomodel. What you are trying to achieve is quite similar to #126 Now I am not opposed to changing the behaviour of inheritance in a major release of neomodel, the current situation is confusing at best. In fact the whole handling of 'abstract nodes' is hacky and unpythonic. One issue with the subclass behaviour is when someone wants to build a model which actually points to the super class (none abstract) it becomes tricky. |
@pvanheus Can I please ask if you have tried version |
I have a model with this design: Gene is located on either Chromosome or Contig. At the moment I'm solving this in the model by creating a class Feature from which both Chromosome and Contig inherit. The
RelationshipTo
is restricted to specifying a single class, so node I have code similar to:In the real model,
Contig
andChromosome
have different attributes. The problems that arise with this model are that:gene.location.all()
) aFeature
is returned, not the actualChromosome
orContig
that the gene is located on.Inside the code the correct label is identified during querying but the actual object returned is of the superclass.
The text was updated successfully, but these errors were encountered: