B. HED errors¶
This appendix summarizes the error codes used by HED validators and other tools.
A code marked with a star (*) is a warning. A warning reports something that an annotator or a schema developer should look at; it does not make the annotation or the schema invalid, and a tool MAY let the user suppress warnings. Every other code is an error.
An annotation or a schema that breaks more than one rule may fit more than one reason or more than one code. Which one a validator reports depends on the order of its checks, which this specification does not fix: a validator MAY report any reason or code that fits. The notes under some codes name such pairs; a pair that no note names is allowed too.
HED-compliant tools may assume that if a HED annotation has been properly validated, it will comply with the rules of the HED specification. Annotators and analysts are mainly concerned with HED validation errors relating to incorrectly annotated events. See B.1: HED validation errors for a listing of errors keyed to the HED specification.
HED-compliant tools assume that the HED schemas available on the hed-standard/hed-schemas GitHub repository are error-free, and that schema errors can only occur due to failure to locate or read a HED schema.
HED schema developers are mainly concerned with errors and inconsistencies in the schema itself. Schemas under development should be validated at all stages of development. See B.2: Schema validation errors for a listing of errors keyed to the HED specification. Rules that a validator applies differently to an earlier schema version are listed in B.3. Differences for earlier schema versions.
B.1. HED validation errors¶
CHARACTER_INVALID¶
a. A HED string cannot contain the following characters:
Character code <= 31 (hex 0x1f).
127 (hex 0x7f) <= character code <= 159 (hex 0x9f).
Left or right square brackets (
[,]).Tilde (
~) character. Replace: the syntax (A~B~C) with (A, (B,C)).Double quotes (
").
b. Curly braces ({, }) appear in a HED string that is not a sidecar annotation, such as a cell in the HED column of a table. Curly braces indicate a column reference in a sidecar and are not HED.
c. Curly braces ({, }) in a sidecar annotation appear as part of another tag, such as the value that replaces its placeholder (Label/{b}); see also SIDECAR_BRACES_INVALID (d).
Notes:
Different parts of a HED string have different rules for acceptable characters. For example tag names MUST satisfy the rules for the HED name class. The values used after tag names depend on the value classes of the tag and the unit classes of the tag.
A textClass value containing a parenthesis, number sign, or tilde is CHARACTER_INVALID under the value class. For earlier schema versions see B.3. Differences for earlier schema versions.
The character sets named here and in 2.2 Character sets and restrictions are published as
character_sets.json. A validator reporting this error names the character, its position, and the set it failed.
See also:
A.1. Auxiliary and extra schema sections for a discussion of the HED name and unit class rules.
2.2 Character sets and restrictions for a discussion of the restrictions on characters.
3.2.4. Tags that take values and 3.2.5. Tag extensions for an explanation of the rules for tag values and extensions.
COMMA_MISSING¶
HED tag groups and tags MUST be separated with commas. In the following A, B, C, and D represent HED expressions.
a. Two tag groups are not separated by commas: (A, B)(C, D).
b. A tag and a tag group are not separated by commas: A(B,D).
Note: Commas missing between two HED tags are generally detected as invalid HED tags, rather than as missing commas.
See 3.2.7.3. Empty tags and groups for an explanation of the rules for empty tags.
See also TAG_EMPTY.
DEF_EXPAND_INVALID¶
a. A Def-expand tag’s name does not correspond to a definition.
b. A Def-expand is missing an expected placeholder value or has an unexpected placeholder value.
c. A Def-expand has a placeholder value of incorrect format or units for definition.
d. The tags within a Def-expand do not match the corresponding definition.
e. A Def-expand tag group of a definition that has contents is missing its inner tag group.
f. A Def-expand tag group has extra tags or groups.
See 3.2.8.2. Def and Def-expand tags for an explanation of the rules for Def-expand and 5.2. Using definitions for more details and examples.
DEF_INVALID¶
a. A Def tag’s name does not correspond to a definition.
b. A Def tag is missing an expected placeholder value or has an unexpected placeholder value.
c. A Def has a placeholder value of incorrect format or units for definition.
See 3.2.8.2. Def and Def-expand tags for an explanation of the rules for Def and 5.2. Using definitions for more details and examples.
DEFINITION_INVALID¶
The form of a definition is stated in 3.2.8.1. The Definition tag.
a. A Definition tag does not appear in a tag group at the top level in an annotation.
b. No longer used: an empty inner group in a definition is TAG_EMPTY (c).
c. A definition’s enclosing tag group contains more than a Definition tag and an inner group.
d. A definition’s contents contain, at any level, a structural reserved tag (Definition, Def, Def-expand, Onset, Offset, Inset, Delay, Duration, Event-context).
e. A definition uses curly braces.
f. A definition that includes a placeholder (#) does not have exactly two # characters.
g. A definition has placeholders (#) in incorrect positions.
h. Definitions of the same name appear with and without a #.
i. Two definitions with the same name have different contents. Identical definitions of one name (the same placeholder form and the same contents in any order, under the case rule of 3.2.3. Tag case-sensitivity) are allowed and treated as one definition.
j. A tag with the unique attribute appears in a definition.
k. A definition appears in an unexpected place, such as the HED column of a table, a categorical or value entry of a sidecar, a dummy entry whose dictionary also holds annotations that are not definitions, or an annotation that holds anything other than definition groups (Red, (Definition/MyDef)). A Definition tag that is not in a top-level group (((Definition/MyDef))) is reason a, not k.
l. The value of a Definition tag has a part after the name other than a single # (Definition/MyDef/3, Definition/MyDef/#/#).
See 3.2.8.1. The Definition tag for an explanation of the rules for definitions. See also 5.1. Creating definitions and 5.2. Using definitions for more details and examples of definition syntax.
ELEMENT_DEPRECATED*¶
(WARNING)
A schema element has been deprecated and SHOULD NOT be used. When an element is updated, its description is updated to include the reason for deprecation and a suggested path for updating usage.
a. A tag has been deprecated and an alternative method of tagging SHOULD be used. See tag description for how to replace.
b. A unit or unit modifier has been deprecated and an alternative SHOULD be used.
See 3.2. Annotation rules for the rule and A.1.4.5. deprecatedFrom for additional information about the deprecatedFrom schema attribute.
ONSETS_UNORDERED*¶
(WARNING)
a. The rows of a timeline table are not in time order: the time of a row is earlier than the time of a row above it. Rows whose onset value is n/a are not considered. The warning is reported once for the table.
See 3.2.10.4. Table-level processing for the rule.
PARENTHESES_MISMATCH¶
a. A HED string does not have the same number of open and closed parentheses.
b. The open and closed parentheses are not correctly nested in the HED string.
See 3.2.7.1. Parentheses and order for the rules for parentheses in HED.
PLACEHOLDER_INVALID¶
a. A # appears in a place where it is not allowed (such as in the HED column of a table).
b. A JSON sidecar has a placeholder (#) in the HED dictionary for a categorical column.
c. A JSON sidecar does not have exactly one placeholder (#) in each HED string representing a value column.
d. A placeholder (#) is used in JSON sidecar or definition, but its parent in the schema does not have a placeholder child, or its parent is a user extension (Item/Blech/#).
e. Multiple placeholders (#) appear in a HED string (e.g., "Label/#, Parameter-value/#").
f. A placeholder (#) is not the whole value of its tag, or of the second part of a Definition, Def or Def-expand value (e.g., "Label/x#", "Label/#x", "Def/MyDef/x#").
Notes: Onset/# (see 3.2.5. Tag extensions) fits PLACEHOLDER_INVALID (reason a or d) and TAG_EXTENSION_INVALID (reason c). Units after the placeholder ("Frequency/# Hz") are not part of its value. A validator may report a # with other characters in the value (reason f) as VALUE_INVALID or CHARACTER_INVALID instead, depending on which check finds it first.
See 3.2.4. Tags that take values and 3.2.9.1. Sidecar entries for information on the use of placeholders in HED.
REQUIRED_TAG_MISSING¶
a. An event-level annotation does not have a tag corresponding to a node with the required schema attribute. Only standard schemas < 8.3.0 and the unpartnered library schema SCORE 1.0.0 define this attribute; see B.3. Differences for earlier schema versions.
SCHEMA_LOAD_FAILED¶
a. Different standard schema partner versions in a merge group.
b. Schema elements (tag, unit class, unit, unit modifier, or value class) or schema attributes of two library schemas in the same merge group have the same name but have conflicting attributes, description, parents, or placeholder (#) children.
c. The same schema (a library schema with the same library name, or the standard schema) is listed more than once in a merge group, in the same or in different versions.
d. A schema with a specified name and version cannot be found.
e. Rows of the Sources, Prefixes, or External annotations section of two library schemas in the same merge group have the same key but different contents.
f. A schema file cannot be parsed in its format, and no code of B.2.2. MediaWiki format errors or B.2.3. XML format errors applies. No code is specific to the JSON or TSV format.
g. A version specification names a standard schema version earlier than 8.0.0 (see 3.1.1. Schema versions).
h. A namespace name in a version specification is not made of ASCII letters only (see 3.1.1. Schema versions).
Note: Depending on the validator, a missing file or a file that cannot be parsed may be reported through a file error exception (e.g., a HedFileError exception in the Python tools) rather than as SCHEMA_LOAD_FAILED.
Note: Partnered library schemas never define schema properties: the Properties section of an unmerged partnered library schema is empty and that of a merged partnered library schema is the Properties section of its standard schema partner, so conflicts with the standard partner are detected when the schema itself is validated. See reason j and k of SCHEMA_LIBRARY_INVALID.
A version specification that violates any rule of the rule table in 3.1.2.4. Partnered combinations is this error, including an unpartnered library schema that shares its namespace with another schema.
See 3.1.2.4. Partnered combinations for the rule table and 7.3.6. Lazy partnering for a description of the merging process.
SIDECAR_BRACES_INVALID¶
a. A name appearing in curly braces in a sidecar HED annotation is not the word HED or the name of a HED-annotated column in the sidecar.
b. A column name entry in a sidecar has a HED annotation with curly braces, but this name also appears in curly braces in another HED annotation.
c. The curly braces in a sidecar are nested or unmatched.
d. Curly braces appear as part of another tag, such as the value that replaces its placeholder (Label/{b}); see also CHARACTER_INVALID (c).
See 3.2.9. Sidecars for information on the requirements for using sidecars.
SIDECAR_INVALID¶
a. The "HED" key is not a second-level dictionary key.
b. An annotation entry is provided for n/a.
c. No longer used: a sidecar that refers in curly braces to a column with no HED is SIDECAR_BRACES_INVALID (a).
d. A top-level sidecar key begins or ends with whitespace (blank, tab, line feed, or carriage return), whether or not its entry has a "HED" key.
e. In a categorical entry, a column value listed as a key under "HED" begins or ends with whitespace (blank, tab, line feed, or carriage return), such as "go " in {"trial": {"HED": {"go ": "Sensory-event"}}}.
f. An annotation in a categorical entry is empty or consists only of blanks. A column value that has no HED annotation is given the annotation n/a.
See 3.2.9. Sidecars for a general explanation of sidecar requirements.
SIDECAR_KEY_MISSING*¶
(WARNING)
a. A value in a categorical column does not have an expected entry in a sidecar.
b. A {ref} in a sidecar does not correspond to a column in the associated table.
Note: This warning is only triggered if the categorical column in which the value appears does have HED annotations.
See 3.2.9. Sidecars for a general explanation of sidecar requirements.
TABULAR_INVALID¶
a. A column name appears more than once in the first line (the column names) of a tabular file.
b. A column name in the first line of a tabular file begins or ends with whitespace (blank, tab, line feed, or carriage return).
c. A column name in the first line of a tabular file is blank (the empty string).
d. A value in a column with categorical or value HED annotations begins or ends with whitespace (blank, tab, line feed, or carriage return).
e. A line other than the first of a tabular file is empty (has no characters before its line terminator).
f. A line other than the first of a tabular file has a different number of tab-separated cells than the first line.
For (a) the error names each repeated column, and the repeated columns are not renamed, merged, or dropped: assembling the row annotations of such a file would combine the annotations of the repeated columns into one row and report the result as TAG_EXPRESSION_REPEATED, or lose one of them. For (b) the error is reported once for each column name with leading or trailing whitespace. For (c) the error is reported once for each blank name, by its column position.
For (d) the error is reported once for each distinct value with leading or trailing whitespace in each such column, at the first row that holds it. A value such as go in a column whose annotation has the key go also fits SIDECAR_KEY_MISSING (a).
For (e) and (f) every offending line is reported, by its line number in the file, counting from 1 with the column-name line as line 1. For (f) the error also gives the number of tab-separated cells in the line and the number expected (the number of cells in the first line). BIDS also requires reasons (e) and (f) (BIDS TSV_EMPTY_LINE and TSV_EQUAL_ROWS).
See 3.2.10. Tabular files and structures for the requirements on tabular files.
TAG_EMPTY¶
a. A HED string has extra commas or parentheses separated by only white space, indicating empty tags.
b. A HED string begins or ends with a comma (ignoring white space), indicating an empty string.
c. A tag group is empty (i.e., empty parentheses are not allowed).
Note: Some of these errors MAY instead be reported as COMMA_MISSING.
See 3.2.7.3. Empty tags and groups for the rules on empty tags and groups.
TAG_EXPRESSION_REPEATED¶
a. A tag is repeated in the same tag group or level.
Suppose A, B, and C represent HED expressions. HED strings are not ordered, so (B, C) is equivalent to (C, B). Thus, (A, (A, B)) is not a duplicate, but (A, (B, C), A) and (A, (B, C), (C, B)) are duplicates.
Note: In a table, a repetition can also come from the assembly of a row’s annotation rather than from any single annotation, for example two columns whose annotations contain the same tag. In a sidecar, a repetition can also come from a substitution of a curly-brace reference, including the removal of a reference whose column is n/a or blank, so (Red, {HED}), (Red) is this error (rule 10 of 3.2.9.3. Sidecar curly braces). A column name that appears twice in the first line of the file is TABULAR_INVALID, not this error.
See 3.2.7.4. Repeated expressions for additional information on the rules for duplication.
TAG_EXTENDED*¶
(WARNING)
a. A tag represents an extension from the schema.
Note: Often such extensions are really spelling errors and not meant to extend the schema.
Note: Annotators are discouraged from extending the schema unless absolutely necessary. If an extension tag is needed, annotators should consider posting an issue explaining the tag extension so that an addition to the respective schema might be considered.
See 3.2.5 Tag extensions for additional information on the tag extension rules.
TAG_EXTENSION_INVALID¶
a. A tag extension term is already in the schema.
b. A tag extension term does not comply with rules for schema nodes, or contains no letter (Item/Blech/3).
c. A tag has extension, but an extension is not allowed. This includes an extension of a reserved tag (Onset/Blah), although reserved tags inherit extensionAllowed; a # after a reserved tag that takes no value (Onset/#) may be reported here or as PLACEHOLDER_INVALID; see 3.2.5 Tag extensions.
See 3.2.5 Tag extensions for additional information on the tag extension rules.
TAG_GROUP_ERROR¶
a. A tag has tagGroup or topLevelTagGroup attribute, but is not enclosed in parentheses.
b. A tag with the topLevelTagGroup does not appear at a HED tag group at the top level in an assembled HED annotation.
c. Multiple tags with the topLevelTagGroup attribute, including inherited, appear in the same top-level tag group ((A, A/B) where A has the attribute).
d. An Event-context group contains a tag other than Event-context that is not inside a tag group.
e. An Event-context group contains a curly brace column reference ({column}).
Note: For the structural reserved tags of 3.2.8. Reserved tags, a violation of a group rule is reported with the tag’s own code (DEFINITION_INVALID, TEMPORAL_TAG_ERROR). A tag that is not in a group (a), not in a top-level group (b), or in a group with a tag not allowed beside it (c) MAY instead be reported as TAG_GROUP_ERROR. For example, (Onset, Def/MyDef, Red) MAY be reported as TAG_GROUP_ERROR.
See 3.2.7.2. Tag group attributes for additional information on the rules for group errors due to schema attributes.
See also: TEMPORAL_TAG_ERROR for errors involving Onset, Offset, Inset, Duration and Delay.
TAG_INVALID¶
a. The tag is not valid in the schema it is associated with.
b. The tag has extra internal whitespace, including directly before or after a forward slash of the tag path or the slash that begins a value (Event/ Sensory-event, Label/ abc, Label/ #); see 3.2.2. Tag forms. Blanks inside a value, after its first character, including blanks next to a slash inside the value (Description/left / right), are judged by the rules for the value (VALUE_INVALID, CHARACTER_INVALID), not by this reason.
c. The tag has a leading, trailing, or consecutive forward slashes.
d. A tag or tag extension contains a non name character.
See 3.2.2. Tag forms for a discussion of tag forms and their relationship to the HED schema.
TAG_NAMESPACE_PREFIX_INVALID¶
a. A namespace prefix has invalid characters.
b. A tag has a namespace prefix that is not defined: no schema in the HED version specification is associated with that namespace.
See 3.2.6. Tag namespace prefixes and 7. Library schema for additional information on using multiple schemas in annotation.
TAG_NOT_UNIQUE¶
a. A tag with the unique attribute and its descendants together appear more than once in an event-level HED string (A, A or A, A/B where A has the attribute).
See 3.2.10.3. Event-level processing for additional information on the unique tag.
TAG_REQUIRES_CHILD¶
a. A tag has the requireChild schema attribute but does not have a child.
b. A structural reserved tag whose requireValue is true in reserved_tags.json (see 3.2.8. Reserved tags) has no value.
See A.1.4.11. requireChild for an explanation of the requireChild attribute.
TEMPORAL_TAG_ERROR¶
a. An Offset, Onset, Inset, Duration, or Delay tag does not appear in a tag group.
b. An Offset, Onset, Inset, Duration, or Delay tag appears in a nested tag group (not a top-level tag group).
c. An Onset, Offset or Inset tag is not grouped with exactly one Def tag or Def-expand group.
d. An Onset, Inset, or Offset group contains too many inner tag groups (more than the Max groups of 3.2.8. Reserved tags).
e. An Offset group contains top-level tags besides its anchor and an optional Delay tag.
f. An Offset tag appears before an Onset tag associated with the same definition.
g. An Offset tag associated with a given definition appears after a previous Offset tag without the appearance of an intervening Onset of the same name.
h. An Onset or an Inset tag group has tags besides the anchor Def tag or Def-expand group and an optional Delay tag that are not in a tag group.
i. An Onset, Offset, or Inset group occurs at the same time as another Onset, Offset, or Inset group with the same anchor.
j. An Inset tag is not grouped with a Def tag or a Def-expand group corresponding to an ongoing Onset.
k. An Onset, Inset, Offset, or Delay tag appears in an annotation for a table without an onset or equivalent column.
l. A Duration or Delay tag group contains extra tags or groups, or is missing the required group. A Delay group that does not contain Onset, Offset, or Inset MUST have exactly one inner group, so (Delay/2 s) alone is an error.
m. More than one of the tags Onset, Offset, Inset, Duration, and Delay appears in the same group ((Def/X, Onset, Offset), (Duration/3 s, Onset, (Red))), except that one Delay MAY be paired with one Duration, Onset, Offset, or Inset.
n. In a timeline table (a table with an onset or equivalent column), a Duration or Delay tag has a value that cannot be converted to the default units of its unit class (non-numeric value, invalid units, or units with no conversionFactor, such as month or year), so the delayed onset (Delay) or the end time (Duration) cannot be placed on the table’s timeline. For earlier schema versions see B.3. Differences for earlier schema versions.
o. An Onset, Offset, Inset, or Delay tag appears in a row of a timeline table whose onset value is n/a. A Duration tag MAY appear in such a row.
See also: TAG_GROUP_ERROR.
See 3.2.8.3 Onset, Offset, and Inset for a specification of the required behavior of the Onset, Offset, and Inset tags.
5.3.1. Using Onset and Offset in Chapter 5 gives examples of usage and additional details.
UNITS_INVALID¶
a. A tag has a value with units that are invalid or not of the correct unit class for the tag.
b. A unit modifier is applied to units that are not SI units.
c. A component of a compound unit (m-per-s, m^3) is not a schema unit symbol, differs in case from it, or carries more than one SI unit modifier (kmm-per-s, m-per-sec, m-per-S).
See 3.2.4 Tags that take values for more information.
VALUE_INVALID¶
a. A tag value is incompatible with the specified value class.
b. A tag value with no value class is assumed to be textClass and contains invalid characters.
c. The units are not separated from the value by a single blank. More than one blank (Duration/3 ms) MAY instead be reported as UNITS_INVALID.
d. A value in a table column annotated by a sidecar value entry is invalid (see 3.2.10.2. Table annotations). Depending on the order of validation, such a value MAY instead be reported as UNITS_INVALID or CHARACTER_INVALID.
See 3.2.4. Tags that take values for more information.
B.2. Schema validation errors¶
This section is organized by the type of schema format that results in the error. Errors that might be detected regardless of the schema format start with SCHEMA_. Errors that are specific to the .mediawiki format start with WIKI_. Errors that occur in the construction of the XML version or that are detected by XML validators when the planned XSD validation is implemented start with XML_.
B.2.1. General validation errors¶
SCHEMA_ANNOTATION_INVALID*¶
(WARNING)
a. The property of an annotation value (the prefix:id before the blank) has a prefix that is not a row of the Prefixes section.
b. The prefix:id of an annotation value is not a row of the External annotations section. A bare external term such as glotto:afro1255 falls here; write skos:exactMatch glotto:afro1255.
c. A dc:source value names no row of the Sources section: it neither begins with a row’s source name nor contains a URL under a row’s link.
d. The value of a SKOS mapping property (skos:exactMatch, skos:closeMatch) is not in prefix notation (skos:exactMatch C25499, skos:exactMatch https://example.org/C25499), or its prefix is not a row of the Prefixes section.
e. A row of the External annotations section has a prefix that is not a row of the Prefixes section.
The Prefixes, External annotations, and Sources rows of a partnered library’s standard schema count as the library’s own. For earlier schema versions see B.3. Differences for earlier schema versions.
See A.1.4.2. annotation for the form of an annotation value and A.1.6. Schema sources for what a dc:source value must name.
SCHEMA_ATTRIBUTE_INVALID¶
a. An attribute is used in the schema, but is not defined in the schema attribute section.
b. A schema attribute is applied to the incorrect type (e.g., the SIUnit attribute, whose domain is units, appears on a tag).
c. A schema attribute is used in an invalid way.
d. The pseudo unit class anyUnits lists a unit or has defaultUnits.
e. A schema property is used in the schema, but is not defined in the schema properties section.
Attribute |
Invalid Usage Location |
|---|---|
|
|
|
|
|
Used on a non-placeholder(#) node. |
|
Used on a non-placeholder(#) node. |
|
Used on a non-placeholder(#) node. |
Notes:
A
tagor a#placeholder (the nodes of the schema) can have schema attributes that have thetagDomainor theelementDomainproperty or have no domain property.A
unitClasselement can only have schema attributes that have theunitClassDomainor theelementDomainproperty.A
unitModifierelement can only have schema attributes that have theunitModifierDomainor theelementDomainproperty.A
unitelement can only have schema attributes that have theunitDomainor theelementDomainproperty.A
valueClasselement can only have schema attributes that have thevalueClassDomainor theelementDomainproperty.A schema attribute can only have schema attributes that have the
elementDomainproperty.A schema property can only have the
hedIdattribute.
SCHEMA_ATTRIBUTE_VALUE_INVALID¶
a. A non-boolean schema attribute has an invalid value or usage as indicated by the following table.
Attribute |
Invalid Attribute Value |
|---|---|
|
Not a character set name or alias of 2.2, and not a single character. |
|
Not a positive numeric value. |
|
Not a unit, or a derived form of a unit, of this unit class. |
|
|
|
|
|
The value of an inLibrary attribute is for the wrong library. |
|
Not an existing tag. |
|
Not an existing tag. |
|
|
|
Not an existing tag. |
|
Not an existing unit class, more than one, or |
|
Not an existing value class. |
For earlier schema versions, where the valueClass condition in the unitClass row is not checked, see B.3. Differences for earlier schema versions.
SCHEMA_CHARACTER_INVALID¶
a. A non-placeholder schema node contains non-name characters.
b. The name of a schema element other than a tag (unit class, unit, unit modifier, or value class), of a schema attribute, or of a schema property contains a character that is neither a name character nor, for a unit or unit modifier, one that it declares with allowedCharacter.
c. A unit name or unit symbol contains a blank.
d. The prologue or epilogue contains a character other than text, the comma, or newline.
e. The description of a schema element, schema attribute, or schema property contains a character other than text or the comma.
The deprecated unit degree Celsius is the one exception to b and c (see 3.1.4.4. Unit classes and units).
See 2.2 Character sets and restrictions for definitions of the different types of characters.
Note: tag extensions may contain nonascii characters.
SCHEMA_DEPRECATION_ERROR¶
a. The value of deprecatedFrom is not a previously released HED schema version.
b. A deprecated tag is used as a suggestedTag or a relatedTag in a non-deprecated tag.
c. A child tag of a deprecated tag does not have the deprecatedFrom attribute.
d. A deprecated attribute is used on a non-deprecated element.
e. No longer used: a schema property cannot be deprecated.
f. A deprecated unit class has non-deprecated units.
g. A non-deprecated tag names a deprecated unit class or value class.
h. A non-deprecated unit class has a deprecated default unit.
See 3.1.3. Version updates for the rules.
SCHEMA_DUPLICATE_NODE¶
a. A schema node name appears in the schema more than once, compared without regard to case (Red and red are the same name).
b. A unit class lists a unit that is an SI unit modifier applied to another unit of the same class (uV beside V). For earlier schema versions see B.3. Differences for earlier schema versions.
c. A unit string is derived by two unit classes (an SI unit modifier applied to a unit of each, or a plural) and listed by neither, so it would be ambiguous on a placeholder with unitClass=anyUnits. See 3.1.4.4. Unit classes and units.
d. A unit name is listed more than once in the schema, in one unit class or in two, compared exactly as written (volt twice; volt and Volt are different units). See 3.1.4.4. Unit classes and units.
SCHEMA_HEADER_INVALID¶
a. The schema header has invalid characters or format.
b. The schema header has unrecognized attributes.
SCHEMA_HED_ID_INVALID¶
a. A hedId value is not HED_ followed by a 7-digit integer.
b. A hedId value is outside the identifier range of the schema that the HED entity belongs to.
c. Two HED entities of a schema have the same hedId value.
d. A HED entity has a hedId value different from the one it has in the previous released version of the schema.
e. A HED entity has a retired hedId: one listed under retired_ids in library_data.json with a removed_in version that is not later than the version of the schema.
See A.1.4.7. hedId.
SCHEMA_LIBRARY_INVALID¶
Library schema errors are specific to library schema. Library schema may also raise any of the other schema errors.
a. The specified library name is not alphabetic or lowercase.
b. The withStandard attribute is used in a header that does not also have the library attribute.
c. The withStandard attribute value does not correspond to a valid standard schema version, or names a version earlier than 8.2.0 (see 3.1.2.1. Partnered vs unpartnered).
d. The rooted attribute appears in a schema whose header does not have both the library and withStandard attributes.
e. In an unmerged schema, a node with the rooted attribute is not at the top level; in a merged schema, a node with rooted=XXX is not a direct child of XXX.
f. A node with the rooted attribute does not correspond to a node in its partnered standard schema.
g. A partnered library schema with the unmerged="true" header attribute has an inLibrary attribute on some schema element or schema attribute or in a row of the extra sections.
h. A partnered library schema with the unmerged="true" header attribute has a row of the extra sections (Sources, Prefixes, or External annotations) with the same key as a row of its standard schema partner.
i. A partnered library schema with the unmerged="true" header attribute has a schema element (tag, unit, unit class, unit modifier, or value class) or a schema attribute with the same name as one of its standard schema partner (see 7.4.1. General design rules).
j. A partnered library schema with the unmerged="true" header attribute has a non-empty Properties section.
k. A merged partnered library schema has a Properties section that differs from that of its standard schema partner.
l. A library schema uses the reserved attribute on one of its own elements (in a merged partnered library schema, an element with the inLibrary attribute).
m. A library schema defines, among its own elements (in a merged partnered library schema, those with the inLibrary attribute), a tag whose name is a reserved tag of a standard schema. For an unmerged partnered library schema this is also reason i.
n. A partnered library schema places a node under a reserved tag with the rooted attribute.
SCHEMA_MISSING_EXTRA*¶
(WARNING)
a. A row of the Sources, Prefixes, or External annotations section has an empty value in a required column.
See A.1.6. Schema sources, A.1.7. Schema prefixes, and A.1.8. External annotations for the columns of each section.
SCHEMA_RESERVED_INVALID¶
a. A standard schema does not define a tag that reserved_tags.json names, or defines it without the attributes the rules rely on: reserved and topLevelTagGroup for every row; reserved on Def and Def-expand; and reserved on the ten organizational reserved tags. For earlier schema versions see B.3. Differences for earlier schema versions.
b. A reserved tag has a child node other than #.
See 3.2.8. Reserved tags for the tags and A.6. Reserved tags file for the file.
SCHEMA_SECTION_MISSING¶
a. A required schema section is missing.
b. The schema sections (corresponding to the prologue, schema, unit classes, unit modifiers, value classes, schema attributes, properties, epilogue, sources, prefixes, and external annotations) are not in the correct order and hence not detected.
Note: Whether a schema without the extra sections loads is stated in 3.1.4.10. Sources, prefixes, and external annotations.
SCHEMA_VERSION_INVALID¶
a. The schema version in the HED line or element is invalid.
b. A HED version specification does not have the correct syntax for the schema file format.
c. A HED schema version does not comply with semantic versioning.
B.2.2. MediaWiki format errors¶
WIKI_DELIMITERS_INVALID¶
a. Delimiters used in the wiki are invalid.
b. Schema line content after node name is not enclosed with <nowiki></nowiki> delimiters.
c. A line has unmatched or multiple <nowiki></nowiki>, [ ], or { } delimiters.
d. Attributes section of a node is malformed (e.g., hanging = character).
e. A comma-separated piece of a row of the Sources, Prefixes, or External annotations section that comes before the description pair is not a name=value pair. A comma in a value other than description has this effect.
See A.2.5.7. Schema sources for how a row of these sections is split.
WIKI_LINE_START_INVALID¶
a. Start of body line not ''' or *.
WIKI_SEPARATOR_INVALID¶
a. A malformed section separator is present.
b. A duplicate section separator is present.
B.2.3. XML format errors¶
XML_SYNTAX_INVALID¶
a. The XML is not well formed or does not comply with the specified XSD.
B.2.4. Schema loading errors¶
Schema loading errors can occur because the file is inaccessible or cannot be parsed in its format (MediaWiki, XML, JSON, or TSV); see reason f of SCHEMA_LOAD_FAILED. Schema loading errors are handled in different ways by the Python and JavaScript tools.
Python tools generally raise a HedFileError exception when a failure to load the schema occurs. The calling programs are responsible for deciding how to handle such a failure. The exception carries a code that says what failed. The code is SCHEMA_LOAD_FAILED when the schemas of a version specification cannot be combined; for a file that is missing or cannot be parsed it is a code of the Python tools that is not listed in this appendix.
JavaScript tools in contrast are mainly used for validation of HED annotations in data. These tools are mainly called by the BIDS validator. If a BIDS dataset uses HED, it MUST provide a HED version specification in the dataset_description.json file. If the HED JavaScript validator cannot load a valid HED schema based on this specification it reports a SCHEMA_LOAD_FAILED issue.
B.3. Differences for earlier schema versions¶
The rules of this specification are stated for the latest released standard schema, 8.5.0, and the library schemas partnered with it. This section lists every rule that a validator applies differently to an earlier schema version. A rule not listed here applies unchanged to all schema versions >= 8.0.0.
This paragraph covers the released unpartnered library schema, SCORE 1.0.0; a new unpartnered library schema is not supported (7.4.2. Unpartnered design rules). An unpartnered library schema has no standard schema version, so the entries below are applied to it as follows, whatever its own version. The entries on value class characters, on the required schema attribute, and on the names of the schema properties apply to it as they apply to a standard schema < 8.3.0. The entries on the unit class of a placeholder, on derived units, and on the form of an annotation value do not apply to it: SCHEMA_ATTRIBUTE_VALUE_INVALID (a), SCHEMA_DUPLICATE_NODE (b), and SCHEMA_ANNOTATION_INVALID are reported for an unpartnered library schema as they are for standard schema 8.5.0. The other entries concern reserved tags, which an unpartnered library schema does not have, and TSV files written for earlier standard schemas. SCORE 1.0.0 has the auxiliary sections of standard schema 8.1.0 and no TSV files.
Annotation validation
Standard schemas <
8.3.0: standard schemas mark the reserved tags with thereservedattribute only from8.2.0(the nine structural tags) and8.3.0(all nineteen);8.0.0and8.1.0carry no such attribute. The term reserved tag and the rules of 3.2.8 apply by tag name in every standard schema version, whether or not the schema marks the tag. See Reserved tag and 3.2.8. Reserved tags.Standard schemas <
8.5.0and library schemas partnered with them: theallowedCharacternames a standard value class declares do not define its characters, because these declarations predate the named sets; validators use the defaults recorded for each standard value class in thevalue_class_defaultssection ofcharacter_sets.json(see A.7.3. Names and value class defaults).dateTimeClassallowsdigits,T,hyphen,colon,period,Z, andplus, although these versions declare only the first four.nameClassallowsletters,digits,hyphen, andunderscore, andnonasciifrom standard schema8.3.0, although the released8.3.0and8.4.0rows omit it.textClassvalues use thetextcharacter set, notvalue-text; the8.0.0to8.2.0schemas enumerateletters,digits,blank,+,-,:,;,.,/,(,),?,*,%,$,@(no underscore), and validators have always appliedtextthere and still do. A textClass value containing a parenthesis, number sign, or tilde is therefore not CHARACTER_INVALID under the value class, but the substituted string is still parsed as HED, so tools report the structural error instead (PARENTHESES_MISMATCH, PLACEHOLDER_INVALID, or CHARACTER_INVALID for the tilde). See 2.2 Character sets and restrictions, A.1.3. Value classes, and A.1.4.1. allowedCharacter.Standard schemas <
8.6.0and library schemas partnered with them: the characters ofposixPatharedigits,letters,slash, andcolon; the period, the underscore, and the hyphen are not allowed.Standard schemas <
8.3.0:DelayandDurationdo not carry therequireChildschema attribute (before8.3.0) or thetopLevelTagGroupschema attribute (before8.2.0). TherequireValue,tagGroup, andtopLevelTagGroupfields ofreserved_tags.jsonsupply what these schemas lack, so the rules of 3.2.8 apply to every standard schema version >=8.0.0. ADelayorDurationtag with no value is TAG_REQUIRES_CHILD (b). See 3.2.8. Reserved tags and A.6.2. Tag fields.Standard schema
8.0.0, whosetimeUnitsunits carry noconversionFactor: in a timeline table, aDurationorDelayvalue with no unit, or in the default unit written as its symbolsor as its namesecondorseconds, is taken as is; a value in a modified form (ms) or in any other unit is an error, TEMPORAL_TAG_ERROR (n). See 3.2.8.4. Duration and Delay.Standard schemas <
8.3.0: these schemas define therequiredschema attribute. The assembled annotation of each row MUST include every tag whose schema node has it (REQUIRED_TAG_MISSING), and such a tag MUST NOT appear in the contents of a definition (DEFINITION_INVALID j). No released schema puts the attribute on a tag.
Schema validation
Standard schemas <
8.5.0and library schemas partnered with them: a unit class on a placeholder whose value class is notnumericClass, or that has no value class, is not an error (8.3.0and earlier haveSampling-rate/#with a unit class and no value class), so thevalueClasscondition of theunitClassrow of SCHEMA_ATTRIBUTE_VALUE_INVALID (a) is not checked. See 3.1.4.4. Unit classes and units and A.1.4.22. unitClass.Standard schemas <
8.5.0and library schemas partnered with them: a unit class may list a unit that can be formed by applying an SI unit modifier to another unit of the same class that has theSIUnitattribute; these schemas remain valid (8.3.0and8.4.0listuV), and SCHEMA_DUPLICATE_NODE (b) is not reported. See 3.1.4.4. Unit classes and units.Standard schemas <
8.3.0: the schema properties had other names:boolPropertyforboolRange, andelementProperty,nodeProperty,unitClassProperty,unitModifierProperty,unitProperty, andvalueClassPropertyforelementDomain,tagDomain,unitClassDomain,unitModifierDomain,unitDomain, andvalueClassDomain. No error code applies. See 3.1.4.8. Schema properties and A.1.5. Schema properties for the mapping.Standard schemas <
8.5.0and library schemas partnered with them: anannotationvalue is not required to have the formprefix:id value. Earlier schemas wrote a bare term such asncit:C25499; files partnered with standard schemas before8.5.0keep that form, and tools do not check it, so SCHEMA_ANNOTATION_INVALID is not reported. See A.1.4.2. annotation.Standard schemas <
8.3.0: SCHEMA_RESERVED_INVALID (a) requires less.InsetMUST exist only from8.2.0; thereservedattribute on every row oftagsand onDefandDef-expand, and thetopLevelTagGroupattribute onDelayandDuration, are required only from8.2.0;reservedon the ten organizational reserved tags is required only from8.3.0. See 3.2.8. Reserved tags and A.6. Reserved tags file.
Schema file formats
Standard schemas <
8.5.0and library schemas partnered with them: the TSV files of these schemas were written with other header rows than those of A.5.2. TSV header formats. A tool that reads the TSV format accepts them, and no tool writes them. For standard schema8.4.0and its partnered libraries, theDataProperty,ObjectProperty, andAnnotationPropertyfiles have the columnsomn:Domainandomn:RangeafterType, and theSources,Prefixes, andAnnotationPropertyExternalfiles have noAttributescolumn. For standard schema8.3.0and its partnered libraries, in addition, theTagfile hasrdfs:labelbeforeLeveland ends with anomn:EquivalentTocolumn (followed by anAnnotationscolumn inlang_1.0.0); theUnitfile hashasUnitClassafteromn:SubClassOfand ends withomn:EquivalentTo; theUnitClass,UnitModifier, andValueClassfiles end withomn:EquivalentTo; and the standard schema has noSources,Prefixes, orAnnotationPropertyExternalfiles. Its partnered librarieslang_1.0.0andscore_2.0.0have noSourcesfile either, but they have aPrefixesfile with the columnsprefix,namespace IRI, anddefinition, anAnnotationPropertyExternalfile with the columnsPrefixandID, and aStructurefile that ends withomn:EquivalentTo. Standard schemas <8.3.0have no TSV files. No error code applies.