Skip to content

Removing relationship to nonexisting object or removing an unknown relationship always returns success #35

@giulioturetta

Description

@giulioturetta

Use case: removing orphaned relationships pointing to deleted objects.

Calling curl -X POST -u username:password "https://services.phaidra-sandbox.univie.ac.at/api/object/o:19/relationship/remove" -F "predicate=http://phaidra.org/XML/V1.0/relations#isBackSideOf" -F "object=info:fedora/o:999999999"
returns {"alerts":[],"status":200} even if the object in "object" parameter doesn't exist and the relationship do or do not exist in the subject object of the triple.
This seems to be by Fedora design. Fixing it would require to check if the relationship exists in the subject object and client applications would need to handle the possible error. We can keep it as it is by now, without taking any further action on API.

Moreover the API call returns the same also if predicate value is an unknown relationship like "predicate=foo".
Possible solution: checking if the predicate to be removed is known to API in the relationships set https://github.com/phaidra/phaidra-api/wiki/Relations

The same issue might also occur when adding relationships, making it possible to pollute objects with meaningless relationships.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions