aiidateam / aiida-optimade

OPTIMADE RESTful API implementation for AiiDA
MIT License
6 stars 7 forks source link

references is missing #17

Open CasperWA opened 4 years ago

CasperWA commented 4 years ago

The /references endpoint is missing.

Since references cannot be saved as a base Node in AiiDA databases, I suggest this endpoint utilizes a mongomock database, where the data is put into a JSON file, the path to which can be set in a central config file. Like what is proposed in #14.

ltalirz commented 4 years ago

Since references cannot be saved as a base Node in AiiDA databases

Well, not in Node but in all Data nodes. See https://github.com/aiidateam/aiida-core/blob/develop/aiida/orm/nodes/data/data.py#L33

One just has to actually do it.

CasperWA commented 4 years ago

Since references cannot be saved as a base Node in AiiDA databases

Well, not in Node but in all Data nodes. See https://github.com/aiidateam/aiida-core/blob/develop/aiida/orm/nodes/data/data.py#L33

One just has to actually do it.

Right. I didn't mean that we couldn't create a new Data class for references. It was more the fact that it doesn't exist yet, and will not exist for, e.g., the databases on Material Cloud's Archive, I guess? Or do you think it makes sense to add a ReferenceData node to AiiDA core and later on as an addition to already published archive databases?

Or did I miss something in your link reference?

As a note, I am aware that this repository should be a separate entity, but since it is closely related to exposing the Materials Cloud archive databases at the moment, I think it makes most sense to implement a solution that can work for them.

ltalirz commented 4 years ago

Or did I miss something in your link reference?

Yes, you can attach source attributes to every Data node https://github.com/aiidateam/aiida-core/blob/develop/aiida/orm/nodes/data/data.py#L78 (one just has to actually set them)

We should probably discuss with @giovannipizzi @sphuber what is needed to make them compatible with what is needed in optimade & whether these should be updated/generalized. I think they are used so far only by the "DB importers/exporters".

ltalirz commented 4 years ago

You are right, though, that it may be worth reconsidering the question whether replicating reference information on each node is the way to go.

In the end, however, I guess we are talking about a few hundred bytes per node, which is manageable at the scale of DBs that AiiDA currently supports (~1 million nodes), so introducing some relation between nodes and a ReferenceData node may actually introduce more complication than it saves.