Skip to content

Commit

Permalink
Merge pull request #3 from Lestropie/inheritance_unsetting_corollary
Browse files Browse the repository at this point in the history
Inheritance principle: No unsetting as corollary
  • Loading branch information
Lestropie authored Jan 18, 2022
2 parents 7bc7ad5 + 1141cf7 commit 5475322
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/02-common-principles.md
Original file line number Diff line number Diff line change
Expand Up @@ -563,15 +563,12 @@ for more information.
accessing metadata associated with a data file MUST consider only the
applicable file that is lowest in the filesystem hierarchy.

1. For [JSON files](#key-value-files-dictionaries):

1. Files are loaded from the top of the directory hierarchy downwards,
such that values from the top level are inherited by all data files
at lower levels to which it is applicable unless overridden
by a value for the same key present in another metadata file at a lower level
(though it is RECOMMENDED to minimise the extent of such overrides).

1. There is no notion of "unsetting" a key/value pair.
1. For [JSON files](#key-value-files-dictionaries), key-values are loaded
from files from the top of the directory hierarchy downwards, such that
key-values from the top level are inherited by all data files at lower
levels to which it is applicable unless overridden by a value for the
same key present in another metadata file at a lower level
(though it is RECOMMENDED to minimise the extent of such overrides).

Corollaries:

Expand All @@ -585,6 +582,11 @@ Corollaries:
across multiple data files, it is RECOMMENDED to store metadata in this
way, rather than duplicating that metadata content across multiple metadata files.

1. Where multiple applicable JSON files are loaded as per rule 5.2, key-values can
only be overwritten by files lower in the filesystem hierarchy; the absence of
a key-value in a later file does not imply the "unsetting" of that field
(indeed removal of existing fields is not possible).

Example 1: Demonstration of inheritance principle

{{ MACROS___make_filetree_example(
Expand Down Expand Up @@ -623,10 +625,10 @@ metadata file `task-rest_bold.json` is read; file
entity "`acq-longtr`" that is absent from the image path (rule 2.c). When reading image
`sub-01/func/sub-01_task-rest_acq-longtr_bold.nii.gz`, metadata file
`task-rest_bold.json` at the top level is read first, followed by file
`sub-01/func/sub-01_task-rest_acq-longtr_bold.json` at the bottom level (rule 5.b.i);
`sub-01/func/sub-01_task-rest_acq-longtr_bold.json` at the bottom level (rule 5.b);
the value for field "`RepetitionTime`" is therefore overridden to the value `3000.0`.
The value for field "`EchoTime`" remains applicable to that image, and is not unset by its
absence in the metadata file at the lower level (rule 5.b.ii).
absence in the metadata file at the lower level (rule 5.b; corollary 3).

Example 2: Impermissible use of multiple metadata files at one directory level (rule 4)

Expand Down

0 comments on commit 5475322

Please sign in to comment.