Skip to content

Commit d0841cc

Browse files
committed
Specify the production/consumption of ontologized properties (#13)
1 parent b7e014d commit d0841cc

File tree

1 file changed

+99
-2
lines changed

1 file changed

+99
-2
lines changed

docs/dcp2_system_design.rst

+99-2
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ descriptors, one for metadata files and one for subgraphs.
753753
of one entity to coexist in a non-delta staging area. A delta staging area,
754754
on the other hand, must contain at most one object with a given
755755
``entity_id``, and therefore only one version of that entity.
756-
756+
757757

758758
The ``.remove`` suffix is used to request the removal of an entity. It can
759759
only be used in staging areas that have the ``is_delta`` property set to
@@ -1154,7 +1154,7 @@ staging areas may contain updates is for backwards compatibility: The DCP
11541154
already utilized this functionality before this section of the specification was
11551155
written. |ne|
11561156

1157-
|nn| It may be tempting to reuse an existing staging area after it has been
1157+
|nn| It may be tempting to reuse an existing staging area after it has been
11581158
imported so as to avoid having to repopulate a completely new staging area for
11591159
the next import. For non-delta staging areas this can be a good strategy. For
11601160
delta staging areas it usually isn't because delta staging areas can only
@@ -1463,6 +1463,103 @@ row and finally soft-deleting any unmarked rows. |ne|
14631463

14641464

14651465

1466+
Ontologies
1467+
==========
1468+
1469+
The `HCA Metadata Schema`_ designates certain document properties as
1470+
ontologized. An *ontologized property* (OP) contains a JSON object referencing a
1471+
term in an ontology that is hosted externally, outside of the DCP/2. The shape
1472+
of that JSON object is specified by one of the `ontology modules`_ of the `HCA
1473+
Metadata Schema`_. All such modules specify at least the following three child
1474+
properties:
1475+
1476+
``ontology``
1477+
optional; the stable and unique identifier of an ontology term
1478+
1479+
``ontology_label``
1480+
optional; a human readable description of the term refered to by the
1481+
``ontology`` child property
1482+
1483+
``text``
1484+
required; a human readable description to fall back on should no term exist
1485+
1486+
.. _ontology modules: https://github.com/HumanCellAtlas/metadata-schema/tree/master/json_schema/module/ontology
1487+
1488+
1489+
Rules for producers
1490+
-------------------
1491+
1492+
When setting an OP in a metadata document, producers of metadata should
1493+
select the most specific ontology term currently available that best describes
1494+
the experimental facts and satisfies the requirements of the ontology module
1495+
governing the the OP.
1496+
1497+
A) If a sufficiently specific match is found, the producer
1498+
1499+
- sets the ``ontology`` child property of OP to the identifier of the
1500+
selected term and
1501+
1502+
- sets the ``ontology_label`` and ``text`` child properties to the label
1503+
of the selected term.
1504+
1505+
The label of an ontology term can change over time. The producer must keep
1506+
the ``ontology_label`` and ``text`` child properties up to date whenever the
1507+
document is updated. There is no requirement to update the document whenever
1508+
the label changes.
1509+
1510+
B) If no sufficiently specific term exists, but a more general one does, the
1511+
producer
1512+
1513+
- sets the ``ontology`` child property of OP to the identifier of the more
1514+
general term,
1515+
1516+
- sets the ``ontology_label`` child property to the label of that term and
1517+
1518+
- sets the ``text`` child property of the OP to what they expect the label
1519+
of a hypothetical exact match would be.
1520+
1521+
The producer initiates the process of adding that expected term to the
1522+
ontology. After that term has been added, the producer updates the
1523+
document as described under A).
1524+
1525+
C) Otherwise, the producer
1526+
1527+
- omits the ``ontology`` and ``ontology_label`` child properties of the OP
1528+
and
1529+
1530+
- sets the ``text`` child property of the OP to what they expect the
1531+
label of a hypothetical term would be if it existed.
1532+
1533+
The producer initiates the process of adding that expected term to the
1534+
ontology. After that term has been added, the producer updates the
1535+
document as described under A).
1536+
1537+
1538+
Rules for consumers
1539+
-------------------
1540+
1541+
When reading an ontologized property (OP) in a metadata document, consumers of
1542+
metadata should read the ``ontology`` child property of the OP, if that child
1543+
property is present. If a description of the term in English (or any other
1544+
language supported by the ontology) is needed, the consumer should look that
1545+
description up in the ontology API referred to by the module governing the OP,
1546+
using the term identifier in the ``ontology`` child property. If a lookup is not
1547+
possible for technical reasons, the producer should read the ``text`` child
1548+
property if present or the ``ontology_label`` otherwise. If both are absent, the
1549+
consumer should raise an error.
1550+
1551+
If the ``ontology`` child property is absent, the consumer instead reads the
1552+
``text`` child property of the OP.
1553+
1554+
|nn| Under the above rules, if an OP was set under scenario B, consumers will
1555+
ignore the hypothetical label. This leads to a more consistent user experience.
1556+
There is no guarantee that different wranglers come up with different
1557+
hypothetical terms and we don't want the UX to suffer in that case, considering
1558+
that there is at least a partial match available. If an OP was set using
1559+
scenario C, the hypothetical term label is the best we have. In both scenarios
1560+
the producer must update the document once the term becomes available, so the
1561+
degraded UX is only temporary. |ne|
1562+
14661563
Project-level matrices
14671564
======================
14681565

0 commit comments

Comments
 (0)