Project

General

Profile

Feature #1691

API: Selecting relations to be returned

Added by Andreas Olschnögger 6 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
API
Target version:
Start date:
2022-04-11
Estimated time:

Description

Often not all relations that are returned from the api are needed. When loading many entities this leads to an extreme overhead and also to longer loading times. Therefore it would be great if one could specify which relations one wants to get back.
For example if I want to return all Actors with


https://connec.openatlas.eu/api/0.3/query/?view_classes=actor&limit=100&show=relations

and I only need the relation Types "crm:P11i participated in" and "crm:OA7 has relationship to" a solution like


https://connec.openatlas.eu/api/0.3/query/?view_classes=actor&limit=100&show=relations?relationType=crm:P11i?relationType=crm:0A7

would be a good solution.

Note that this is not a filter option for entities but only limits how much data is returned.

History

#1

Updated by Alexander Watzinger 6 months ago

  • Subject changed from Selecting relations to be returned by the api to API: Selecting relations to be returned
  • Status changed from New to Assigned

Sounds like an interesting challenge and a viable suggested solution which could improve performance for presentation sites a lot.
I leave the technical details to you two but thanks for writing an issue for that.

#2

Updated by Bernhard Koschiček-Krombholz 5 months ago

  • Status changed from Assigned to Resolved
  • Target version set to 7.3.0

Thank you for the issue. It is currently resolved in develop branch.

The parameter is relation_type since we also have this notation with other parameters. Change to camelCase is possible, since API version 0.3 is not officially stable, but we have to change all parameters then (-> breaking changes -> discussion at developer meeting)

Example usage:

/api/0.3/view_class/place?relation_type=P2&relation_type=P67

It is not currently possible to use i for inverse. If it is really necessary, we can talk about it.

With this function, the backend is also a little faster. Now only links with the given property codes together with P53 (for geometry), P2 (for types) and P67 (for external references and depictions), if they called with show, will be requested. Therefore, lesser calls are made.

#3

Updated by Bernhard Koschiček-Krombholz 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF