airr-community / airr-standards

AIRR Community Data Standards
https://docs.airr-community.org
Creative Commons Attribution 4.0 International
35 stars 23 forks source link

consider "linkTo" property for specifying relations #672

Closed schristley closed 5 months ago

schristley commented 1 year ago

I've been working with a fork of the encoded project which uses JSON schema to describes it's objects yet also stores them in an SQL database. They utilize a linkTo property to specify 1-to-1 and 1-to-many relationships among their objects. I initially thought this was part of JSON-LD but I've not really been able to find any description of linkTo in the spec, the best I can find is this description in the encoded paper.

The encodeD system also has a JSON‐LD feature using a special “linkTo” property that allows links between different objects which, combined, are used in the ENCODE data model to represent an experiment or experimental component. Multiple objects can share links to the same object; for example, multiple different experiments could all use the same antibody. JSON‐LD enables some degree of denormalization by permitting objects to be returned embedded with full copies of linked objects rather than the link alone, which in turn allows users with an understanding of the data model to traverse objects and search with a great deal of flexibility.

For example, the biospecimen schema has a linkTo to a patient like this:

        "patient": {
            "title": "Patient",
            "description": "The patient the biospecimen was originated from.",
            "comment": "See patient.json for available identifiers.",
            "type": "string",
            "linkTo": "Patient"
        },

This seems like a simple technique that we could utilize to explicitly describe the relationships in the AIRR Data Model. One criticism I have though is that it doesn't specify the identifier(s) for the linkage.

schristley commented 5 months ago

I haven't seen any followup that suggests this is becoming commonly used, or supported by more tools, etc. We could define our own convention within x-airr or use something like LinkML where you can specify what it points to (the range) and the cardinality of the relation.

Closing as I don't think we should consider this further.