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

Consider REST API for adding/maintaining relations #109

Open
Pfeil opened this issue Feb 15, 2023 · 2 comments
Open

Consider REST API for adding/maintaining relations #109

Pfeil opened this issue Feb 15, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Pfeil
Copy link
Member

Pfeil commented Feb 15, 2023

Consider an API which makes it more convenient to add relations by providing a triple (a, rel, b), to create a relation rel from a to b.

Consider the following options:

  • adding relation
  • overriding (remove all and add) relations
  • removing relation
  • mutual (also add reverse relation if possible)

If profile is given, relation term may be human-readable instead of pid.

Implications:

  • non-breaking change (minor version update)
  • this will make scripts/tooling much easier and avoid errors on the clients side

Bonus thought: we could also request single attributes/relations, would this ease things in practice?

@Pfeil Pfeil added the enhancement New feature or request label Feb 15, 2023
@Pfeil Pfeil added this to the 2.1.0 milestone Jun 28, 2023
@Pfeil Pfeil modified the milestones: 2.1.0, 2.5.0 Nov 15, 2023
@Pfeil
Copy link
Member Author

Pfeil commented Oct 1, 2024

Alternative idea (both could be implemented, but they serve the same purpose):

Allow creating not only a single PID, but multiple ones which may refer to each other. Input would be an array of records.

References could look like one of these approaches:

  • indexing into the input array like "my-pid-reference": "input[0]" or similar
  • reference names: The pid records do have an optional PID field which is used for returning JSON and for the (optional, non-default, and not recommended) case where a suffix may be provided. We could use this suffix as a reference

@Pfeil Pfeil self-assigned this Oct 1, 2024
@maximiliani
Copy link
Member

In pull request #247, I implemented an endpoint which allows creating interconnected PID records. During this process, I was thinking what could be additional steps towards a “Relationship Management API”. Due to time constraints and a lack of current use case for this feature, I am posting some features I identified as possibly useful here:

  • create POST /api/v1/pit/relationship endpoint for creating new relationships

    • add unidirectional relationships between two single FAIR-DOs with one key
    • add unidirectional relationships between one start and a list of target FAIR-DOs with one key
    • add multiple unidirectional relationships between one start and 1..n target FAIR-DOs with each one key
    • add bidirectional relationships between two single relationships and optionally different keys for each direction
    • add bidirectional relationships between one start and a list of target FAIR-DO with optionally different keys for each direction
    • add multiple bidirectional relationships between one start and 1..n target FAIR-DOs
  • create PUT /api/v1/pit/relationship endpoint for overwriting relationships

    • bidirectionally remove all relationships to/from this FAIR-DO
    • unidirectionally remove all relationships from this FAIR-DO
    • redirect creation of new relationships to POST endpoint
  • create PATCH /api/v1/pit/relationship endpoint for overwriting single relationships

    • remove all outgoing relationships for a specific key
    • remove all incoming relationships for a specific key
    • redirect creation of new relationships to POST endpoint
  • create DELETE /api/v1/pit/relationship endpoint for removing relationships

    • unidirectional removal for single selected outgoing relationship
    • unidirectional removal for all outgoing relationships of a single FAIR-DO
    • unidirectional removal for single selected incoming relationship
    • unidirectional removal for all incoming relationships of a single FAIR-DO
    • bidirectional removal of multiple selected relationships for a single FAIR-DO (parameters: direction, key)
    • bidirectional removal of all relationships for a single FAIR-DO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants