Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement merging of partnered schemas #145

Closed
happy5214 opened this issue Mar 29, 2024 · 0 comments · Fixed by #147
Closed

Implement merging of partnered schemas #145

happy5214 opened this issue Mar 29, 2024 · 0 comments · Fixed by #147
Assignees
Labels
bids BIDS integration enhancement New feature or request hed 3 HED 3-specific issues important Important issues schema Schema parsing
Milestone

Comments

@happy5214
Copy link
Member

Partnered schemas were introduced in HED standard schema version 8.2.0. Currently, hed-javascript has basic support for using partnered schemas separately from each other, with different prefixes for each schema. Now, we require support for so-called "lazy partnered schema" merging, where compatible partnered schemas with the same prefix may be merged into a single schema.

Partnered schemas are compatible (in this version) if:

  • They have the same withStandard XML attribute (referencing the same standard schema version; merging this standard schema version shall be a no-op).
  • Their list of tags with the inLibrary schema attribute have no overlap.

A sketch for merging partnered schemas A and B (assuming they are both partnered to a standard schema we're calling S:

  1. Parse A and B as normal. Failures here end the process.
  2. Verify that A and B are both actually partnered to the same standard schema (S in this case). Error out if they differ.
  3. For the following steps, assume we're merging B into A (tags only for now). Iterate through B's tags.
    1. If the tag does not have an inLibrary schema attribute, skip the tag. (It is already in the standard schema S.)
    2. If B's short tag name is already in A, error out (error message: "Library A and Library B are incompatible and a prefix must be given for one or the other."). This includes short tags that resolve to the same full path.
    3. Otherwise, add the tag from B to A at the position indicated by the rooted schema attribute (if the attribute is not present, place it at the top level).
@happy5214 happy5214 added enhancement New feature or request bids BIDS integration hed 3 HED 3-specific issues schema Schema parsing important Important issues labels Mar 29, 2024
@happy5214 happy5214 added this to the 3.14.0 milestone Mar 29, 2024
@happy5214 happy5214 self-assigned this Mar 29, 2024
@happy5214 happy5214 linked a pull request Apr 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bids BIDS integration enhancement New feature or request hed 3 HED 3-specific issues important Important issues schema Schema parsing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant