You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the great things about a graph database is the ability to leverage relationships between existing entities to both describe a larger concept and at the same time reduce the amount of duplication of data. It would be a great feature if structr had an option to automatically associate entities during create/update operations based on a unique constraint violation.
Consider the following (Note: Address has a unique constraint on Line1, City, State, and Postal Code)
Create: User U1 is located at Address A1 and Works at A2
Create: User U2 is located at Address A3 and Works at A2
Update: User U1 is now located at Address A3 and now Works at A5
When I create U1, I would expect A1 and A2 to automatically be created -- this is possible today using the "Automatic Creation of Related Nodes" option.
When I create U2, I would expect A3 to be automatically created and a relationship between U2 and A2 to be created -- this does NOT seem to be possible today (unless I am missing something)
When I update U1, I would expect a relationship be created to Address A3 and a new address created for A5 -- note, I would expect I need to manually remove the relationship to Address A1.
While I know ALL of this is manually possible by creating the individual records and manually creating the relationships it requires a very large number of queries to be executed.
Consider what currently needs to be done
For Create
Query for U1, if not found Create User U1 (2 API calls)
Query for A1, if not found Create Address A1 (2 API calls)
Query for relationship between U1 and A1, if not found create relationship (2 API calls)
For Update
Query for U1, if found Update User U1 (2 API calls)
Query for A1, if found Update Address A1, if not found create Address A1 (3 API calls)
Query for relationship between U1 and A1, if not found create relationship (2 API calls)
For just one instance you have at best 3 API calls and at worst 7 API calls. Where as the idea I am suggestion would amount to at most 2 API calls (Query for User, Create/Update with related records) and structr would internally take care of Creating/Updating related records.
Thoughts?
The text was updated successfully, but these errors were encountered:
amorgner
changed the title
Feature Request: Allow automatic creatation of relationship on duplicate during create/update
Feature Request: Allow automatic creation of relationship on duplicate during create/update
Sep 29, 2016
One of the great things about a graph database is the ability to leverage relationships between existing entities to both describe a larger concept and at the same time reduce the amount of duplication of data. It would be a great feature if structr had an option to automatically associate entities during create/update operations based on a unique constraint violation.
Consider the following (Note: Address has a unique constraint on Line1, City, State, and Postal Code)
When I create U1, I would expect A1 and A2 to automatically be created -- this is possible today using the "Automatic Creation of Related Nodes" option.
When I create U2, I would expect A3 to be automatically created and a relationship between U2 and A2 to be created -- this does NOT seem to be possible today (unless I am missing something)
When I update U1, I would expect a relationship be created to Address A3 and a new address created for A5 -- note, I would expect I need to manually remove the relationship to Address A1.
While I know ALL of this is manually possible by creating the individual records and manually creating the relationships it requires a very large number of queries to be executed.
Consider what currently needs to be done
For Create
For Update
For just one instance you have at best 3 API calls and at worst 7 API calls. Where as the idea I am suggestion would amount to at most 2 API calls (Query for User, Create/Update with related records) and structr would internally take care of Creating/Updating related records.
Thoughts?
The text was updated successfully, but these errors were encountered: