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

Refactor getRelatedReferences #847

Closed
Tracked by #897
foundrytom opened this issue Mar 23, 2023 · 4 comments · Fixed by #915
Closed
Tracked by #897

Refactor getRelatedReferences #847

foundrytom opened this issue Mar 23, 2023 · 4 comments · Fixed by #915
Assignees
Labels
api change feature branch For issues that should target a feature branch

Comments

@foundrytom
Copy link
Collaborator

What

The current 'three methods in one' should be refactored in to individual methods.

Why

It has been noted that 'remembering all the rules for the lengths of the input arrays' is confusing and fragile.

@foundrytom foundrytom assigned foundrytom and unassigned foundrytom Apr 4, 2023
@foundrytom foundrytom added this to the Core stable milestone Apr 13, 2023
@foundrytom
Copy link
Collaborator Author

Proposal:

entitiesWithRelationship, entitesWithRelationships

Then for #16: add* and remove*

@elliotcmorris
Copy link
Contributor

Do we mean entitiesWithRelationship and entityWithRelationships, ie a many->one and a one->many?

@foundrytom
Copy link
Collaborator Author

foundrytom commented Apr 13, 2023

Capturing offline discussion:

  • Naming things is hard.
  • Were struggling to find a clear winner.
  • Were prob going to leave add/remove untill later.
  • Finding a less-than-perfect solution that works for all potential permutations is more valuable than perfection that constrains options later.

Proposal:

Sleep on it, and if we can't come up with a better option by e.o.d 14th the just go with this:

entitiesWithRelationship(entityRefs, relationship, ... )
entitiesWithRelationsips(entityRef, relationships, ... )

addRelationship(targetRefs, relationship, listOfRefLists, ... )
addRelationships(targetRef, relationships, listOReffLists, ... )

removeRelationship(targetRefs, relationship, listOfRefLists, ... )
removeRelationships(targetRef, relationships, listOfRefLists, ... )

@foundrytom
Copy link
Collaborator Author

foundrytom commented May 3, 2023

Subsequent to some further discussion/casual surveying have renamed the query methods to better align with their counterparts and other API methods:

getWithRelationship(entityRefs, relationship, ... )
getWithRelationships(entityRef, relationships, ... )

foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 4, 2023
The old "two lists" formulation was hard to grok, and difficult to
implement effectively. Splitting into two discrete methods better
outlines the two potential batch axis.

This new approach makes it clear the two well-known divergent use cases
and allows for a simpler code path in each - without the need to
interrogate the input arrays to work out which pattern is being used
(one-to-many or many-to-one).

Naming this was hard, after assorted rounds, this option emerged as a
'best of a bad bunch', as it is at least consitent with future
'addRelationship' and 'removeRelationship' methods, along with our more
general noun/verb conventions. There is certainly ambiguity as the
singular/plural difference is subtle, but it's the best we could come up
with.

Closes OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 4, 2023
We have always documented that supporting relationship queries is
optional for a manager (though highly recommended). Despite this the
API methods were marked as being abstract. We only got away with this
as since the move to Python 3, ABC enforcement wasn't working.

This adds default implementations of `getRelationship` and
`getRelationships` that simply returns an empty list for each element of
the batch.

Part of OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 4, 2023
The old "two lists" formulation was hard to grok, and difficult to
implement effectively. Splitting into two discrete methods better
outlines the two potential batch axis.

This new approach makes it clear the two well-known divergent use cases
and allows for a simpler code path in each - without the need to
interrogate the input arrays to work out which pattern is being used
(one-to-many or many-to-one).

Naming this was hard, after assorted rounds, this option emerged as a
'best of a bad bunch', as it is at least consitent with future
'addRelationship' and 'removeRelationship' methods, along with our more
general noun/verb conventions. There is certainly ambiguity as the
singular/plural difference is subtle, but it's the best we could come up
with.

Closes OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 4, 2023
We have always documented that supporting relationship queries is
optional for a manager (though highly recommended). Despite this the
API methods were marked as being abstract. We only got away with this
as since the move to Python 3, ABC enforcement wasn't working.

This adds default implementations of `getRelationship` and
`getRelationships` that simply returns an empty list for each element of
the batch.

Part of OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 4, 2023
The old "two lists" formulation was hard to grok, and difficult to
implement effectively. Splitting into two discrete methods better
outlines the two potential batch axis.

This new approach makes it clear the two well-known divergent use cases
and allows for a simpler code path in each - without the need to
interrogate the input arrays to work out which pattern is being used
(one-to-many or many-to-one).

Naming this was hard, after assorted rounds, this option emerged as a
'best of a bad bunch', as it is at least consitent with future
'addRelationship' and 'removeRelationship' methods, along with our more
general noun/verb conventions. There is certainly ambiguity as the
singular/plural difference is subtle, but it's the best we could come up
with.

Closes OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 4, 2023
We have always documented that supporting relationship queries is
optional for a manager (though highly recommended). Despite this the
API methods were marked as being abstract. We only got away with this
as since the move to Python 3, ABC enforcement wasn't working.

This adds default implementations of `getRelationship` and
`getRelationships` that simply returns an empty list for each element of
the batch.

Part of OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 4, 2023
The old "two lists" formulation was hard to grok, and difficult to
implement effectively. Splitting into two discrete methods better
outlines the two potential batch axis.

This new approach makes it clear the two well-known divergent use cases
and allows for a simpler code path in each - without the need to
interrogate the input arrays to work out which pattern is being used
(one-to-many or many-to-one).

Naming this was hard, after assorted rounds, this option emerged as a
'best of a bad bunch', as it is at least consitent with future
'addRelationship' and 'removeRelationship' methods, along with our more
general noun/verb conventions. There is certainly ambiguity as the
singular/plural difference is subtle, but it's the best we could come up
with.

Closes OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 4, 2023
We have always documented that supporting relationship queries is
optional for a manager (though highly recommended). Despite this the
API methods were marked as being abstract. We only got away with this
as since the move to Python 3, ABC enforcement wasn't working.

This adds default implementations of `getRelationship` and
`getRelationships` that simply returns an empty list for each element of
the batch.

Part of OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 4, 2023
The old "two lists" formulation was hard to grok, and difficult to
implement effectively. Splitting into two discrete methods better
outlines the two potential batch axis.

This new approach makes it clear the two well-known divergent use cases
and allows for a simpler code path in each - without the need to
interrogate the input arrays to work out which pattern is being used
(one-to-many or many-to-one).

Naming this was hard, after assorted rounds, this option emerged as a
'best of a bad bunch', as it is at least consitent with future
'addRelationship' and 'removeRelationship' methods, along with our more
general noun/verb conventions. There is certainly ambiguity as the
singular/plural difference is subtle, but it's the best we could come up
with.

Closes OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 4, 2023
We have always documented that supporting relationship queries is
optional for a manager (though highly recommended). Despite this the
API methods were marked as being abstract. We only got away with this
as since the move to Python 3, ABC enforcement wasn't working.

This adds default implementations of `getWithRelationship` and
`getWithRelationships` that simply returns an empty list for each
element of the batch.

Part of OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 4, 2023
The old "two lists" formulation was hard to grok, and difficult to
implement effectively. Splitting into two discrete methods better
outlines the two potential batch axis.

This new approach makes it clear the two well-known divergent use cases
and allows for a simpler code path in each - without the need to
interrogate the input arrays to work out which pattern is being used
(one-to-many or many-to-one).

Naming this was hard, after assorted rounds, this option emerged as a
'best of a bad bunch', as it is at least consitent with future
'addRelationship' and 'removeRelationship' methods, along with our more
general noun/verb conventions. There is certainly ambiguity as the
singular/plural difference is subtle, but it's the best we could come up
with.

Closes OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 4, 2023
We have always documented that supporting relationship queries is
optional for a manager (though highly recommended). Despite this the
API methods were marked as being abstract. We only got away with this
as since the move to Python 3, ABC enforcement wasn't working.

This adds default implementations of `getWithRelationship` and
`getWithRelationships` that simply returns an empty list for each
element of the batch.

Part of OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>

