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

Make multiple relationships of same kind between entities possible #688

Open
stefanw opened this issue Feb 19, 2015 · 4 comments
Open

Make multiple relationships of same kind between entities possible #688

stefanw opened this issue Feb 19, 2015 · 4 comments

Comments

@stefanw
Copy link

stefanw commented Feb 19, 2015

If you model a e.g. "works for" relationship, a person might have worked for an organisation many times over (e.g. from 2008 - 2009 and from 2010 - 2012). If I try to add more than one of the same relationship between the same entities, detectiveio just says "This relationship already exists."

I also tried to model this in custom JSON with the documented has_properties and through field rule, but this feature doesn't seem to work:

File detective.io/app/detective/topics/common/summary.py", line 152, in sanitize_field
    field["rules"]["through"] = getattr(field["rules"]["through"], "__name__")
AttributeError: 'unicode' object has no attribute '__name__'

The field["rules"]["through"] in sanitize_field is still the original model reference string that I put in the JSON and is not transformed into a proper Relationship.

I guess I can model multiple of the same relationships between entities by modeling an explicit "virtual relationship" entity in between (manually creating the through relationship), but this seems counterintuitive and cumbersome. Any plans to add the ability to create multiple of the same relationships or any advice how to model this?

@stefanw
Copy link
Author

stefanw commented Mar 4, 2015

I see you intentionally prevent this according to #521. Please reconsider, especially regarding relationships that have additional info attached. This makes detective.io much less flexible.

@pirhoo
Copy link
Collaborator

pirhoo commented Mar 5, 2015

Hi @stefanw,

I don't know why but I hasn't been notify of your issue... We do not plan to implement multiple relationships between entities yet.

Could you give me the JSON you are using to modelize your relationship?

Best

@jmatsushita
Copy link

Hi there. @stefanw was talking to me about this problem yesterday and pointed me to this issue. It seems that #521 is more about streamlining the user experience rather than constraining the modeling. It also seems that the OP aims to actually create what are really different relationship instances (i.e. the "works for" relationship should be labeled with the year) that are of the same relationship type.

Can you explain if you mean that its not a priority in your roadmap, or if there is a technical difficulty? I advised @stefanw to look into the possibility of putting a bounty on this feature, so it'd be interesting to hear about the tech side! It seems that allowing to use "date" labels on relationships would be a really important improvement in the modeling capabilities (like allowing a time slider to follow how relationships evolve in time)...

Cheers,

Jun

@pirhoo
Copy link
Collaborator

pirhoo commented Mar 10, 2015

Hi @jmatsushita,

it's on a our roadmap to expand the way you can create relationships (like multiple instance of the same relationship) but of course it also has technical difficulties. Before adding such abilities, one of our biggest challenge from a technical point of view is to move away from neo4django that has now too few updates and that does NOT implement properties on relationships. For this feature, we create composite models that use relationship ID has reference, very rudimentary.

About dates on relationships, it is already possible to add one as a field. I like your idea of a time slider, it would definitely be a good improvement.

Cheers,

Pierre

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

No branches or pull requests

3 participants