Signed-off-by: Tom Cowland <tom@foundry.com>
@foundrytom foundrytom added the feature branch For issues that should target a feature branch label May 9, 2023
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 10, 2023
The old "two lists" formulation was hard to grok, and difficult to
implement effectively. Splitting into two discrete methods better
outlines the two potential batch axis.

This new approach makes it clear the two well-known divergent use cases
and allows for a simpler code path in each - without the need to
interrogate the input arrays to work out which pattern is being used
(one-to-many or many-to-one).

Naming this was hard, after assorted rounds, this option emerged as a
'best of a bad bunch', as it is at least consitent with future
'addRelationship' and 'removeRelationship' methods, along with our more
general noun/verb conventions. There is certainly ambiguity as the
singular/plural difference is subtle, but it's the best we could come up
with.

Closes OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 10, 2023
We have always documented that supporting relationship queries is
optional for a manager (though highly recommended). Despite this the
API methods were marked as being abstract. We only got away with this
as since the move to Python 3, ABC enforcement wasn't working.

This adds default implementations of `getWithRelationship` and
`getWithRelationships` that simply returns an empty list for each
element of the batch.

Part of OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 10, 2023
We have always documented that supporting relationship queries is
optional for a manager (though highly recommended). Despite this the
API methods were marked as being abstract. We only got away with this
as since the move to Python 3, ABC enforcement wasn't working.

This adds default implementations of `getWithRelationship` and
`getWithRelationships` that simply returns an empty list for each
element of the batch.

Part of OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 18, 2023
The old "two lists" formulation was hard to grok, and difficult to
implement effectively. Splitting into two discrete methods better
outlines the two potential batch axis.

This new approach makes it clear the two well-known divergent use cases
and allows for a simpler code path in each - without the need to
interrogate the input arrays to work out which pattern is being used
(one-to-many or many-to-one).

Naming this was hard, after assorted rounds, this option emerged as a
'best of a bad bunch', as it is at least consitent with future
'addRelationship' and 'removeRelationship' methods, along with our more
general noun/verb conventions. There is certainly ambiguity as the
singular/plural difference is subtle, but it's the best we could come up
with.

Closes OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO that referenced this issue May 18, 2023
We have always documented that supporting relationship queries is
optional for a manager (though highly recommended). Despite this the
API methods were marked as being abstract. We only got away with this
as since the move to Python 3, ABC enforcement wasn't working.

This adds default implementations of `getWithRelationship` and
`getWithRelationships` that simply returns an empty list for each
element of the batch.

Part of OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit that referenced this issue May 31, 2023
The old "two lists" formulation was hard to grok, and difficult to
implement effectively. Splitting into two discrete methods better
outlines the two potential batch axis.

This new approach makes it clear the two well-known divergent use cases
and allows for a simpler code path in each - without the need to
interrogate the input arrays to work out which pattern is being used
(one-to-many or many-to-one).

Naming this was hard, after assorted rounds, this option emerged as a
'best of a bad bunch', as it is at least consistent with future
'addRelationship' and 'removeRelationship' methods, along with our more
general noun/verb conventions. There is certainly ambiguity as the
singular/plural difference is subtle, but it's the best we could come up
with.

These new methods also use the batch callback pattern established with
the other batch API signatures.

In addition, we have always documented that supporting relationship
queries is optional for a manager (though highly recommended). Despite
this the API methods were marked as being abstract. We only got away
with this as since the move to Python 3, ABC enforcement wasn't working.

There are now default implementations of `getWithRelationship` and
`getWithRelationships` that simply return an empty list for each
element of the batch.

NB. This commit disables BAL integration tests due to the API break.

Closes #847
Closes #919

Signed-off-by: Tom Cowland <tom@foundry.com>
foundrytom added a commit to foundrytom/OpenAssetIO-Manager-BAL that referenced this issue Jun 1, 2023
Until a13 is released, we need to build our own OpenAssetIO from src
due to API changes.

See OpenAssetIO/OpenAssetIO#847

Signed-off-by: Tom Cowland <tom@foundry.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change feature branch For issues that should target a feature branch
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants