diff --git a/common/issues/data.js b/common/issues/data.js index 6ed3711c..e8326659 100644 --- a/common/issues/data.js +++ b/common/issues/data.js @@ -154,7 +154,7 @@ const issueData = { genericError: { hedCode: 'HED_GENERIC_ERROR', level: 'error', - message: stringTemplate`Unknown HED error.`, + message: stringTemplate`Unknown HED error "${'internalCode'}".`, }, } diff --git a/common/issues/issues.js b/common/issues/issues.js index caee7593..2beb9be2 100644 --- a/common/issues/issues.js +++ b/common/issues/issues.js @@ -53,6 +53,7 @@ const generateIssue = function (internalCode, parameters) { const issueCodeData = issueData[internalCode] || issueData.genericError const { hedCode, level, message } = issueCodeData const bounds = parameters.bounds || [] + parameters.internalCode = internalCode const parsedMessage = message(...bounds, parameters) return new Issue(internalCode, hedCode, level, parsedMessage) diff --git a/common/schema/types.js b/common/schema/types.js index 0302e542..93a3d340 100644 --- a/common/schema/types.js +++ b/common/schema/types.js @@ -65,6 +65,52 @@ class Schema { get isHed3() { return this.generation === 3 } + + /** + * Determine if a HED tag has a particular attribute in this schema. + * + * @param {string} tag The HED tag to check. + * @param {string} tagAttribute The attribute to check for. + * @return {boolean} Whether this tag has this attribute. + * @abstract + */ + // eslint-disable-next-line no-unused-vars + tagHasAttribute(tag, tagAttribute) {} +} + +class Hed2Schema extends Schema { + /** + * Determine if a HED tag has a particular attribute in this schema. + * + * @param {string} tag The HED tag to check. + * @param {string} tagAttribute The attribute to check for. + * @return {boolean} Whether this tag has this attribute. + */ + tagHasAttribute(tag, tagAttribute) { + return this.attributes.tagHasAttribute(tag, tagAttribute) + } +} + +class Hed3Schema extends Schema { + constructor(xmlData, entries, mapping) { + super(xmlData, null, mapping) + /** + * The collection of schema entries. + * @type {SchemaEntries} + */ + this.entries = entries + } + + /** + * Determine if a HED tag has a particular attribute in this schema. + * + * @param {string} tag The HED tag to check. + * @param {string} tagAttribute The attribute to check for. + * @return {boolean} Whether this tag has this attribute. + */ + tagHasAttribute(tag, tagAttribute) { + return this.entries.tagHasAttribute(tag, tagAttribute) + } } /** @@ -121,5 +167,7 @@ class Schemas { module.exports = { Schema: Schema, + Hed2Schema: Hed2Schema, + Hed3Schema: Hed3Schema, Schemas: Schemas, } diff --git a/converter/__tests__/converter.js b/converter/__tests__/converter.spec.js similarity index 86% rename from converter/__tests__/converter.js rename to converter/__tests__/converter.spec.js index 727fb61b..c7b6b91d 100644 --- a/converter/__tests__/converter.js +++ b/converter/__tests__/converter.spec.js @@ -4,7 +4,7 @@ const schema = require('../schema') const generateIssue = require('../issues') describe('HED string conversion', () => { - const hedSchemaFile = 'tests/data/HED8.0.0-alpha.1.xml' + const hedSchemaFile = 'tests/data/HED8.0.0.xml' let schemaPromise beforeAll(() => { @@ -28,7 +28,7 @@ describe('HED string conversion', () => { testFunction, ) { return schemaPromise.then((schemas) => { - for (const testStringKey in testStrings) { + for (const testStringKey of Object.keys(testStrings)) { const [testResult, issues] = testFunction( schemas, testStrings[testStringKey], @@ -67,16 +67,16 @@ describe('HED string conversion', () => { const testStrings = { singleLevel: 'Event', twoLevel: 'Event/Sensory-event', - fullLong: 'Item/Object/Geometric', - partialShort: 'Object/Geometric', - alreadyShort: 'Geometric', + fullLong: 'Item/Object/Geometric-object', + partialShort: 'Object/Geometric-object', + alreadyShort: 'Geometric-object', } const expectedResults = { singleLevel: 'Event', twoLevel: 'Sensory-event', - fullLong: 'Geometric', - partialShort: 'Geometric', - alreadyShort: 'Geometric', + fullLong: 'Geometric-object', + partialShort: 'Geometric-object', + alreadyShort: 'Geometric-object', } const expectedIssues = { singleLevel: [], @@ -171,18 +171,20 @@ describe('HED string conversion', () => { const testStrings = { validThenInvalid: 'Event/Experiment-control/valid extension followed by invalid/Event', - singleLevel: 'Event/Experiment-control/Geometric', - singleLevelAlreadyShort: 'Experiment-control/Geometric', - twoLevels: 'Event/Experiment-control/Geometric/Event', - duplicate: 'Item/Object/Geometric/Item/Object/Geometric', + singleLevel: 'Event/Experiment-control/Geometric-object', + singleLevelAlreadyShort: 'Experiment-control/Geometric-object', + twoLevels: 'Event/Experiment-control/Geometric-object/Event', + duplicate: + 'Item/Object/Geometric-object/Item/Object/Geometric-object', } const expectedResults = { validThenInvalid: 'Event/Experiment-control/valid extension followed by invalid/Event', - singleLevel: 'Event/Experiment-control/Geometric', - singleLevelAlreadyShort: 'Experiment-control/Geometric', - twoLevels: 'Event/Experiment-control/Geometric/Event', - duplicate: 'Item/Object/Geometric/Item/Object/Geometric', + singleLevel: 'Event/Experiment-control/Geometric-object', + singleLevelAlreadyShort: 'Experiment-control/Geometric-object', + twoLevels: 'Event/Experiment-control/Geometric-object/Event', + duplicate: + 'Item/Object/Geometric-object/Item/Object/Geometric-object', } const expectedIssues = { validThenInvalid: [ @@ -197,16 +199,16 @@ describe('HED string conversion', () => { generateIssue( 'invalidParentNode', testStrings.singleLevel, - { parentTag: 'Item/Object/Geometric' }, - [25, 34], + { parentTag: 'Item/Object/Geometric-object' }, + [25, 41], ), ], singleLevelAlreadyShort: [ generateIssue( 'invalidParentNode', testStrings.singleLevelAlreadyShort, - { parentTag: 'Item/Object/Geometric' }, - [19, 28], + { parentTag: 'Item/Object/Geometric-object' }, + [19, 35], ), ], twoLevels: [ @@ -214,15 +216,15 @@ describe('HED string conversion', () => { 'invalidParentNode', testStrings.twoLevels, { parentTag: 'Event' }, - [35, 40], + [42, 47], ), ], duplicate: [ generateIssue( 'invalidParentNode', testStrings.duplicate, - { parentTag: 'Item/Object/Geometric' }, - [34, 43], + { parentTag: 'Item/Object/Geometric-object' }, + [41, 57], ), ], } @@ -232,17 +234,19 @@ describe('HED string conversion', () => { it('should raise an issue if an invalid node is found', () => { const testStrings = { invalidParentWithExistingGrandchild: - 'InvalidEvent/Experiment-control/Geometric', - invalidChildWithExistingGrandchild: 'Event/InvalidEvent/Geometric', - invalidParentWithExistingChild: 'InvalidEvent/Geometric', + 'InvalidEvent/Experiment-control/Geometric-object', + invalidChildWithExistingGrandchild: + 'Event/InvalidEvent/Geometric-object', + invalidParentWithExistingChild: 'InvalidEvent/Geometric-object', invalidSingle: 'InvalidEvent', invalidWithExtension: 'InvalidEvent/InvalidExtension', } const expectedResults = { invalidParentWithExistingGrandchild: - 'InvalidEvent/Experiment-control/Geometric', - invalidChildWithExistingGrandchild: 'Event/InvalidEvent/Geometric', - invalidParentWithExistingChild: 'InvalidEvent/Geometric', + 'InvalidEvent/Experiment-control/Geometric-object', + invalidChildWithExistingGrandchild: + 'Event/InvalidEvent/Geometric-object', + invalidParentWithExistingChild: 'InvalidEvent/Geometric-object', invalidSingle: 'InvalidEvent', invalidWithExtension: 'InvalidEvent/InvalidExtension', } @@ -251,34 +255,36 @@ describe('HED string conversion', () => { generateIssue( 'invalidParentNode', testStrings.invalidParentWithExistingGrandchild, - { parentTag: 'Item/Object/Geometric' }, - [32, 41], + { parentTag: 'Item/Object/Geometric-object' }, + [32, 48], ), ], invalidChildWithExistingGrandchild: [ generateIssue( 'invalidParentNode', testStrings.invalidChildWithExistingGrandchild, - { parentTag: 'Item/Object/Geometric' }, - [19, 28], + { parentTag: 'Item/Object/Geometric-object' }, + [19, 35], ), ], invalidParentWithExistingChild: [ generateIssue( 'invalidParentNode', testStrings.invalidParentWithExistingChild, - { parentTag: 'Item/Object/Geometric' }, - [13, 22], + { parentTag: 'Item/Object/Geometric-object' }, + [13, 29], ), ], invalidSingle: [ generateIssue('invalidTag', testStrings.invalidSingle, {}, [0, 12]), ], invalidWithExtension: [ - generateIssue('invalidTag', testStrings.invalidWithExtension, {}, [ - 0, - 12, - ]), + generateIssue( + 'invalidTag', + testStrings.invalidWithExtension, + {}, + [0, 12], + ), ], } return validator(testStrings, expectedResults, expectedIssues) @@ -286,9 +292,9 @@ describe('HED string conversion', () => { it('should not validate whether a node actually allows extensions', () => { const testStrings = { - validTakesValue: 'Agent-property/Agent-trait/Age/15', + validTakesValue: 'Property/Agent-property/Agent-trait/Age/15', cascadeExtension: - 'Agent-property/Emotional-state/Awed/Cascade Extension', + 'Property/Agent-property/Agent-state/Agent-emotional-state/Awed/Cascade Extension', invalidExtension: 'Event/Agent-action/Good/Time', } const expectedResults = { @@ -395,16 +401,16 @@ describe('HED string conversion', () => { const testStrings = { singleLevel: 'Event', twoLevel: 'Sensory-event', - alreadyLong: 'Item/Object/Geometric', - partialLong: 'Object/Geometric', - fullShort: 'Geometric', + alreadyLong: 'Item/Object/Geometric-object', + partialLong: 'Object/Geometric-object', + fullShort: 'Geometric-object', } const expectedResults = { singleLevel: 'Event', twoLevel: 'Event/Sensory-event', - alreadyLong: 'Item/Object/Geometric', - partialLong: 'Item/Object/Geometric', - fullShort: 'Item/Object/Geometric', + alreadyLong: 'Item/Object/Geometric-object', + partialLong: 'Item/Object/Geometric-object', + fullShort: 'Item/Object/Geometric-object', } const expectedIssues = { singleLevel: [], @@ -459,18 +465,18 @@ describe('HED string conversion', () => { const testStrings = { validThenInvalid: 'Experiment-control/valid extension followed by invalid/Event', - singleLevel: 'Experiment-control/Geometric', - singleLevelAlreadyLong: 'Event/Experiment-control/Geometric', - twoLevels: 'Experiment-control/Geometric/Event', - partialDuplicate: 'Geometric/Item/Object/Geometric', + singleLevel: 'Experiment-control/Geometric-object', + singleLevelAlreadyLong: 'Event/Experiment-control/Geometric-object', + twoLevels: 'Experiment-control/Geometric-object/Event', + partialDuplicate: 'Geometric-object/Item/Object/Geometric-object', } const expectedResults = { validThenInvalid: 'Experiment-control/valid extension followed by invalid/Event', - singleLevel: 'Experiment-control/Geometric', - singleLevelAlreadyLong: 'Event/Experiment-control/Geometric', - twoLevels: 'Experiment-control/Geometric/Event', - partialDuplicate: 'Geometric/Item/Object/Geometric', + singleLevel: 'Experiment-control/Geometric-object', + singleLevelAlreadyLong: 'Event/Experiment-control/Geometric-object', + twoLevels: 'Experiment-control/Geometric-object/Event', + partialDuplicate: 'Geometric-object/Item/Object/Geometric-object', } const expectedIssues = { validThenInvalid: [ @@ -485,24 +491,24 @@ describe('HED string conversion', () => { generateIssue( 'invalidParentNode', testStrings.singleLevel, - { parentTag: 'Item/Object/Geometric' }, - [19, 28], + { parentTag: 'Item/Object/Geometric-object' }, + [19, 35], ), ], singleLevelAlreadyLong: [ generateIssue( 'invalidParentNode', testStrings.singleLevelAlreadyLong, - { parentTag: 'Item/Object/Geometric' }, - [25, 34], + { parentTag: 'Item/Object/Geometric-object' }, + [25, 41], ), ], twoLevels: [ generateIssue( 'invalidParentNode', testStrings.twoLevels, - { parentTag: 'Item/Object/Geometric' }, - [19, 28], + { parentTag: 'Item/Object/Geometric-object' }, + [19, 35], ), ], partialDuplicate: [ @@ -510,7 +516,7 @@ describe('HED string conversion', () => { 'invalidParentNode', testStrings.partialDuplicate, { parentTag: 'Item' }, - [10, 14], + [17, 21], ), ], } @@ -549,9 +555,9 @@ describe('HED string conversion', () => { invalidExtension: 'Agent-action/Good/Time', } const expectedResults = { - validTakesValue: 'Agent-property/Agent-trait/Age/15', + validTakesValue: 'Property/Agent-property/Agent-trait/Age/15', cascadeExtension: - 'Agent-property/Emotional-state/Awed/Cascade Extension', + 'Property/Agent-property/Agent-state/Agent-emotional-state/Awed/Cascade Extension', invalidExtension: 'Event/Agent-action/Good/Time', } const expectedIssues = { @@ -648,7 +654,7 @@ describe('HED string conversion', () => { testFunction, ) { return schemaPromise.then((schemas) => { - for (const testStringKey in testStrings) { + for (const testStringKey of Object.keys(testStrings)) { const [testResult, issues] = testFunction( schemas, testStrings[testStringKey], @@ -685,19 +691,19 @@ describe('HED string conversion', () => { const testStrings = { singleLevel: 'Event', multiLevel: 'Event/Sensory-event', - twoSingle: 'Event, Attribute', + twoSingle: 'Event, Property', oneExtension: 'Event/Extension', threeMulti: - 'Event/Sensory-event, Item/Object/Man-made-object/Vehicle/Train, Attribute/Sensory/Visual/Color/RGB-color/RGB-red/0.5', + 'Event/Sensory-event, Item/Object/Man-made-object/Vehicle/Train, Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/RGB-color/RGB-red/0.5', simpleGroup: - '(Item/Object/Man-made-object/Vehicle/Train, Attribute/Sensory/Visual/Color/RGB-color/RGB-red/0.5)', + '(Item/Object/Man-made-object/Vehicle/Train, Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/RGB-color/RGB-red/0.5)', groupAndTag: - '(Item/Object/Man-made-object/Vehicle/Train, Attribute/Sensory/Visual/Color/RGB-color/RGB-red/0.5), Item/Object/Man-made-object/Vehicle/Car', + '(Item/Object/Man-made-object/Vehicle/Train, Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/RGB-color/RGB-red/0.5), Item/Object/Man-made-object/Vehicle/Car', } const expectedResults = { singleLevel: 'Event', multiLevel: 'Sensory-event', - twoSingle: 'Event, Attribute', + twoSingle: 'Event, Property', oneExtension: 'Event/Extension', threeMulti: 'Sensory-event, Train, RGB-red/0.5', simpleGroup: '(Train, RGB-red/0.5)', @@ -722,7 +728,7 @@ describe('HED string conversion', () => { single: single, double: double, both: single + ', ' + double, - singleWithTwoValid: 'Attribute, ' + single + ', Event', + singleWithTwoValid: 'Property, ' + single + ', Event', doubleWithValid: double + ', Item/Object/Man-made-object/Vehicle/Car/Minivan', } @@ -730,7 +736,7 @@ describe('HED string conversion', () => { single: single, double: double, both: single + ', ' + double, - singleWithTwoValid: 'Attribute, ' + single + ', Event', + singleWithTwoValid: 'Property, ' + single + ', Event', doubleWithValid: double + ', Car/Minivan', } const expectedIssues = { @@ -741,16 +747,20 @@ describe('HED string conversion', () => { generateIssue('invalidTag', testStrings.both, {}, [14, 26]), ], singleWithTwoValid: [ - generateIssue('invalidTag', testStrings.singleWithTwoValid, {}, [ - 11, - 23, - ]), + generateIssue( + 'invalidTag', + testStrings.singleWithTwoValid, + {}, + [10, 22], + ), ], doubleWithValid: [ - generateIssue('invalidTag', testStrings.doubleWithValid, {}, [ - 0, - 12, - ]), + generateIssue( + 'invalidTag', + testStrings.doubleWithValid, + {}, + [0, 12], + ), ], } return validator(testStrings, expectedResults, expectedIssues) @@ -832,21 +842,21 @@ describe('HED string conversion', () => { it('should replace extra spaces and slashes with single slashes', () => { const testStrings = { twoLevelDoubleSlash: 'Event//Extension', - threeLevelDoubleSlash: 'Item//Object//Geometric', - tripleSlashes: 'Item///Object///Geometric', - mixedSingleAndDoubleSlashes: 'Item///Object/Geometric', + threeLevelDoubleSlash: 'Item//Object//Geometric-object', + tripleSlashes: 'Item///Object///Geometric-object', + mixedSingleAndDoubleSlashes: 'Item///Object/Geometric-object', singleSlashWithSpace: 'Event/ Extension', doubleSlashSurroundingSpace: 'Event/ /Extension', doubleSlashThenSpace: 'Event// Extension', sosPattern: 'Event/// ///Extension', - alternatingSlashSpace: 'Item/ / Object/ / Geometric', + alternatingSlashSpace: 'Item/ / Object/ / Geometric-object', leadingDoubleSlash: '//Event/Extension', trailingDoubleSlash: 'Event/Extension//', leadingDoubleSlashWithSpace: '/ /Event/Extension', trailingDoubleSlashWithSpace: 'Event/Extension/ /', } const expectedEventExtension = 'Event/Extension' - const expectedGeometric = 'Geometric' + const expectedGeometric = 'Geometric-object' const expectedResults = { twoLevelDoubleSlash: expectedEventExtension, threeLevelDoubleSlash: expectedGeometric, @@ -914,7 +924,7 @@ describe('HED string conversion', () => { const testStrings = { singleLevel: 'Event', multiLevel: 'Sensory-event', - twoSingle: 'Event, Attribute', + twoSingle: 'Event, Property', oneExtension: 'Event/Extension', threeMulti: 'Sensory-event, Train, RGB-red/0.5', simpleGroup: '(Train, RGB-red/0.5)', @@ -923,14 +933,14 @@ describe('HED string conversion', () => { const expectedResults = { singleLevel: 'Event', multiLevel: 'Event/Sensory-event', - twoSingle: 'Event, Attribute', + twoSingle: 'Event, Property', oneExtension: 'Event/Extension', threeMulti: - 'Event/Sensory-event, Item/Object/Man-made-object/Vehicle/Train, Attribute/Sensory/Visual/Color/RGB-color/RGB-red/0.5', + 'Event/Sensory-event, Item/Object/Man-made-object/Vehicle/Train, Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/RGB-color/RGB-red/0.5', simpleGroup: - '(Item/Object/Man-made-object/Vehicle/Train, Attribute/Sensory/Visual/Color/RGB-color/RGB-red/0.5)', + '(Item/Object/Man-made-object/Vehicle/Train, Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/RGB-color/RGB-red/0.5)', groupAndTag: - '(Item/Object/Man-made-object/Vehicle/Train, Attribute/Sensory/Visual/Color/RGB-color/RGB-red/0.5), Item/Object/Man-made-object/Vehicle/Car', + '(Item/Object/Man-made-object/Vehicle/Train, Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/RGB-color/RGB-red/0.5), Item/Object/Man-made-object/Vehicle/Car', } const expectedIssues = { singleLevel: [], @@ -951,14 +961,14 @@ describe('HED string conversion', () => { single: single, double: double, both: single + ', ' + double, - singleWithTwoValid: 'Attribute, ' + single + ', Event', + singleWithTwoValid: 'Property, ' + single + ', Event', doubleWithValid: double + ', Car/Minivan', } const expectedResults = { single: single, double: double, both: single + ', ' + double, - singleWithTwoValid: 'Attribute, ' + single + ', Event', + singleWithTwoValid: 'Property, ' + single + ', Event', doubleWithValid: double + ', Item/Object/Man-made-object/Vehicle/Car/Minivan', } @@ -970,16 +980,20 @@ describe('HED string conversion', () => { generateIssue('invalidTag', testStrings.both, {}, [14, 26]), ], singleWithTwoValid: [ - generateIssue('invalidTag', testStrings.singleWithTwoValid, {}, [ - 11, - 23, - ]), + generateIssue( + 'invalidTag', + testStrings.singleWithTwoValid, + {}, + [10, 22], + ), ], doubleWithValid: [ - generateIssue('invalidTag', testStrings.doubleWithValid, {}, [ - 0, - 12, - ]), + generateIssue( + 'invalidTag', + testStrings.doubleWithValid, + {}, + [0, 12], + ), ], } return validator(testStrings, expectedResults, expectedIssues) diff --git a/converter/__tests__/splitHedString.js b/converter/__tests__/splitHedString.spec.js similarity index 94% rename from converter/__tests__/splitHedString.js rename to converter/__tests__/splitHedString.spec.js index 1175b404..ed59dc65 100644 --- a/converter/__tests__/splitHedString.js +++ b/converter/__tests__/splitHedString.spec.js @@ -6,10 +6,10 @@ describe('HED string delimiter splitting', () => { * Validation function. * * @param {Object} testStrings The test strings. - * @param {Object} expectedResults The expected results. + * @param {Object} expectedResults The expected results. */ const validator = function(testStrings, expectedResults) { - for (const testStringKey in testStrings) { + for (const testStringKey of Object.keys(testStrings)) { const testString = testStrings[testStringKey] const testResult = splitHedString(testString) const testResultParts = testResult.map( diff --git a/converter/converter.js b/converter/converter.js index 36af41ab..197a8ace 100644 --- a/converter/converter.js +++ b/converter/converter.js @@ -47,10 +47,31 @@ const convertTagToLong = function (schemas, hedTag, hedString, offset) { * @type {TagEntry} */ let foundTagEntry = null + let takesValueTag = false let endingIndex = 0 let foundUnknownExtension = false let foundEndingIndex = 0 + const generateParentNodeIssue = (tagEntries, startingIndex, endingIndex) => { + return [ + hedTag, + [ + generateIssue( + 'invalidParentNode', + hedString, + { + parentTag: Array.isArray(tagEntries) + ? tagEntries.map((tagEntry) => { + return tagEntry.longTag + }) + : tagEntries.longTag, + }, + [startingIndex + offset, endingIndex + offset], + ), + ], + ] + } + for (const tag of splitTag) { if (endingIndex !== 0) { endingIndex++ @@ -58,75 +79,49 @@ const convertTagToLong = function (schemas, hedTag, hedString, offset) { const startingIndex = endingIndex endingIndex += tag.length - if (!foundUnknownExtension) { - if (!(tag in mapping.mappingData)) { - foundUnknownExtension = true - if (foundTagEntry === null) { - return [ - hedTag, - [ - generateIssue('invalidTag', hedString, {}, [ - startingIndex + offset, - endingIndex + offset, - ]), - ], - ] - } + const tagEntries = asArray(mapping.mappingData.get(tag)) + + if (foundUnknownExtension) { + if (mapping.mappingData.has(tag)) { + return generateParentNodeIssue(tagEntries, startingIndex, endingIndex) + } else { continue } + } + if (!mapping.mappingData.has(tag)) { + if (foundTagEntry === null) { + return [ + hedTag, + [ + generateIssue('invalidTag', hedString, {}, [ + startingIndex + offset, + endingIndex + offset, + ]), + ], + ] + } - const tagEntries = asArray(mapping.mappingData[tag]) - let tagFound = false - for (const tagEntry of tagEntries) { - const tagString = tagEntry.longFormattedTag - const mainHedPortion = cleanedTag.slice(0, endingIndex) + foundUnknownExtension = true + continue + } - if (!tagString.endsWith(mainHedPortion)) { - continue - } + let tagFound = false + for (const tagEntry of tagEntries) { + const tagString = tagEntry.longFormattedTag + const mainHedPortion = cleanedTag.slice(0, endingIndex) + if (tagString.endsWith(mainHedPortion)) { tagFound = true foundEndingIndex = endingIndex foundTagEntry = tagEntry + if (tagEntry.takesValue) { + takesValueTag = true + } break } - if (!tagFound) { - return [ - hedTag, - [ - generateIssue( - 'invalidParentNode', - hedString, - { - parentTag: Array.isArray(mapping.mappingData[tag]) - ? mapping.mappingData[tag].map((tagEntry) => { - return tagEntry.longTag - }) - : mapping.mappingData[tag].longTag, - }, - [startingIndex + offset, endingIndex + offset], - ), - ], - ] - } - } else if (tag in mapping.mappingData) { - return [ - hedTag, - [ - generateIssue( - 'invalidParentNode', - hedString, - { - parentTag: Array.isArray(mapping.mappingData[tag]) - ? mapping.mappingData[tag].map((tagEntry) => { - return tagEntry.longTag - }) - : mapping.mappingData[tag].longTag, - }, - [startingIndex + offset, endingIndex + offset], - ), - ], - ] + } + if (!tagFound && !takesValueTag) { + return generateParentNodeIssue(tagEntries, startingIndex, endingIndex) } } @@ -166,8 +161,8 @@ const convertTagToShort = function (schemas, hedTag, hedString, offset) { let lastFoundIndex = index for (const tag of splitTag) { - if (tag in mapping.mappingData) { - foundTagEntry = mapping.mappingData[tag] + if (mapping.mappingData.has(tag)) { + foundTagEntry = mapping.mappingData.get(tag) lastFoundIndex = index index -= tag.length break diff --git a/converter/schema.js b/converter/schema.js index 25ffb02e..1300a5fb 100644 --- a/converter/schema.js +++ b/converter/schema.js @@ -18,13 +18,15 @@ const Mapping = types.Mapping * @return {Mapping} The mapping object. */ const buildMappingObject = function (xmlData) { - const nodeData = {} + const nodeData = new Map() + const tagElementData = new Map() let hasNoDuplicates = true const rootElement = xmlData.HED setParent(rootElement, null) const tagElements = xpath.find(rootElement, '//node') for (const tagElement of tagElements) { if (getElementTagValue(tagElement) === '#') { + tagElementData.get(tagElement.$parent).takesValue = true continue } const tagPath = getTagPathFromTagElement(tagElement) @@ -33,12 +35,14 @@ const buildMappingObject = function (xmlData) { tagPath.reverse() const longPath = tagPath.join('/') const tagObject = new TagEntry(shortPath, longPath) - if (!(cleanedShortPath in nodeData)) { - nodeData[cleanedShortPath] = tagObject + tagElementData.set(tagElement, tagObject) + if (!nodeData.has(cleanedShortPath)) { + nodeData.set(cleanedShortPath, tagObject) } else { hasNoDuplicates = false - nodeData[cleanedShortPath] = asArray(nodeData[cleanedShortPath]) - nodeData[cleanedShortPath].push(tagObject) + const duplicateArray = asArray(nodeData.get(cleanedShortPath)) + duplicateArray.push(tagObject) + nodeData.set(cleanedShortPath, duplicateArray) } } return new Mapping(nodeData, hasNoDuplicates) diff --git a/converter/types.js b/converter/types.js index eade912e..5ca6bf02 100644 --- a/converter/types.js +++ b/converter/types.js @@ -32,13 +32,13 @@ class TagEntry { class Mapping { /** * Constructor. - * @param {object} mappingData A dictionary mapping forms to TagEntry instances. + * @param {Map} mappingData A dictionary mapping forms to TagEntry instances. * @param {boolean} hasNoDuplicates Whether the mapping has no duplicates. */ constructor(mappingData, hasNoDuplicates) { /** * A dictionary mapping forms to TagEntry instances. - * @type {Object} + * @type {Map} */ this.mappingData = mappingData /** diff --git a/tests/bids.spec.js b/tests/bids.spec.js index c68a906f..e5e1bef7 100644 --- a/tests/bids.spec.js +++ b/tests/bids.spec.js @@ -210,8 +210,8 @@ describe('BIDS datasets', () => { rows: [hedColumnOnlyHeader, ['7', 'something', 'Train/Maglev']], }, { - relativePath: '/sub01/sub01_task-test_run-2_events.tsv', - path: '/sub01/sub01_task-test_run-2_events.tsv', + relativePath: '/sub02/sub02_task-test_run-2_events.tsv', + path: '/sub02/sub02_task-test_run-2_events.tsv', }, ), new BidsEventFile( @@ -578,7 +578,7 @@ describe('BIDS datasets', () => { ], } return validator(testDatasets, expectedIssues, { version: '8.0.0' }) - }) + }, 10000) it('should validate placeholders in BIDS sidecars', () => { const placeholderDatasets = bidsSidecars[2] @@ -624,7 +624,7 @@ describe('BIDS datasets', () => { ], } return validator(testDatasets, expectedIssues, { version: '8.0.0' }) - }) + }, 10000) }) describe('TSV-only datasets', () => { @@ -640,6 +640,12 @@ describe('BIDS datasets', () => { tag: 'Speed/300 miles', unitClassUnits: legalSpeedUnits.sort().join(','), }) + const converterMaglevError = converterGenerateIssue( + 'invalidTag', + 'Maglev', + {}, + [0, 6], + ) const maglevError = generateIssue('invalidTag', { tag: 'Maglev' }) const maglevWarning = generateIssue('extension', { tag: 'Train/Maglev' }) const expectedIssues = { @@ -650,12 +656,13 @@ describe('BIDS datasets', () => { new BidsHedIssue(speedIssue, badDatasets[2].file), new BidsHedIssue(speedIssue, badDatasets[3].file), new BidsHedIssue(maglevError, badDatasets[3].file), + new BidsHedIssue(converterMaglevError, badDatasets[3].file), new BidsHedIssue(speedIssue, badDatasets[4].file), new BidsHedIssue(maglevWarning, badDatasets[4].file), ], } return validator(testDatasets, expectedIssues, { version: '8.0.0' }) - }) + }, 10000) }) describe('Combined datasets', () => { @@ -674,9 +681,18 @@ describe('BIDS datasets', () => { badDatasets[0].file, ), new BidsHedIssue( + converterGenerateIssue('invalidTag', 'Confused', {}, [0, 8]), + badDatasets[0].file, + ), + new BidsHedIssue( + converterGenerateIssue('invalidTag', 'Gray,Confused', {}, [5, 13]), + badDatasets[0].file, + ), + // TODO: Catch warning in sidecar validation + /* new BidsHedIssue( generateIssue('extension', { tag: 'Train/Maglev' }), badDatasets[1].file, - ), + ), */ new BidsHedIssue( generateIssue('duplicateTag', { tag: 'Boat', @@ -691,6 +707,12 @@ describe('BIDS datasets', () => { }), badDatasets[2].file, ), + new BidsHedIssue( + generateIssue('invalidValue', { + tag: 'Duration/ferry s', + }), + badDatasets[3].file, + ), new BidsHedIssue( generateIssue('duplicateTag', { tag: 'Age/30', @@ -709,7 +731,7 @@ describe('BIDS datasets', () => { ], } return validator(testDatasets, expectedIssues, { version: '8.0.0' }) - }) + }, 10000) }) describe('HED 2 combined datasets', () => { @@ -722,6 +744,6 @@ describe('BIDS datasets', () => { all_good: [], } return validator(testDatasets, expectedIssues, { version: '7.2.0' }) - }) + }, 10000) }) }) diff --git a/tests/data/HED8.0.0-alpha.1.xml b/tests/data/HED8.0.0-alpha.1.xml deleted file mode 100644 index dfd5b921..00000000 --- a/tests/data/HED8.0.0-alpha.1.xml +++ /dev/null @@ -1,3578 +0,0 @@ - - - - Event - - Sensory-event - Something perceivable by the participant. An event meant to be an experimental stimulus should also be tagged with Task-property/Task-role/Experiment-stimulus. - - - Agent-action - Any action engaged in by an agent. An event that is a participant response to an experiment stimulus should also be tagged with Agent-property/Agent-task-role/Participant-response. - - - Data-feature - An event derived from the data itself or possibly inserted in a post-hoc fashion. Examples are markers for interictal spikes or alpha bursts. - - - Experiment-control - An event pertaining to the control of the experiment during its operation. - - - Experiment-procedure - An event indicating an experimental procedure as in doing a saliva swab on a participant during the experiment or administering a survey. - - - Experiment-structure - An event specifying the structure of the experiment. - - - - Agent - Something in the experiment that takes an active role or produces an effect. The role or effect may be implicit. Being alive or performing an activity such as a computation may qualify something to be an agent. An agent may also be soething that simulates something else. - - Animal-agent - An animal that is present. - - - Avatar-agent - - - Computational-agent - - - Controller-agent - An outside controller such as the experimental control software. - - - Human-agent - - - Robotic-agent - - - - Action - May or may not be in response to a previous Sensory presentation event. - - Move - - Breathe - - Inhale - A deliberate in-breath in response to a task instruction or as part of a task. Group with Attribute/Cognitive modifier/Incidental if the inhalation is incidental to the task (Action/Move/Breathe/Inhale, Attribute/Cognitive modifier/Incidental). - - - Exhale - A deliberate out-breath in response to a task instruction or as part of a task. Group with Attribute/Cognitive modifier/Incidental: (Action/Move/Breathe/Exhale, Attribute/Cognitive modifier/Incidental). - - - Hold-breath - - - - Move-full-body - - Bend - - - Dance - - - Fall-down - Involuntary fall to floor or ground - - - Flex - - - Jerk - When some force applied to the participant causes them to involuntarily accommodate or react to it. - - - Recover-balance - A movement made in response to a stumble or unforeseen loss of balance - - - Stretch - Stretching the body or body part - - - Shudder - - - Stumble - Temporary and involuntary loss of balance - - - Turn - - - - Move-head - - Move-eyes - - Blink - - - Close-eyes - - - Fixate - - - Inhibit-blinks - - - Open-eyes - - - Saccade - - - - Move-mouth - - Burp - - - Clear-throat - - - Cough - - - Gurgle - - - Hiccup - - - Smile - - - Sneeze - - - Sniffle - - - Swallow - - - Yawn - - - - Nod - - - Shake-head - - - - Move-arm-hand - - Clap - - - Drop - For example the participant drops a handheld ball - - - Grab - - - Grasp - Grasp an object in one or both hands - - - Hold-down - - - Lift - Often grouped with item being lifted. - - - Make-fist - - - Point - Should be grouped with Item/Agent/Human/Body part/Hand/Finger tag to specify which finger was used for the action. - - - Press - Often grouped with body part doing action and item being pressed. - - - Push - - - Reach - Requires a spatial goal such as reaching to touch a button or to grasp something. A body stretch is not a reach. - - - Release - Often grouped with item being released. - - - Retract - Often grouped with body part doing action and item being retracted. - - - Scratch - - - Snap-fingers - - - Tap - Often grouped with body part doing action. - - - Touch - May follow a Reach event - - - - Move-leg-foot - - Curl-toes - - - Jog - - - Jump - - - Kick - - - Pedal - - - Run - - - Step - - Heel-strike - - - Toe-off - - - - Trot - - - Walk - - - - - Communicate - - Communicate-vocally - - Cry - - - Groan - - - Gulp - Communicate anxiety. Use swallow if non-editorial. - - - Laugh - - - Scream - - - Sigh - - - Speak - Communicate using spoken language. - - - - Gesture - Make a expressive communicative movement of hands/arms and, often, face - - Index-up - - - Pump-fist - - - Spread-hand - - - Shhh - - - Shrug - - - Thumb-up - - - Wave - - - - Communicate-musically - - Hum - - - Sing - - - Vocalize - Make a sustained vowel sound such as Ahhh. - - - Whistle - - - - - Perform - Carry out or accomplish an action or task or function. - - Collide - - - Halt - Stop action. - - - Modify - Deliberately make a change in something. - - - Operate - Control something else. - - - Perceive - - Feel - - - Listen - - - Look - - - Smell - - - Taste - - - - Play - As a musical instrument or a game. - - - Read - - - Rest - - - Write - - - - Think - - Allow - Allow access to something such as allowing a car to pass - - - Attend-to - - - Count - - - Deny - Deny access to something such as preventing someone to pass - - - Detect - - - Discriminate - - - Encode - - - Evade - - - Generate - - - Identify - - - Imagine - - - Predict - - - Respond - - - Recall - - - Repeat - - - Switch-attention - - - Track - - - - - Item - - Language - An system of communication that is receivable in a sensory presentation. - - Character - A mark, sign or symbol used as part of language. - - - Glyph - A symbol or pictograph. - - - Nonword - A group of letters or speech sounds that looks or sounds like a word but that is not accepted as such by native speakers. - - - Phoneme - A sound or a group of different sounds perceived to have the same function by speakers of the language. - - - Phrase - A small group of words standing together as a conceptual unit. - - - Sentence - A set of words that is complete in itself. - - - Syllable - A unit of pronunciation having one vowel sound. - - - Textblock - A block of text. - - - Word - A single distinct meaningful element of a language. - - - - Object - Physical object perceptible via Visual, Auditory, Olfactory, and/or Tactile modalities. - - Geometric - - Pattern - - Dots - - - Led-pattern - - - - 2D-shape - - Clockface - - - Cross - - - Ellipse - - Circle - - - - Rectangle - - Square - - - - Single-point - - - Star - - - Triangle - - - - 3D-shape - - Box - - Cube - - - - Cone - - - Cylinder - - - Ellipsoid - - Sphere - - - - Pyradmid - - - - - Man-made-object - A manmade object - - Media - - Media-clip - - Audio-clip - - - Video-clip - - - - Visualization - A visual representation of something else -- such as using a stick-figure to represent motion capture data. - - Animation - - - Art-installation - - - Braille - - - Cutout - - - Image - A still 2-D representation. - - Cartoon - - - Drawing - - - Icon - - - Painting - - - Photograph - - - - Movie - - - Outline-visualization - - - Point-light-visualization - - - Sculpture - - - Stick-figure-visualization - - - - - Building - Whole building or building feature - - Room - - - Roof - - - Entrance - - - Attic - - - Basement - - - - Clothing - - - Device - - Computing-device - - - Engine - - - IO-device - - Input-device - - Button - - - Joystick - - - Keyboard - - Keyboard-key - - # - Value of a keyboard key. - - - - Keypad-key - - # - Value of keypad key. - - - - - Microphone - - - Mouse - - Mouse-button - - - Scroll-wheel - - - - Touch-screen - - - - Network-device - - - Output-device - - Display-device - - Head-mounted-display - - - LED-display - - - Screen - - Screen-window - - - - - Auditory-device - - Headphones - - - Screen-speaker - - - Loudspeaker - - - - - Recording-device - - EEG-recording - - - File-recording - - - MEG-recording - - - Motion-capture - - - Tape-recording - - - - - Machine - - Noisemaker - - - - Measurement-device - - Clock - - Clock-face - - - - - Robot - - - Tool - - - - Document - A physical, written document - - Manuscript - - - Letter - - - Note - - - Book - - - Notebook - - - - Furnishing - Furniture and appliances and other movable accessories including curtains and rugs - - - Navigational-object - - Path - - - Road - - Lane - - - - Runway - - - Sign - - - - Vehicle - - Aircraft - - - Bicycle - - - Boat - - - Car - - - Cart - - - Tractor - - - Train - - - Truck - - - - - Natural-object - An object occuring naturally in contrast to a man-made object. - - Mineral - An inorganic substance - - - Natural-feature - Some terrain occuring in the outdoors. - - Field - - - Hill - - - Mountain - - - River - - - Waterfall - - - - - Food - Something that is usually solid and can be consumed by an organism. - - - Drink - Something that is liquid and can be consumed by an organism. - - - - Organism - Something living or part of something living. - - Animal - Any multicellular or eukaryotic organism. - - Human - - - - Plant - - - Body-part - - Head - - Hair - - - Ear - - - Face - - Cheek - - - Chin - - - Eye - - - Eyebrow - - - Forehead - - - Lip - - - Nose - - - Mouth - - - Teeth - - - - - Arm - - Elbow - - - Hand - - Finger - - Index-finger - - - Little-finger - - - Middle-finger - - - Ring-finger - - - Thumb - - - - - Wrist - - - - Leg - - Ankle - - - Foot - - Toe - - - - Knee - - - - Torso - - Upper-torso - - Chest - - - - Lower-torso - - Hips - - - - Waist - - - - - - Sound - Item/Sound can be used in a tag group to describe a sound created by an action Item/Sound, Action/Move/Move leg-foot/Walk, Agent/Human or an object or Item/Sound, Item/Object/Man-made/Vehicle/Car - - Environmental-sound - A background sound from the surrounding environment. - - Crowd-sound - Multiple speech streams at once - - - Noise - - White-noise - - - Colored-noise - - - - - Musical-sound - Any tone or combination of tones with characteristics such as controlled pitch and timbre that can be controlled by an agent. - - Tone - - - Instrument-sound - - - Vocalized-sound - - - - Named-animal-sound - - Bark - - - Bleat - - - Crow - - - Chirp - - - Growl - - - Meow - - - Moo - - - Purr - - - Roar - - - - Named-object-sound - - Alarm - - - Buzz - - - Ka-ching - Cash register sound - - - Click - - - Ding - - - Horn - - - Siren - - - - - - Agent-property - - Cognitive-state - - Alert - - - Anesthetized - - - Asleep - - - Attentive - - - Awake - - - Brain-dead - - - Comatose - - - Drowsy - - - Intoxicated - Indicates a state in which participant has consumed alcohol or drugs or other substances that may alter physical or mental state. - - - Locked-in - - - Passive - - - Resting - - - Vegetative - - - - Emotional-state - - Angry - - - Aroused - - - Awed - - - Compassionate - - - Content - - - Disgusted - - - Emotionally-neutral - - - Empathetic - - - Excited - - - Fearful - - - Feeling-stress - - - Frustrated - - - Grieving - - - Happy - - - Jealous - - - Joyful - - - Loving - - - Relieved - - - Sad - - - - Postural-state - Indicates the position of an agent. Usually this position or posture is static for some length of time rather than being part of a motion. - - Crouching - - - Kneeling - - - On-treadmill - - - Prone - - - Sitting - - - Standing - - - Supported-by-chin-rest - - - - Agent-trait - - Age - - # - - - - Gender - - - Sex - - Female - - - Male - - - Intersex - - - - Handedness - - # - - - - - Social-role - The role of the agent not particular to the task. - - Brother - - - Child - - - Father - - - Mother - - - Sister - - - - Agent-task-role - The role of the agent in the task. - - Experimental-controller - - - Experimental-participant - - - Experimenter - - - Follower - - - Friend - - - Leader - - - Stranger - - - Student - - - Teacher - - - - Association - - Associated-with-non-agent - - - Associated-with-other - Item such as a cup belonging to another person - - - Associated-with-self - Item such as a cup belonging to the participant - - - - - Data-property - - Computed-property - Feature computed by tool. Should be grouped with a label of the form Toolname_propertyName - - Computed-prediction - - - - Data-value - - # - - - - Observational-property - Manually identified data feature. Should be grouped with a label of the form AgentID_featureName - - Expert-annotation - - - Instrument-measurement - - - - Physical-property - - Electrical-property - - - Magnetic-property - - - Mechanical-property - - - Organic-property - - - Thermodynamic-property - - Energy - - - Pressure - - - Temperature - - # - - - - - - Quantitative - - Angle - Angle assumed clockwise from vertical unless grouped with axis. - - # - - - - Fraction - Fraction of items of a particular type. - - # - - - - Interval - - # - - - - Item-count - - # - - - - Percentage - Percentage of items of a particular type. - - # - - - - Ratio - - # - - - - Repetition - When the same type of event such as a fixation on the exact same object happens multiple times and it might be necessary to distinguish the first look vs. others - - # - - - - - Spatiotemporal - - Rate-of-change - - Acceleration - - # - - - - Jerk-rate - Rate at which the acceleration of an object changes with respect to time. - - # - - - - Sampling-rate - Number of measurements per unit time. - - # - - - - Refresh-rate - Number of times per second a device displays an image. Also known as the frame rate. - - # - - - - Temporal-rate - Number of occurrences in a unit of time. - - # - - - - Velocity - - # - - - - - Resolution - - IO-resolution - - Screen-resolution - Number of pixels in each dimension for a digital display device. - - # - - - - Printer-resolution - Number of dots-per-inch for a printer. - - # - - - - - Spatial-resolution - Linear spacing of a spatial measurement. - - # - - - - Spectral-resolution - - # - - - - Temporal-resolution - - # - - - - - Spatial - - Direction - - # - - - - Distance - Distance from a specified position in a specified Direction or grouped with an item from which the distance is measured. - - # - - - - Orientation - - # - - - - Position - Coordinates with respect a specified frame of reference or the default Screen-frame if no frame is given. - - X-position - - # - - - - Y-position - - # - - - - Z-position - - # - - - - - Reference-frame - A frame of reference used to express spatial attributes. - - Custom-frame - A custom frame of reference which should be defined in terms of one of the default frames of reference or by a library. - - - Room-frame - - - Screen-frame - HED default frame of reference with origin at center of screen used to display experimental stimuli. Looking out of the screen has +X is horizontal to the right. +Y is up and +Z is out of the front of the screen. - - - Screen-facing-frame - HED default frame of reference with origin at the subject Nasion. +X is horizontal to the subject right. +Y is to the subject front and +Z is vertical upward. - - - World-frame - - - - Size - - Area - - # - - - - Length - A measurement of the size along the longest dimension. - - # - - - - Width - A measurement along the shortest of two or three dimensions. - - # - - - - Height - A measurement in a direction perpendicular to Length and Width in 3D. In 2D, it is perpendicular to both the Length and Height. - - # - - - - Volume - - # - - - - - Surface-properties - - Rough - - - Smooth - - - - - Temporal - - Delay - An indicator that the associated tag group represents something temporally offset from the current event. The delay value can be positive or negative and should always appear in a tag group indicating what is delayed. - - # - - - - Duration - Time extent of something. - - # - - - - Onset - - - Offset - - - Pause - Indicating something stopped such as a break or waiting for input. - - - Temporal-value - - # - - - - Time-out - - - Time-sync - Indicates a marker inserted into the recorded data to allow post hoc synchronization of concurrently recorded data streams. - - - - - Statistical-property - - Accuracy - - - Data-mean - - - Data-median - - - Data-minimum - - - Data-maximum - - - Probability - Use to specify the level of certainty about the occurrence of the event. - - - Statistical-precision - - - Statistical-recall - - - Standard-deviation - - - Uncertainty - Use to specify the level of error. - - - - - Task-property - - Attentional-strategy - - Bottom-up-attention - - - Covert-attention - - - Divided-attention - - - Focused-attention - - - Orienting-attention - - - Overt-attention - - - Selective-attention - - - Sustained-attention - - - Top-down-attention - - - - Task-effect-evidence - - Computational-evidence - Prediction made by computer program. - - - External-evidence - External judgment assumed to be ground truth such as from an experiment control software or an annotator about participant actions such as answering a question, failing to answer in time, etc. Related to participant indication - - - Intended-effect - How the stimulus is expected to effect the participants based on the experimental design. - - - Behavioral-evidence - - - - Task-role - The purpose with respect to the task. - - Activity - Something that is part of the overall task or is necessary to the overall experiment but is not directly part of a stimulus-response cycle. Examples would be taking a survey or provided providing a silva sample. - - - Background-subtask - A part of the task which should be performed in the background. - - - Experimental-stimulus - Part of something designed to elicit a response in the experiment. - - - Failure - - - Incidental - Usually associated with a sensory event intended to give instructions to the participant about the task or behavior. - - - Instructional - Usually associated with a sensory event intended to give instructions to the participant about the task or behavior. - - - Mishap - Unplanned disruption such as an equipment or experiment control abnormality or experimenter error. - - - Participant-response - Something related to a participant actions in performing the task. - - - Primary-subtask - A part of the task which should be the primary focus of the participant. - - - Warning - Something that should warn the participant that the parameters of the task have been or are about to be exceeded such as a warning message about getting too close to the shoulder of the road in a driving task. - - - - Task-response-type - How the participant response should be interpreted in terms of the task specification. - - Appropriate - - - Correction - - - Erroneous - - - Imagined - This is used to identity something that only happened in the imagination of the participant as in imagined movements in motor imagery paradigms. - - - Inappropriate - - - Indeterminate - - - Missed - - - Near-miss - - - Successful - - - - Task-stimulus-type - The stimulus purpose in the task. - - Cue - - - Distractor - - - Expected - Of low information value as in frequent non-targets in an RSVP paradigm. - - - Extraneous - - - Feedback - - - Meaningful - - - Newly-learned - - - Non-informative - - - Non-target - Make sure to tag Expected if the Non-target is frequent - - - Not-meaningful - - - Novel - Genuinely novel such as an event occurring once or so per experiment - - - Oddball - Unexpected or infrequent - - - Planned - - - Penalty - - - Priming - - - Reward - - - Signal-go - - - Signal-stop - - - Target - Something the subject is looking for - - - Threat - - - Timed - - - Unexpected - - - - - Attribute - Subtree tree for general properties. - - Informational - Informational properties. - - Def - A label that specifically corresponds to a Definition name and indicates that this label represents tags in an unexpanded definition. - - # - - - - Def-expand - A label that specifically corresponds to a Definition name and indicates that this label is in a group containing an expanded definition and should not be expanded again. - - # - - - - Definition - A tag used within a tag group also containing a Label tag to indicate that the Label represents that group of tags. - - # - - - - Description - Human-readable text description of the event. - - # - - - - Experimental-note - - # - - - - ID - An alphanumeric code usually used to identify a particular instance of an item. - - # - - - - Label - A string of 20 or fewer characters identifying something. Labels usually refer to general classes of things while IDs refer to specific instances. - - # - - - - Metadata - A tag used within a tag group indicate to designate information about the data such as file size or author. - - CogAtlas - A tag used within a tag group indicate a relationship to the CognitiveAtlas terminology. - - # - - - - CogPo - A tag used within a tag group indicate a relationship to the CogPO terminology. - - # - - - - Creation-date - - # - - - - Library-name - - # - - - - Path-name - - # - - - - Subject - - # - - - - Version - - # - - - - - Parameter - As a Name:Value - - # - - - - - Organizational - - Collection - A tag designating a grouping of items such as in a set or list. - - - Control-variable - An aspect of the experiment that is fixed throughout the study and usually is explicitly controlled. - - - Event-context - A tag indicating the overall environment and setup of the experiment or a portion of the experiment. This event is often inserted into a recording at the beginning of an experimental record to describe information such as whether the experiment is conducted indoors or outdoors or whether the experiment is conducted in the real-world or in a controlled laboratory setting. Tags specifying subject metadata might also be included. - - - Event-stream - An ordered list of events - - - Experimental-condition - An aspect of the experiment or task that is to be varied during the experiment. Task-conditions are sometimes called independent variables or contrasts. - - - Experimental-indicator - An aspect of the experiment or task that is measured as task conditions are varied during the experiment. Experiment indicators are sometimes called dependent variables. - - - Experimental-intertrial - A tag used to indicate a part of the experiment between trials usually where nothing is happening. - - - Experimental-trial - A tag used to indicate a particular organizational part in the experimental design often containing a stimulus-response pair or stimulus-response-feedback triad. - - - Permutation - A tag used within a tag group also containing a Label tag to indicate that the Label represents events that are permutations of each other. - - - Recording - Indicates an uninterrupted block of time during which data was acquired using a fixed scanning protocol or sensor positioning. Recording tags are usually have temporal scope which is the entire recording. - - - Task - A tag used to indicate a linkage the structured activities performed as part of the experiment. - - - Time-block - A tag used to indicate a contiguous time block in the experiment during which something is fixed or noted. - - - - Relational - - Comparative-relation - - Less-than - - - Less-than-or-equal-to - - - Greater-than - - - Greater-than-or-equal-to - - - Equal-to - - - Not-equal-to - - - - Connective-relation - - Belongs-to - As in owned by - - - Connected-to - - - Contained-in - - - Described-by - - - From-to - - - Group-of - - - Implied-by - - - Interacts-with - - - Member-of - - - Part-of - - - Performed-by - - - Related-to - - - - Ordering-relation - - Early-item - Indication that this item appears early in a sequence. - - - First-item - Indication that this is the first item in a sequence. - - - Next-item - Indication that this item appears immediately after the previous item in a sequence. - - - Later-item - Indication that this item appears later in a sequence. - - - Last-item - Indication that this is the last item in a sequence. - - - - Quantitative-relation - - Estimated - - - Approximated - - - Exact - - - - Spatiotemporal-relation - - Directional-relation - - Away-from - - - Backward - - - Closing - - - Decreasing - - - Downward - - - Forward - - - Increasing - - - Leftward - - - Rightward - - - Opening - - - Towards - - - Upward - - - - Orientational-relation - - Horizontally-oriented - - - Oblique - - - Rotated - - - Vertically-oriented - - - - Positional-relation - Should be grouped with what it is positionally related to. - - Above - - - Across - - - Adjacent-to - - - Ahead-of - - - Around - - - Back-of - - - Behind - - - Below - - - Between - Should be grouped with the items between designates. - - - Bilateral - - - Bottom-of - At the bottom of something. Should be grouped with the item that it is positionally related to. - - - Boundary-of - - - Center-of - At the center of something. Should be grouped with the item that it is positionally related to. - - - Close-to - - - Edge-of - - - Far-from - - - Front-of - - - Inside-of - - - Left-of - - - Left-side - - - Outside-of - - - Over - - - Right-of - - - Right-side - - - Top-of - - - Under - - - - Temporal-relation - - After - - - Asynchronous-with - - - Before - - - During - - - Synchronous-with - - - Waiting-for - - - - Variability-relation - - Constant - - - Continuous - - - Deterministic - - - Discrete - - - Flickering - Irregular changes in time. - - - Fractal - - - Random - - - Repetitive - - - Sudden - - - Varying - - - - - Thermal-relation - - Cold - - - Colder-than - - - Hot - - - Hotter-than - - - - - Categorical - - Abnormal - - - All - - - Asymmetric - - - Congruent - - - Constrained - - - Correct - - - Deep - - - Disordered - - - False - - - Familiar - Something known or encountered before. - - - Famous - Something known by many people but necessarily because of direct contact. - - - High - - - Incongruent - - - Incorrect - - - Invalid - - - Involuntary - - - Liminal - - - Low - - - Masked - Ability to perceive influenced by presence of another stimulus - - - Medium - - - None - - - Normal - - - Negative - - - Ordered - - - Positive - - - Shallow - - - Some - - - Subliminal - - - Supraliminal - - - Symmetric - - - True - - - Unconstrained - - - Unfamiliar - Something not known or encountered before. - - - Unmasked - Ability to perceive not influenced by presence of another stimulus - - - Valid - - - Voluntary - - - - Descriptive - Indicate the type of thing. - - Abstract - - - Clinical - - - Complex - - - Composite - - - Numerical - - - Symbolic - - - - Sensory - - Auditory - - Audible - - - Frequency - - # - - - - Loudness - - # - - - - Monophonic - Consisting of one independent audio channel - - - Ramp-up - Increasing in amplitude - - - Ramp-down - Decreasing in amplitude - - - Silent - - - Stereophonic - Consisting of more than one independent audio channel - - - Timbre - Sound quality - - - - Gustatory - Pertaining to sensations of relating to taste. - - Bitter - - - Salty - - - Savory - - - Sour - - - Sweet - - - - Tactile - Pertaining to sensations of relating to touch. - - Tactile-pressure - - - Tactile-texture - - - Tactile-vibration - - - - Olfactory - Pertaining to sensations of relating to smell. - - - Somatic - Pertaining to sensations of nervous system such as pain. - - Pain - - - Stress - - - - Vestibular - - - Visual - - Luminance - - - Color - - Color-shade - - Dark-shade - - - Light-shade - - - - HSV-color - - Hue - - # - Angular value between 0 and 360 - - - - Saturation - - # - B value of RGB between 0 and 1 - - - - HSV-value - - # - G value of RGB between 0 and 1 - - - - - RGB-color - - RGB-red - - # - R value of RGB between 0 and 1 - - - - RGB-blue - - # - B value of RGB between 0 and 1 - - - - RGB-green - - # - G value of RGB between 0 and 1 - - - - - Grayscale - Indicates gray scale - - # - White intensity between 0 and 1 - - - - CSS-color - One of 140 colors supported by all browsers. For more details such as the color RGB or HEX values, check: https://www.w3schools.com/colors/colors_groups.asp - - Blue-color - - CadetBlue - - - SteelBlue - - - LightSteelBlue - - - LightBlue - - - PowderBlue - - - LightSkyBlue - - - SkyBlue - - - CornflowerBlue - - - DeepSkyBlue - - - DodgerBlue - - - RoyalBlue - - - Blue - - - MediumBlue - - - DarkBlue - - - Navy - - - MidnightBlue - - - - Brown-color - - Cornsilk - - - BlanchedAlmond - - - Bisque - - - NavajoWhite - - - Wheat - - - BurlyWood - - - Tan - - - RosyBrown - - - SandyBrown - - - GoldenRod - - - DarkGoldenRod - - - Peru - - - Chocolate - - - Olive - - - SaddleBrown - - - Sienna - - - Brown - - - Maroon - - - - Cyan-color - - Aqua - - - Cyan - - - LightCyan - - - PaleTurquoise - - - Aquamarine - - - Turquoise - - - MediumTurquoise - - - DarkTurquoise - - - - Green-color - - GreenYellow - - - Chartreuse - - - LawnGreen - - - Lime - - - LimeGreen - - - PaleGreen - - - LightGreen - - - MediumSpringGreen - - - SpringGreen - - - MediumSeaGreen - - - SeaGreen - - - ForestGreen - - - Green - - - DarkGreen - - - YellowGreen - - - OliveDrab - - - DarkOliveGreen - - - MediumAquaMarine - - - DarkSeaGreen - - - LightSeaGreen - - - DarkCyan - - - Teal - - - - Gray-color - - Gainsboro - - - LightGray - - - Silver - - - DarkGray - - - DimGray - - - Gray - - - LightSlateGray - - - SlateGray - - - DarkSlateGray - - - Black - - - - Orange-color - - Orange - - - DarkOrange - - - Coral - - - Tomato - - - OrangeRed - - - - Pink-color - - Pink - - - LightPink - - - HotPink - - - DeepPink - - - PaleVioletRed - - - MediumVioletRed - - - - Purple-color - - Lavender - - - Thistle - - - Plum - - - Orchid - - - Violet - - - Fuchsia - - - Magenta - - - MediumOrchid - - - DarkOrchid - - - DarkViolet - - - BlueViolet - - - DarkMagenta - - - Purple - - - MediumPurple - - - MediumSlateBlue - - - SlateBlue - - - DarkSlateBlue - - - RebeccaPurple - - - Indigo - - - - Red-color - - LightSalmon - - - Salmon - - - DarkSalmon - - - LightCoral - - - IndianRed - - - Crimson - - - Red - - - FireBrick - - - DarkRed - - - - Yellow-color - - Gold - - - Yellow - - - LightYellow - - - LemonChiffon - - - LightGoldenRodYellow - - - PapayaWhip - - - Moccasin - - - PeachPuff - - - PaleGoldenRod - - - Khaki - - - DarkKhaki - - - - White-color - - White - - - Snow - - - HoneyDew - - - MintCream - - - Azure - - - AliceBlue - - - GhostWhite - - - WhiteSmoke - - - SeaShell - - - Beige - - - OldLace - - - FloralWhite - - - Ivory - - - AntiqueWhite - - - Linen - - - LavenderBlush - - - MistyRose - - - - - - View - - 2D-view - - - 3D-view - - - Background-view - - - Bistable-view - Something having two stable visual forms that have two distinguishable stable forms as in optical illusions. - - - Foreground-view - - - Foveal-view - Visual presentation directly on the fovea. - - - Map-view - A representation of a geographical location. - - Aerial-view - A representation from an overhead view such as captured by a drone. - - - Satellite-view - A representation as captured by technology such as a satellite. - - - Street-view - A panoramic view from a position on the ground. - - - - Peripheral-view - - - - - - Environmental - - Indoors - - - Outdoors - - - Real-world - - - Virtual-world - - - Augmented-reality - - - Motion-platform - - - Urban - - - Rural - - Wooden-walkway - - - - Terrain - - Composite-terrain - - - Dirt-terrain - - - Grassy-terrain - - - Gravel-terrain - - - Leaf-covered-terrain - - - Muddy-terrain - - - Paved-terrain - - - Rocky-terrain - - - Sloped-terrain - - - Uneven-terrain - - - - - Anatomical - - - - - acceleration - - m-per-s^2 - - - - angle - - radian - rad - degree - - - - area - - m^2 - px^2 - pixel^2 - - - - currency - - dollar - $ - point - - - - dateTime - - YYYY-MM-DDThh:mm:ss - - - - frequency - - hertz - Hz - - - - intensity - - dB - - - - jerk - - m-per-s^3 - - - - luminousIntensity - - candela - cd - - - - memorySize - - byte - B - - - - physicalLength - - metre - m - foot - mile - - - - pixels - - pixel - px - - - - speed - - m-per-s - mph - kph - - - - time - - second - s - day - minute - hour - - - - volume - - m^3 - - - - - - deca - SI unit multiple representing 10^1 - - - da - SI unit multiple representing 10^1 - - - hecto - SI unit multiple representing 10^2 - - - h - SI unit multiple representing 10^2 - - - kilo - SI unit multiple representing 10^3 - - - k - SI unit multiple representing 10^3 - - - mega - SI unit multiple representing 10^6 - - - M - SI unit multiple representing 10^6 - - - giga - SI unit multiple representing 10^9 - - - G - SI unit multiple representing 10^9 - - - tera - SI unit multiple representing 10^12 - - - T - SI unit multiple representing 10^12 - - - peta - SI unit multiple representing 10^15 - - - P - SI unit multiple representing 10^15 - - - exa - SI unit multiple representing 10^18 - - - E - SI unit multiple representing 10^18 - - - zetta - SI unit multiple representing 10^21 - - - Z - SI unit multiple representing 10^21 - - - yotta - SI unit multiple representing 10^24 - - - Y - SI unit multiple representing 10^24 - - - deci - SI unit submultiple representing 10^-1 - - - d - SI unit submultiple representing 10^-1 - - - centi - SI unit submultiple representing 10^-2 - - - c - SI unit submultiple representing 10^-2 - - - milli - SI unit submultiple representing 10^-3 - - - m - SI unit submultiple representing 10^-3 - - - micro - SI unit submultiple representing 10^-6 - - - u - SI unit submultiple representing 10^-6 - - - nano - SI unit submultiple representing 10^-9 - - - n - SI unit submultiple representing 10^-9 - - - pico - SI unit submultiple representing 10^-12 - - - p - SI unit submultiple representing 10^-12 - - - femto - SI unit submultiple representing 10^-15 - - - f - SI unit submultiple representing 10^-15 - - - atto - SI unit submultiple representing 10^-18 - - - a - SI unit submultiple representing 10^-18 - - - zepto - SI unit submultiple representing 10^-21 - - - z - SI unit submultiple representing 10^-21 - - - yocto - SI unit submultiple representing 10^-24 - - - y - SI unit submultiple representing 10^-24 - - - Schema attributes - - - defaultUnits - Default units for a tag. - - - extensionAllowed - Users can add unlimited levels of child nodes under this tag. - - - isNumeric - The tag hashtag placeholder must be replaced by a numerical value. - - - position - Used to specify the order of the required and recommended tags in canonical order for display. The position attribute value should be an integer and the order can start at 0 or 1. Required or recommended tags without this attribute or with negative position will be shown after the others in canonical ordering. - - - predicateType - One of propertyOf, subclassOf, passThrough -- used to facilitate mapping to OWL or RDF. - - - recommended - A HED string tagging an event is recommended to include this tag. - - - relatedTag - Additional HED tags suggested to be used with this tag. This attribute is used by tagging tools. - - - requireChild - One of its descendants must be chosen to tag an event. - - - required - Every HED string tagging an event should include this tag. - - - SIUnit - Designates the name of an SI unit so it can be modified by multiple and submultiple names. Note that some units such as byte are designated as SI units although they are not part of the standard. - - - SIUnitModifier - SI unit modifier indicating a multiple or submultiple of a base unit. - - - SIUnitSymbolModifier - SI unit symbol modifier indicating a multiple or submultiple of a base unit symbol. - - - suggestedTag - Additional HED tags suggested to be used with this tag. This attribute is used by tagging tools. - - - takesValue - This tag will have a hashtag placeholder child in the schema which is expected to be replaced with a user-defined value. - - - unique - Only one of this tag or its descendants can be used within a single tag group or event. - - - unitSymbol - Abbreviation or symbol representing a type of unit. Unit symbols represent both the singular and the plural and thus cannot be pluralized. - - - This is the new format for the mediawiki schema - diff --git a/tests/data/HED8.0.0-alpha.3.xml b/tests/data/HED8.0.0-alpha.3.xml deleted file mode 100644 index 751e8bc4..00000000 --- a/tests/data/HED8.0.0-alpha.3.xml +++ /dev/null @@ -1,5433 +0,0 @@ - - - - Event - Something that happens at a given place and time. Elements of this subtree designate the general category in which an event falls. - - suggestedTag - Task-property - - - Sensory-event - Something perceivable by the participant. An event meant to be an experimental stimulus should also be tagged with Task-property/Task-role/Experiment-stimulus. - - suggestedTag - Task-property/Task-role - - - - Agent-action - Any action engaged in by an agent. An event that is a participant response to an experiment stimulus should also be tagged with Agent-property/Agent-task-role/Participant-response. - - suggestedTag - Task-property/Task-role - - - - Data-feature - An event derived from the data itself or possibly inserted in a post-hoc fashion. Examples are markers for interictal spikes or alpha bursts. - - suggestedTag - Data-property - - - - Detected-feature - Something that is measured or detected by an instrument such as a patch-clamp or a probe. - - suggestedTag - Data-property - - - - Experiment-control - An event pertaining to the control of the experiment during its operation. - - - Experiment-procedure - An event indicating an experimental procedure as in doing a saliva swab on a participant during the experiment or administering a survey. - - - Experiment-structure - An event specifying the structure of the experiment. - - - - Agent - Something in the experiment that takes an active role or produces an effect. The role or effect may be implicit. Being alive or performing an activity such as a computation may qualify something to be an agent. An agent may also be something that simulates something else. - - suggestedTag - Agent-property - - - Animal-agent - An animal that is present and acting to produce an effect. - - - Avatar-agent - An agent associated with an icon or figure representing a particular person in venues such as video games or internet forums. - - - Computational-agent - An agent whose decisions about its actions can be explained in terms of computation. - - - Controller-agent - An outside controller such as the experimental control software or hardware. - - - Human-agent - A person who takes an active role or produces a specified effect. - - - Microscopic-agent - An agent too small to be seen except under a microscope such as a cell or a neuron. - - - Robotic-agent - An agent that is a mechanical device capable of performing a variety of often complex tasks on command or by being programmed in advance. - - - Software-agent - A computer program that acts for a user or other program in a relationship of agency. - - - - Action - Do something. - - extensionAllowed - - - Move - Go in a specified direction or manner; change position. - - Breathe - Inhale and exhale air into the body during respiration. - - Cough - Suddenly and audibly expel air from the lungs through a partially closed glottis, preceded by inhalation. - - - Exhale - Blow out or expel breath. - - - Hiccup - Involuntarily spasm the diaphragm and respiratory organs, with a sudden closure of the glottis and a characteristic sound like that of a cough. - - - Hold-breath - Interrupt normal breathing by ceasing to inhale or exhale. - - - Inhale - Draw in with the breath through the nose or mouth. - - - Sneeze - Suddenly and violently expel breath through the nose and mouth. - - - Sniffle - Inhale through nose slightly or repeatedly, typically because of a cold or fit of crying. - - - - Move-full-body - Move entire body. - - Bend - Move body in a bowed or curved manner. - - - Dance - Perform a purposefully selected sequences of human movement often with aesthetic or symbolic value. Move rhythmically to music, typically following a set sequence of steps. - - - Fall-down - Lose balance and collapse. - - - Flex - Cause a muscle to stand out by contracting or tensing it. Bend a limb or joint. - - - Jerk - Make a quick, sharp, sudden movement. - - - Recover-balance - Return to a stable, upright body position. - - - Stretch - Straighten or extend body or a part of body to its full length, typically so as to tighten muscles or in order to reach something. - - - Shudder - Tremble convulsively, sometimes as a result of fear or revulsion. - - - Stumble - Trip or momentarily lose balance and almost fall. - - - Turn - Change or cause to change direction. - - - - Move-body-part - Move one part of a body. - - Move-head - Move head. - - Move-eyes - Move eyes. - - Blink - Shut and open the eyes quickly. - - - Close-eyes - Lower and keep eyelids in a closed position. - - - Fixate - Direct eyes to a specific point or target. - - - Inhibit-blinks - Purposely prevent blinking. - - - Lift-eyebrows - Move eyebrows upward. - - - Open-eyes - Raise eyelids to expose pupil. - - - Saccade - Move eyes rapidly between fixation points. - - - Stare - Look fixedly or vacantly at someone or something with eyes wide open. - - - Widen-eyes - Open eyes and possibly with eyebrows lifted especially to express surprise or fear. - - - - Move-jaw - Move lower part of the jaw and head. - - Bite - Seize with teeth or jaws an object or organism so as to grip or break the surface covering. - - - Burp - Noisily release air from the stomach through the mouth; belch. - - - Chew - Repeatedly grinding, tearing, and or crushing with teeth or jaws. - - - Clear-throat - Cough slightly so as to speak more clearly, attract attention, or to express hesitancy before saying something awkward. - - - Frown - Express disapproval, displeasure, or concentration, typically by turning down the corners of the mouth. - - - Gurgle - Make a hollow bubbling sound like that made by water running out of a bottle. - - - Smile - Form facial features into a pleased, kind, or amused expression, typically with the corners of the mouth turned up and the front teeth exposed. - - - Swallow - Cause or allow something, especially food or drink to pass down the throat. - - - Yawn - Take a deep involuntary inhalation with the mouth open often as a sign of drowsiness or boredom. - - - - Nod-head - Tilt head in alternating up and down arcs along the sagittal plane. It is most commonly, but not universally, used to indicate agreement, acceptance, or acknowledgement. - - - Shake-head - Turn head from side to side as a way of showing disagreement or refusal. - - - - Move-arm-hand - Move some part of arm, shoulder and or arm. - - Clap-hands - Strike the palms of against one another resoundingly, and usually repeatedly, especially to express approval. - - - Drop - Let or cause to fall vertically. - - - Grab - Seize suddenly or quickly; snatch; clutch. - - - Grasp - Seize and hold firmly. - - - Hold-down - Prevent someone or something from moving by holding them firmly. - - - Lift - Raising something to higher position. - - - Make-fist - Close hand tightly with the fingers bent against the palm. - - - Point - Draw attention to something by extending a finger or arm. - - - Press - Apply pressure to something to flatten, shape, or smooth it. - - - Push - Apply force in order to move something away. - - - Reach - Stretch out your arm in order to get or touch something. - - - Release - Make available; set free. - - - Retract - Draw or pull back. - - - Scratch - Drag claws or nails over a surface or on skin. - - - Snap-fingers - Make a noise by pushing second finger hard against thumb and then releasing it suddenly so that it hits the base of the thumb. - - - Touch - Come into or be in contact with. - - - - Move-leg-foot - Move some part of leg or foot. - - Curl-toes - Bend toes sometimes to grip. - - - Jog - Run at a trot to exercise. - - - Jump - Move off the ground or other surface through sudden muscular effort in the legs. - - - Kick - Strike out or flail with the foot or feet. Strike using the leg, in unison usually with an area of the knee or lower using the foot. - - - Pedal - Move by working the pedals of a bicycle or other machine. - - - Run - Travel on foot at a fast pace. - - - Step - Put one leg in front of the other and shift weight onto it. - - Heel-strike - Strike the ground with the heel during a step. - - - Toe-off - Push with toe as part of a stride. - - - - Trot - Run at a moderate pace, typically with short steps. - - - Walk - Move at a regular pace by lifting and setting down each foot in turn never having both feet off the ground at once. - - - - - - Communicate - Convey knowledge of or information about something. - - Communicate-vocally - Communicate using mouth or vocal cords. - - Cry - Shed tears associated with emotions, usually sadness but also joy or frustration. - - - Groan - Make a deep inarticulate sound in response to pain or despair. - - - Gulp - Swallow quickly or in large mouthfuls, often audibly, sometimes to indicate apprehension. - - - Laugh - Make the spontaneous sounds and movements of the face and body that are the instinctive expressions of lively amusement and sometimes also of contempt or derision. - - - Scream - Make loud, vociferous cries or yells to express pain, excitement, or fear. - - - Sigh - Emit a long, deep, audible breath expressing sadness, relief, tiredness, or a similar feeling. - - - Speak - Communicate using spoken language. - - - - Gesture - Communicate nonverbally using visible bodily actions, either in place of speech or together and in parallel with spoken words. Gestures include movement of the hands, face, or other parts of the body. - - Index-up - Raise with fist clenched in triumph or affirmation. - - - Pump-fist - Raise with fist clenched in triumph or affirmation. - - - Spread-hands - Spread hands apart to indicate ignorance. - - - Shhh - Place finger over lips and possibly uttering the syllable shhh to indicate the need to be quiet. - - - Shrug - Lift shoulders up towards head to indicate a lack of knowledge about a particular topic. - - - Thumbs-down - Extend the thumb downward to indicate disapproval. - - - Thumb-up - Extend the thumb upward to indicate approval. - - - Wave - Raise hand and move left and right, as a greeting or sign of departure. - - - - Communicate-musically - Communicate using music. - - Hum - Make a low, steady continuous sound like that of a bee. Sing with the lips closed and without uttering speech. - - - Sing - Produce musical tones by means of the voice. - - - Vocalize - Utter vocal sounds. - - - Whistle - Produce a shrill clear sound by forcing breath out or air in through the puckered lips. - - - - - Perform - Carry out or accomplish an action, task, or function. - - Collide - Hit with force when moving. - - - Halt - Bring or come to an abrupt stop. - - - Modify - Change something. - - - Operate - Control the functioning of a machine, process, or system. - - - Play - Engage in activity for enjoyment and recreation rather than a serious or practical purpose. - - - Read - Interpret something that is written or printed. - - - Repeat - Make, do, or perform again. - - - Rest - Be inactive in order to regain strength, health, or energy. - - - Write - Communicate or express by means of letters or symbols written or imprinted on a surface. - - - - Think - Direct the mind toward someone or something or use the mind actively to form connected ideas. - - Allow - Allow access to something such as allowing a car to pass. - - - Attend-to - Focus mental experience on specific targets. - - - Count - Tally items either silently or aloud. - - - Deny - Refuse to give or grant something requested or desired by someone. - - - Detect - Discover or identify the presence or existence of something. - - - Discriminate - Recognize a distinction. - - - Encode - Convert information or an instruction into a particular form. - - - Evade - Escape or avoid, especially by cleverness or trickery. - - - Generate - Cause something, especially an emotion or situation to arise or come about. - - - Identify - Establish or indicate who or what someone or something is. - - - Imagine - Form a mental image or concept of something. - - - Judge - Evaluate evidence to make a decision or form a belief. - - - Learn - Adaptively change behavior as the result of experience. - - - Perceive - Produce an internal, conscious image through stimulating a sensory system. - - Listen - Give attention to a sound. - - - Look - Direct gaze toward someone or something or in a specified direction. - - - Smell - Inhale in order to ascertain an odor or scent. - - - Taste - Sense of flavor perceived in the mouth and throat on contact with a substance. - - - - Plan - Think about the activities required to achieve a desired goal. - - - Predict - Say or estimate that something will happen or will be a consequence of something without having exact informaton. - - - Recognize - Identify someone or something from having encountered them before. - - - Respond - React to something such as a treatment or a stimulus. - - - Recall - Remember information by mental effort. - - - Switch-attention - Transfer attention from one focus to another. - - - Track - Follow a person, animal, or object through space or time. - - - - - Item - An independently existing thing (living or nonliving). - - extensionAllowed - - - Biological-item - An entity that is biological, that is related to living organisms. - - Organism - A living entity, more specifically a biological entity that consists of one or more cells and is capable of genomic replication (independently or not). - - Animal - A living organism that has membranous cell walls, requires oxygen and organic foods, and is capable of voluntary movement. - - Human - The bipedal primate mammal Homo sapiens. - - - - Plant - Any living organism that typically synthesizes its food from inorganic substances and possesses cellulose cell walls. - - - - Anatomical-item - A biological structure, system, fluid or other substance excluding single molecular entities. - - Body-part - Any part of an organism. - - Head - The upper part of the human body, or the front or upper part of the body of an animal, typically separated from the rest of the body by a neck, and containing the brain, mouth, and sense organs. - - Hair - - - Ear - - - Face - - Cheek - - - Chin - - - Eye - - - Eyebrow - - - Forehead - - - Lip - - - Nose - - - Mouth - - - Teeth - - - - - Arm - - Elbow - - - Hand - - Finger - - Index-finger - - - Little-finger - - - Middle-finger - - - Ring-finger - - - Thumb - - - - - Wrist - - - - Leg - - Ankle - - - Foot - - Toe - - - - Knee - - - - Torso - - Upper-torso - - Chest - - - - Lower-torso - - Hips - - - - Waist - - - - - Organ - A unique macroscopic anatomic structure that is composed of various tissues and performs specific functions as for example heart or liver. - - - Tissue - An anatomical structure consisting of similarly specialized cells and intercellular matrix, aggregated according to genetically determined spatial relationships, performing a specific function. - - - - - Language-item - An item that is part of systematic means of communicating by the use of sounds, symbols, or gestures. The presentation of this item is usually visual, auditory or tactile. - - suggestedTag - Attribute/Sensory - - - Character - A mark, sign or symbol used as part of language. - - - Glyph - A symbol or pictograph. - - - Nonword - A group of letters or speech sounds that looks or sounds like a word but that is not accepted as such by native speakers. - - - Phoneme - A sound or a group of different sounds perceived to have the same function by speakers of the language. - - - Phrase - A small group of words standing together as a conceptual unit. - - - Sentence - A set of words that is complete in itself. - - - Syllable - A unit of pronunciation having one vowel sound. - - - Textblock - A block of text. - - - Word - A single distinct meaningful element of a language. - - - - Object - Something perceptible by one or more of the senses, especially by vision or touch; a material thing. - - suggestedTag - Attribute/Sensory - - - Geometric-object - - Pattern - - Dots - - - Led-pattern - - - - 2D-shape - - Clockface - - - Cross - - - Ellipse - - Circle - - - - Rectangle - - Square - - - - Single-point - - - Star - - - Triangle - - - - 3D-shape - - Box - - Cube - - - - Cone - - - Cylinder - - - Ellipsoid - - Sphere - - - - Pyradmid - - - - - Ingestible-object - - - Man-made-object - A manmade object - - Media - - Media-clip - - Audio-clip - - - Video-clip - - - - Visualization - A visual representation of something else -- such as using a stick-figure to represent motion capture data. - - Animation - - - Art-installation - - - Braille - - - Cutout - - - Image - A still 2-D representation. - - Cartoon - - - Drawing - - - Icon - - - Painting - - - Photograph - - - - Movie - - - Outline-visualization - - - Point-light-visualization - - - Sculpture - - - Stick-figure-visualization - - - - - Building - Whole building or building feature - - Room - - - Roof - - - Entrance - - - Attic - - - Basement - - - - Clothing - - - Device - - Computing-device - - - Engine - - - IO-device - - Input-device - - Button - - - Joystick - - - Keyboard - - Keyboard-key - - # - Value of a keyboard key. - - takesValue - - - - - Keypad-key - - # - Value of keypad key. - - takesValue - - - - - - Microphone - - - Mouse - - Mouse-button - - - Scroll-wheel - - - - Touch-screen - - - - Network-device - - - Output-device - - Display-device - - Head-mounted-display - - - LED-display - - - Screen - - Screen-window - - - - - Auditory-device - - Headphones - - - Screen-speaker - - - Loudspeaker - - - - - Recording-device - - EEG-recording - - - File-recording - - - MEG-recording - - - Motion-capture - - - Tape-recording - - - - - Machine - - Noisemaker - - - - Measurement-device - - Clock - - Clock-face - - - - - Robot - - - Tool - - - - Document - A physical, written document - - Manuscript - - - Letter - - - Note - - - Book - - - Notebook - - - - Furnishing - Furniture and appliances and other movable accessories including curtains and rugs - - - Navigational-object - - Path - - - Road - - Lane - - - - Runway - - - Sign - - - - Vehicle - - Aircraft - - - Bicycle - - - Boat - - - Car - - - Cart - - - Tractor - - - Train - - - Truck - - - - - Natural-object - An object occuring naturally in contrast to a man-made object. - - Mineral - An inorganic substance - - - Natural-feature - Some terrain occuring in the outdoors. - - Field - - - Hill - - - Mountain - - - River - - - Waterfall - - - - - - Sound - Mechanical vibrations transmitted by an elastic medium; something that can be heard. - - Environmental-sound - A background sound from the surrounding environment. - - Crowd-sound - Multiple speech streams at once. - - - Noise - - White-noise - - - Colored-noise - - - - - Musical-sound - Any tone or combination of tones with characteristics such as controlled pitch and timbre that can be controlled by an agent. - - Tone - - - Instrument-sound - - - Vocalized-sound - - - - Named-animal-sound - - Bark - - - Bleat - - - Crow - - - Chirp - - - Growl - - - Meow - - - Moo - - - Purr - - - Roar - - - - Named-object-sound - - Alarm - - - Beep - - - Buzz - - - Ka-ching - Cash register sound - - - Click - - - Ding - - - Horn - - - Siren - - - - - - Agent-property - Something that pertains to an agent. - - extensionAllowed - - - Cognitive-state - The state of the cognitive processes or state of mind of the agent. - - Alert - Condition of heightened watchfulness or preparation for action. - - - Anesthetized - Having lost sensation to pain or having senses dulled due to the effects of an anesthetic. - - - Asleep - Having entered a periodic, readily reversible state of reduced awareness and metabolic activity, usually accompanied by physical relaxation and brain activity. - - - Attentive - Concentrating and focusing mental energy on the task or surroundings. - - - Awake - In a non sleeping state. - - - Brain-dead - Characterized by the irreversible absence of cortical and brain stem functioning. - - - Comatose - In a state of profound unconsciousness associated with markedly depressed cerebral activity. - - - Drowsy - In a state of near-sleep, a strong desire for sleep, or sleeping for unusually long periods. - - - Intoxicated - In a state with disturbed psychophysiological functions and responses as a result of administration or ingestion of a psychoactive substance. - - - Locked-in - In a state of complete paralysis of all voluntary muscles except for the ones that control the movements of the eyes. - - - Passive - Not responding or initiating an action in response to a stimulus. - - - Resting - A state in which the agent is not exhibiting any physical exertion. - - - Vegetative - A state of wakefulness and conscience, but (in contrast to coma) with involuntary opening of the eyes and movements (such as teeth grinding, yawning, or thrashing of the extremities). - - - - Emotional-state - The status of the general temperament and outlook of an agent. - - Angry - Experiencing emotions characterized by marked annoyance or hostility. - - - Aroused - In a state reactive to stimuli leading to increased heart rate and blood pressure, sensory alertness, mobility and readiness to respond. - - - Awed - Filled with wonder. Feeling grand, sublime or powerful emotions characterized by a combination of joy, fear, admiration, reverence, and/or respect. - - - Compassionate - Feeling or showing sympathy and concern for others often evoked for a person who is in distress and associated with altruistic motivation. - - - Content - Feeling satisfaction with things as they are. - - - Disgusted - Feeling revulsion or profound disapproval aroused by something unpleasant or offensive. - - - Emotionally-neutral - Feeling neither satisfied nor dissatisfied. - - - Empathetic - Understanding and sharing the feelings of another. Being aware of, being sensitive to, and vicariously experiencing the feelings, thoughts, and experience of another. - - - Excited - Feeling great enthusiasm and eagerness. - - - Fearful - Feeling apprehension that one may be in danger. - - - Frustrated - Feeling annoyed as a result of being blocked, thwarted, disappointed or defeated. - - - Grieving - Feeling sorrow in response to loss, whether physical or abstract. - - - Happy - Feeling pleased and content. - - - Jealous - Feeling threatened by a rival in a relationship with another individual, in particular an intimate partner, usually involves feelings of threat, fear, suspicion, distrust, anxiety, anger, betrayal, and rejection. - - - Joyful - Feeling delight or intense happiness. - - - Loving - Feeling a strong positive emotion of affection and attraction. - - - Relieved - No longer feeling pain, distress, anxiety, or reassured. - - - Sad - Feeling grief or unhappiness. - - - Stressed - Experiencing mental or emotional strain or tension. - - - - Postural-state - Pertaining to the position in which agent holds their body. - - Crouching - Adopting a position where the knees are bent and the upper body is brought forward and down, sometimes to avoid detection or to defend oneself. - - - Kneeling - Positioned where one or both knees are on the ground. - - - On-treadmill - Ambulation on an exercise apparatus with an endless moving belt to support moving in place. - - - Prone - Positioned in a recumbent body position whereby the person lies on its stomach and faces downward. - - - Sitting - In a seated position. - - - Standing - Assuming or maintaining an erect upright position. - - - Supported-by-chin-rest - Using a device that supports the chin and head. - - - - Agent-trait - A genetically, environmentally, or socially determined characteristic of an agent. - - Age - Length of time elapsed time since birth of the agent. - - # - - takesValue - - - - - Gender - Characteristics that are socially constructed, including norms, behaviors, and roles based on sex. - - - Sex - Physical properties or qualities by which male is distinguished from female. - - Female - Biological sex of an individual with female sexual organs such ova. - - - Male - Biological sex of an individual with male sexual organs producing sperm. - - - Intersex - Having genitalia and/or secondary sexual characteristics of indeterminate sex. - - - - Handedness - Individual preference for use of a hand, known as the dominant hand. - - Left-handed - Preference for using the left hand or foot for tasks requiring the use of a single hand or foot. - - - Right-handed - Preference for using the right hand or foot for tasks requiring the use of a single hand or foot. - - - Ambidextrous - Having no overall dominance in the use of right or left hand or foot in the performance of tasks that require one hand or foot. - - - - - Agent-social-role - The function or part that is ascribed to an individual agent with respect to in a community. - - Brother - Being a male sibling. - - - Child - Having an age below the legal age of majority. - - - Father - Being a male parent. - - - Mother - Being a female parent. - - - Sister - Being a female sibling. - - - - Agent-task-role - The function or part that is ascribed to an agent in performing the task. - - Experimental-controller - An agent acting to control the experiment. - - - Experimental-participant - Someone who takes part in an activity related to an experiment. - - - Experimenter - Person who is the owner of the experiment and has its responsibility. - - - Follower - A person who follows the lead of another. - - - Friend - A person whom an individual knows, likes, and trusts. - - - Leader - A person who leads or commands an activity, project, group, organization, or country. - - - Stranger - A person not known in a particular place or community. - - - Student - A person who is enrolled in an educational institution. A person who acquires knowledge and skill from some educator during an education process. - - - Teacher - An agent who instructs or educates others. - - - - - Data-property - Something that pertains to data or information. - - extensionAllowed - - - Data-source-type - The type of place, person, or thing from which the data comes or can be obtained. - - Computed-feature - A feature computed from the data by a tool. This tag should be grouped with a label of the form Toolname_propertyName. - - - Computed-prediction - A computed extrapolation of known data. - - - Expert-annotation - An explanatory or critical comment or other in-context information provided by an authority. - - - Instrument-measurement - Information obtained from a device that is used to measure material properties or make other observations. - - - Observation - Active acquisition of information from a primary source. Should be grouped with a label of the form AgentID_featureName. - - - - Physical-property - A characteristic that defines the nature of matter or forces that act upon it. - - Electromagnetic-property - A characteristic of matter such as electrical conductivity that governs its interaction with electrical or magnetic forces. - - - Mechanical-property - A physical quality that inheres in an bearer by virtue of how that bearer behaves when subjected to forces or displacements and the effect of their bodies on their environment. - - Pressure - The force applied to a unit area of surface. - - # - - isNumeric - - - takesValue - - - - - - Organic-property - Relating to or containing elemental carbon or carbon compounds. - - - Thermodynamic-property - Property related to heat and other forms of energy (such as mechanical, electrical, or chemical energy), and, by extension, of the relationships between all forms of energy. - - Energy - The capacity of a physical system to do work. - - # - - isNumeric - - - takesValue - - - - - Entropy - A thermodynamic property which acts as a measure of the state of disorder of a system. - - # - - isNumeric - - - takesValue - - - - - Temperature - A measure of the average kinetic energy of a system of particles. Temperature may be quantified, in the context of thermodynamics, as the potential of one system to transfer thermal energy to another system until both systems reach a state of thermal equilibrium. - - # - - isNumeric - - - takesValue - - - - - - - Quantitative-property - Something capable of being estimated or expressed with numeric values. - - Angle - The inclination of one line to another or the plane of one object to another. Angles are assumed clockwise from vertical unless grouped with axis. - - # - - takesValue - - - - - Fraction - A numerical value betwee 0 and 1. - - # - - takesValue - - - - - Interval - A period of time or the distance separating two instances, events, or occurrences. - - # - - takesValue - - - - - Item-count - An integer and represented the number of instances or occurences of an entity. - - # - - takesValue - - - - - Percentage - A fraction or ratio with 100 understood as the denominator. - - # - - takesValue - - - - - Ratio - A quotient of quantities of the same kind for different components within the same system. - - # - - takesValue - - - - - Repetition-interval - The amount of time between successive occurrences. - - # - - takesValue - - - - - Repetition-number - An integer that identifies the particular occurrence of a repeating activity or entity. - - # - - takesValue - - - - - - Spatiotemporal-property - A property relating to space and/or time. - - Rate-of-change - The amount of change accumulated per unit time. - - Acceleration - Magnitude of the rate of change in either speed or direction. The direction of change should be given separately. - - # - - isNumeric - - - takesValue - - - unitClass - acceleration - - - - - Jerk-rate - Magnitude of the rate at which the acceleration of an object changes with respect to time. The direction of change should be given separately. - - # - - isNumeric - - - takesValue - - - unitClass - jerk - - - - - Sampling-rate - The number of digital samples taken or recorded per unit of time. - - # - - takesValue - - - unitClass - frequency - - - - - Refresh-rate - The frequency with which the image on a computer monitor or similar electronic display screen is refreshed, usually expressed in hertz. - - # - - isNumeric - - - takesValue - - - - - Speed - A scalar measure of the rate of movement of the object expressed either as the distance travelled divided by the time taken (average speed) or the rate of change of position with respect to time at a particular point (instantaneous speed). The direction of change should be given separately. - - # - - isNumeric - - - takesValue - - - unitClass - speed - - - - - - Resolution - The size of the smallest element that can be separated from neighboring elements. - - IO-resolution - Smallest change in a quality being measured by an sensor that causes a perceptible change in the IO device. - - Screen-resolution - Resolution of a screen, usually expressed as the of pixels in a dimension for a digital display device. - - # - - takesValue - - - - - Printer-resolution - Resolution of a printer, usually expressed as the number of dots-per-inch for a printer. - - # - - takesValue - - - - - - Spatial-resolution - Linear spacing of a spatial measurement. - - # - - takesValue - - - - - Spectral-resolution - Measures the ability of a sensor to resolve features in the electromagnetic spectrum. - - # - - takesValue - - - - - Temporal-resolution - Measures the ability of a sensor to resolve features in time. - - # - - takesValue - - - - - - Spatial-property - Property of an element involving space. - - Direction - The spatial relation between something and the course along which it points or moves. - - # - - isNumeric - - - takesValue - - - - - Distance - A measure of the space separating two objects or points. - - # - - isNumeric - - - takesValue - - - unitClass - physicalLength - - - - - Orientation - The position or alignment of something relative to points of the compass, other specific directions, or some other indexing system. - - # - - isNumeric - - - takesValue - - - - - Position - A reference to the alignment of an object, a particular situation or view of a situation, or the location of an object. Coordinates with respect a specified frame of reference or the default Screen-frame if no frame is given. - - X-position - The position along the x-axis of the frame of reference. - - # - - isNumeric - - - takesValue - - - unitClass - physicalLength - - - - - Y-position - The position along the y-axis of the frame of reference. - - # - - isNumeric - - - takesValue - - - unitClass - physicalLength - - - - - Z-position - The position along the z-axis of the frame of reference. - - # - - isNumeric - - - takesValue - - - unitClass - physicalLength - - - - - - Size - The physical magnitude of something. - - Area - The extent of a 2-dimensional surface enclosed within a boundary. - - # - - isNumeric - - - takesValue - - - unitClass - area - - - - - Length - The linear extent in space from one end of something to the other end, or the extent of something from beginning to end. - - # - - isNumeric - - - takesValue - - - unitClass - physicalLength - - - - - Width - The extent or measurement of something from side to side. - - # - - isNumeric - - - takesValue - - - unitClass - physicalLength - - - - - Height - The vertical measurement or distance from the base to the top of an object; the vertical dimension of extension. - - # - - isNumeric - - - takesValue - - - unitClass - physicalLength - - - - - Volume - The amount of three dimensional space occupied by an object or the capacity of a space or container. - - # - - isNumeric - - - takesValue - - - unitClass - volume - - - - - - Surface-properties - Property of the outer boundary of a three-dimensional object. - - Rough - A texture quality inhering in a bearer by virtue of the irregular surface of the bearer. - - - Smooth - Having a surface free from roughness or bumps or ridges or irregularities. - - - - - Temporal-property - A characteristic of or relating to time or limited by time. - - Delay - Time during which some action is awaited; inactivity resulting in something being put off until a later time. - - # - - isNumeric - - - takesValue - - - unitClass - time - - - - - Duration - The period of time during which something occurs or continues. - - # - - isNumeric - - - takesValue - - - unitClass - time - - - - - Frequency - Frequency is the number of occurrences of a repeating event per unit time. - - # - - isNumeric - - - takesValue - - - unitClass - frequency - - - - - Onset - Labels the start or beginning of something, usually an event. - - topLevelTagGroup - - - - Offset - Labels the time at which something stops. - - topLevelTagGroup - - - - Pause - Indicates the temporary interruption of the operation a process and subsequently wait for a signal to continue. - - - Time-value - A value with units of time. Usually grouped with tags identifying what the value represents. - - unitClass - time - - - # - - isNumeric - - - takesValue - - - unitClass - time - - - - - Time-out - A cancellation or cessation that automatically occurs when a predefined interval of time has passed without a certain event occurring. - - - Time-sync - A synchronization signal whose purpose to help synchronize different signals or processes. Often used to indicate a marker inserted into the recorded data to allow post hoc synchronization of concurrently recorded data streams. - - - - - Statistical-property - A property relating to, based on, or employing the principles of statistics. - - extensionAllowed - - - Accuracy - A measure of closeness to true value expressed as a number between 0 and 1. - - # - - isNumeric - - - takesValue - - - - - Data-mean - The sum of a set of values divided by the number of values in the set. - - # - - isNumeric - - - takesValue - - - - - Data-median - The value which has an equal number of values greater and less than it. - - # - - isNumeric - - - takesValue - - - - - Data-minimum - The smallest possible quantity. - - # - - isNumeric - - - takesValue - - - - - Data-maximum - The largest possible quantity or degree. - - # - - isNumeric - - - takesValue - - - - - Probability - A measure of the expectation of the occurrence of a particular event. - - # - - isNumeric - - - takesValue - - - - - Statistical-precision - A quantitative representation of the degree of accuracy necessary for or associated with a particular action. - - # - - isNumeric - - - takesValue - - - - - Statistical-recall - Sensitivity is a measurement datum qualifying a binary classification test and is computed by substracting the false negative rate to the integral numeral 1. - - # - - isNumeric - - - takesValue - - - - - Standard-deviation - A measure of the range of values in a set of numbers. Standard deviation is a statistic used as a measure of the dispersion or variation in a distribution, equal to the square root of the arithmetic mean of the squares of the deviations from the arithmetic mean. - - # - - isNumeric - - - takesValue - - - - - Uncertainty - A measure of the inherent variability of repeated observation measurements of a quantity including quantities evaluated by statistical methods and by other means. - - # - - isNumeric - - - takesValue - - - - - - - Task-property - Something that pertains to a task. - - extensionAllowed - - - Task-attentional-strategy - Strategy for allocating attention toward goal-relevant information. - - Bottom-up-attention - Attentional guidance purely by externally driven factors to stimuli that are salient because of their inherent properties relative to the background. Sometimes this is referred to as stimulus driven. - - - Covert-attention - Paying attention without moving the eyes. - - - Divided-attention - Integrating parallel multiple stimuli. Behavior involving responding simultaneously to multiple tasks or multiple task demands. - - - Focused-attention - Responding discretely to specific visual, auditory, or tactile stimuli. - - - Orienting-attention - Directing attention to a target stimulus. - - - Overt-attention - Selectively processing one location over others by moving the eyes to point at that location. - - - Selective-attention - Maintaining a behavioral or cognitive set in the face of distracting or competing stimuli. Ability to pay attention to a limited array of all available sensory information. - - - Sustained-attention - Maintaining a consistent behavioral response during continuous and repetitive activity. - - - Top-down-attention - Voluntary allocation of attention to certain features. Sometimes this is referred to goal-oriented attention. - - - - Task-effect-evidence - The evidence supporting the conclusion that the event had the specified effect. - - Computational-evidence - A type of evidence in which data are produced, and/or generated, and/or analyzed on a computer. - - - External-evidence - A phenomenon that follows and is caused by some previous phenomenon. - - - Intended-effect - A phenomenon that is intended to follow and be caused by some previous phenomenon. - - - Behavioral-evidence - An indication or conclusion based on the behavior of an agent. - - - - Task-event-role - The purpose of an event with respect to the task. - - Activity - Something that is part of the overall task or is necessary to the overall experiment but is not directly part of a stimulus-response cycle. Examples would be taking a survey or provided providing a silva sample. - - - Background-subtask - A part of the task which should be performed in the background as for example inhibiting blinks due to instruction while performing the primary task. - - - Experimental-stimulus - Part of something designed to elicit a response in the experiment. - - - Failure - A descriptor indicating a failure. - - - Incidental - Usually associated with a sensory event intended to give instructions to the participant about the task or behavior. - - - Instructional - Usually associated with a sensory event intended to give instructions to the participant about the task or behavior. - - - Mishap - Unplanned disruption such as an equipment or experiment control abnormality or experimenter error. - - - Participant-response - Something related to a participant actions in performing the task. - - - Primary-subtask - A part of the task which should be the primary focus of the participant. - - - Warning - Something that should warn the participant that the parameters of the task have been or are about to be exceeded such as a warning message about getting too close to the shoulder of the road in a driving task. - - - - Task-response-type - How the participant response should be interpreted in terms of the task specification. - - Appropriate - Suitable or proper in the circumstances. - - relatedTag - Inappropriate - - - - Correction - Offering an improvement to replace a mistake; setting right; something substituted for an error. - - relatedTag - Successful - - - - Erroneous - Something wrong or incorrect. - - - Imagined - Form a mental image or concept of something. This is used to identity something that only happened in the imagination of the participant as in imagined movements in motor imagery paradigms. - - - Inappropriate - Not in keeping with what is correct or proper. - - relatedTag - Appropriate - - - - Indeterminate - Cannot distinguish between two or more possible values in the current context. - - relatedTag - Missed - Near-miss - - - - Missed - Not existing; not able to be found. - - relatedTag - Indeterminate - Near-miss - - - - Near-miss - A narrowly avoided collision or other accident. - - relatedTag - Indeterminate - Miss - - - - Successful - Something that accomplishes its intended purpose. - - relatedTag - Correction - - - - - Task-stimulus-role - The role the stimulus plays in the task. - - Cue - A signal for an action, a pattern of stimuli indicating a particular response. - - - Distractor - A person or thing that distracts or a plausible but incorrect option in a multiple-choice question. - - - Expected - Considered likely or probable; anticipated. Something of low information value as in frequent non-targets in an RSVP paradigm. - - - Extraneous - Irrelevant or unrelated to the subject being dealt with. - - - Feedback - An evaluative response to an inquiry, process, event, or activity. - - - Go-signal - An indicator to proceed with a planned action. - - relatedTag - Stop-signal - - - - Meaningful - Conveying significant or relevant information. - - - Newly-learned - Representing recently acquired information or understanding. - - - Non-informative - Something that is not useful in forming an opinion or judging an outcome. - - - Non-target - Something other than that done or looked for. Also tag Expected if the Non-target is frequent. - - suggestedTag - Expected - - - - Not-meaningful - Not having a serious, important, or useful quality or purpose. - - - Novel - Having no previous example or precedent or parallel; of a kind not seen before. - - - Oddball - Something strange, bizarre, unusal, or infrequent. - - - Planned - Something that was decided on or arranged in advance. - - - Penalty - A disadvantage, loss, or hardship due to some action. - - - Priming - An implicit memory effect in which exposure to a stimulus influences response to a later stimulus. - - - Reward - A positive reinforcement for a desired action, behavior or response. - - - Stop-signal - An indicator that the agent should stop the current activity. - - relatedTag - Go-signal - - - - Target - Something fixed as a goal or point of examination; something to point at; a destination. Something an agent is looking for. - - - Threat - An indicator that signifies hostility and predicts an increased probability of attack. - - - Timed - Something planned or scheduled to be done at a particular time or lasting for a specified amount of time. - - - Unexpected - Something that is not planned or anticipated. - - - - - Attribute - A characteristic of some entity. A quality or feature regarded as a characteristic or inherent part of someone or something. HED attributes are adjectives or adverbs. - - extensionAllowed - - - Informational - A quality that pertains to information. - - Def - A HED-specific utility tag used with a defined name to represent the tags associated with that definition. - - requireChild - - - # - - takesValue - - - - - Def-expand - A HED specific utility tag that is grouped with an expanded definition. The child value of the Def-expand is the name of the expanded definition. - - requireChild - - - tagGroup - - - # - - takesValue - - - - - Definition - A HED-specific utility tag whose child value is the name of the concept and the tag group associated with the tag is an English language explanation of a concept. - - requireChild - - - topLevelTagGroup - - - # - - takesValue - - - - - Description - An explanation of what the tag group it is in means. If the description is at the top-level of an event string, the description applies to the event. - - requireChild - - - # - - takesValue - - - - - Experimental-note - A brief written record about the experiment. - - # - - takesValue - - - - - ID - An alphanumeric name that identifies either a unique object or a unique class of objects. Here the object or class may be an idea, physical countable object (or class), or physical uncountable substance (or class). - - requireChild - - - # - - takesValue - - - - - Label - A string of 20 or fewer characters identifying something. Labels usually refer to general classes of things while IDs refer to specific instances. A term that is associated with some entity. A brief description given for purposes of identification; an identifying or descriptive marker that is attached to an object. - - requireChild - - - # - - takesValue - - - - - Metadata - Data about data; information that describes another set of data. - - CogAtlas - The Cognitive Atlas ID number of somthing. - - # - - takesValue - - - - - CogPo - The CogPO ID number of something. - - # - - takesValue - - - - - Creation-date - The date on which data creation of this element began. - - requireChild - - - # - - takesValue - - - unitClass - datetime - - - - - Library-name - Official name of a HED library. - - # - - takesValue - - - - - Pathname - The specification of a node (file or directory) in a hierarchical file system, usually specified by listing the nodes top-down. - - # - - takesValue - - - - - Subject-identifier - A sequence of characters used to identify, name, or characterize a trial or study subject. - - # - - takesValue - - - - - Version-identifier - An alphanumeric character string that identifies a form or variant of a type or original. - - # - Usually is a semantic version. - - takesValue - - - - - - Parameter - Any factor that defines a system and determines or limits its performance. A variable whose value changes the characteristics of a system or a function. - - # - - takesValue - - - - - Value - A numerical quantity measured or assigned or computed. Non-numeric values are specified with the Label tag. - - # - - takesValue - - - - - - Organizational - Relating to an organization or the action of organizing something. - - Collection - A tag designating a grouping of items such as in a set or list. - - - Control-variable - An aspect of the experiment that is fixed throughout the study and usually is explicitly controlled. - - - Event-context - A special HED tag inserted as part of a top-level tag group to contain information about the interrelated conditions under which the event occurs. The event context includes information about other events that are ongoing when this event happens. - - topLevelTagGroup - - - - Event-stream - An ordered list of events. - - - Experimental-condition - An aspect of the experiment or task that is to be varied during the experiment. Task-conditions are sometimes called independent variables or contrasts. - - - Experimental-indicator - An aspect of the experiment or task that is measured as task conditions are varied during the experiment. Experiment indicators are sometimes called dependent variables. - - - Experimental-intertrial - A tag used to indicate a part of the experiment between trials usually where nothing is happening. - - - Experimental-trial - Designates a run or execution of an activity, for example, one execution of a script. A tag used to indicate a particular organizational part in the experimental design often containing a stimulus-response pair or stimulus-response-feedback triad. - - - Permutation - A set of elements are rearranged or reindexed in various and different orders. In the rearrangement process, none of the elements are lost, added, or changed. - - - Recording - The process of copying the information in a signal into a persistent information bearer. Indicates an uninterrupted block of time during which data was acquired using a fixed scanning protocol or sensor positioning. Recording tags are usually have temporal scope which is the entire recording. - - - Task - An assigned piece of work, usually with a time allotment. A tag used to indicate a linkage the structured activities performed as part of the experiment. - - - Time-block - A tag used to indicate a contiguous time block in the experiment during which something is fixed or noted. - - - - Relational - Concerns the way in which two or more people or things are connected. - - Comparative-relation - Something considered in comparison to something else. - - Less-than - (A (Less-than B)) indicates that the relative size or order of A is smaller than that of B. - - - Less-than-or-equal-to - (A (Less-than-or-equal-to B)) indicates that the relative size or order of A is smaller than or equal to B. - - - Greater-than - (A (Greater-than B)) indicates that the relative size or order of A is bigger than that of B. - - - Greater-than-or-equal-to - (A (Greater-than-or-equal-to B)) indicates that the relative size or order of A is bigger than or the same as that of B. - - - Equal-to - (A (Equal-to B)) indicates that the size or order of A is the same as that of B. - - - Not-equal-to - (A (Not-equal-to B)) indicates that the size or order of A is not the same as that of B. - - - - Connective-relation - Indicates two items are related in some way. - - Belongs-to - (A (Belongs-to B)) indicates that A is a member of B. - - - Connected-to - (A (Connected-to) B) indicates that A is related to B in some respect, usually through a direct link. - - - Contained-in - (A (Contained-in B)) indicates that A is completely inside of B. - - - Described-by - (A (Described-by B)) indicates that B provides information about A. - - - From-to - (A (From-to B)) indicates a directional relation from A to B. A is considered the source. - - - Group-of - (A (Group-of B)) indicates A is a group of items of type B. - - - Implied-by - (A (Implied-by B)) indicates B is suggested by A. - - - Interacts-with - (A (Interacts-with B)) indicates A and B interact, possibly reciprocally. - - - Member-of - (A (Member-of B)) indicates A is a member of group B. - - - Part-of - (A (Part-of B)) indicates A is a part of the whole B. - - - Performed-by - (A (Performed-by B)) Indicates that ction or procedure A was carried out by agent B. - - - Related-to - (A (Relative-to B)) indicates A is a part of the whole B. - - - - Ordering-relation - A relation describing the systematic arrangement of data items. - - Early-item - An item near the beginning of a course, process, or series. - - - First-item - A first item at the beginning of a course, process, or series. - - - Next-item - A subsequent or immediately following item in the order. - - - Later-item - An item occurring near the end of a group of ordered items. - - - Last-item - An item occurring at the end of a group of ordered items. - - - - Quantitative-relation - A quantitative or numerical relationship. - - Estimated - Calculated approximately. - - - Approximated - Not quite exact or correct; almost exact or correct. - - - Exact - Marked by strict and particular and complete accordance with fact. - - - - Spatiotemporal-relation - A space and or temporal relationship. - - Directional-relation - A relationship indicating direction. - - Away-from - Go away from (a place). - - - Backward - Directed behind or to the rear. - - - Closing - Not affording passage or access; blocked against entry. - - - Decreasing - Becoming smaller or fewer in size, amount, intensity, or degree. - - - Downward - Moving or leading toward a lower place or level. - - - Forward - At or near or directed toward the front. - - - Increasing - Becoming greater in size, amount, or degree; growing. - - - Leftward - Going toward or facing the left. - - - Rightward - Going toward or situated on the right. - - - Opening - Widening an aperture, door, or gap, especially one allowing access. - - - Towards - Moving in the direction of. - - - Upward - Moving, pointing, or leading to a higher place, point, or level. - - - - Orientational-relation - Indicating relative physical position or direction of something. - - Horizontally-oriented - Oriented parallel to or in the plane of the horizon. - - - Oblique - Slanting or inclined in direction or course or position; neither parallel nor perpendicular nor right-angular. - - - Rotated - Move or cause to move in a circle around an axis or center. - - - Vertically-oriented - Oriented in an upright in position or posture. - - - - Positional-relation - Indicating information about position. - - Above - (A (Adjacent-to B)) means A is in a place or position that is higher than B. - - - Across-from - (A (Across-from B)) means A is on the opposite side of something from B. - - - Adjacent-to - (A (Adjacent-to B)) indicates that A is next to B in time or space. - - - Ahead-of - (A (Ahead-of B)) indicates that A is further forward in time or space in B. - - - Around - (A (Around B)) means A is in or near the present place or situation of B. - - - Behind - (A (Behind B)) means A is at or to the far side of B, typically so as to be hidden by it. - - - Below - (A (Below B)) means A is in a place or position that is lower than the position of B. - - - Between - (A (Between, (B, C))) means A is in the space or interval separating B and C. - - - Bilateral - (A (Bilateral B)) means A is on both sides of B or affects both sides of B. - - - Bottom-of - (A (Bottom-of B)) means A is on the lowest part, side, or surface of B. - - - Boundary-of - (A (Boundary-of B)) means A is on or part of the edge or boundary of B. - - - Center-of - (A (Center-of B)) means A is at a point or or in an area that is approximately central within B. - - - Close-to - (A (Close-to B)) means A is at a small distance from or is located near in space to B. - - - Far-from - (A (Far-from B)) means A is at a large distance from or is not located near in space to B. - - - In-front-of - (A (In-front-of B)) means A is in a position just ahead or at the front part of B, potentially partially blocking B from view. - - - Left-of - (A (Left-of B)) means A is located on or directed toward the side to the west of B when B is facing north. This term is used when A is not part of B. - - - Left-side - (A (Left-side B)) means A is located on the left side of B usually as part of B. - - - Outside-of - (A (Outside-of B)) means A is located in the space around but not including B. - - - Over - (A (over B)) means A above is above B so as to cover or protect or A extends over the a general area as from a from a vantage point. - - - Right-of - (A (Right-of B)) means A is located on or directed toward the side to the east of B when B is facing north. This term is used when A is not part of B. - - - Right-side - (A (Right-side B)) means A is located on the right side of B usually as part of B. - - - Top-of - (A (Top-of B)) means A is on the uppermost part, side, or surface of B. - - - Underneath - (A (Underneath B)) means A is situated directly below and may be concealed by B. - - - Within - (A (Within B)) means A is on the inside of or contained in B. - - - - Temporal-relation - Any relationship which includes a temporal or time-based component. - - After - (A After B) means A happens at a time subsequent to a reference time related to B. - - - Asynchronous-with - (A Asynchronous-with B) means A happens at times not occurring at the same time or having the same period or phase as B. - - - Before - (A Before B) means A happens at a time earlier in time or order than B. - - - During - (A During B) means A happens at some point in a given period of time in which B is ongoing. - - - Synchronous-with - (A Synchronous-with B) means A happens at occurs at the same time or rate as B. - - - Waiting-for - (A Waiting-for B) means A pauses for something to happen in B. - - - - Variability-relation - An attribute describing how something changes or varies. - - Abrupt - Marked by sudden change. - - - Constant - Continually recurring or continuing without interruption. Not changing in time or space. - - - Continuous - Uninterrupted in time, sequence, substance, or extent. - - - Deterministic - No randomness is involved in the development of the future states of the element. - - relatedTag - Random - Stochastic - - - - Discrete - Constituting a separate entities or parts. - - - Flickering - Moving irregularly or unsteadily or burning or shining fitfully or with a fluctuating light. - - - Fractal - Having extremely irregular curves or shapes for which any suitably chosen part is similar in shape to a given larger or smaller part when magnified or reduced to the same size. - - - Random - Governed by or depending on chance; lacking any definite plan or order or purpose. - - relatedTag - Deterministic - Stochastic - - - - Repetitive - A recurring action that is often non-purposeful. - - - Stochastic - Uses a random probability distribution or pattern that may be analysed statistically but may not be predicted precisely to determine future states. - - relatedTag - Deterministic - Random - - - - Varying - Differing in size, amount, degree, or nature. - - - - - Thermal-relation - A relationship related to temperature. - - Cold - Characterized by an absence of heat. - - - Colder-than - (A (Colder-than B)) means A has less heat energy than the object against which it is compared; the absence of heat. - - - Hot - Characterized by an excess of heat. - - - Hotter-than - (A (Hotter-than B)) means A has more heat energy than the object against which it is compared; the absence of heat. - - - - - Categorical - Indicates that something can take on a limited and usually fixed number of possible values. - - Categorical-class - Categorical values that fall into discrete classes such as true or false. The grouping is absolute in the sense that it is the same for all participants. - - All - To a complete degree or to the full or entire extent. - - relatedTag - Some - None - - - - Correct - Free from error; especially conforming to fact or truth. - - relatedTag - Incorrect - - - - Explicit - Stated clearly and in detail, leaving no room for confusion or doubt. - - relatedTag - Implicit - - - - False - Not in accordance with facts, reality or definitive criteria. - - relatedTag - True - - - - Implicit - Implied though not plainly expressed. - - relatedTag - Explicit - - - - Invalid - Not true because based on erroneous information or unsound reasoning or not conforming to the correct format or specifications. - - relatedTag - Valid - - - - None - No person or thing, nobody, not any. - - relatedTag - All - Some - - - - Some - At least a small amount or number of, but not a large amount of, or often. - - relatedTag - All - None - - - - True - Conforming to facts, reality or definitive criteria. - - relatedTag - False - - - - Valid - Allowable, usable, or acceptable. - - relatedTag - Invalid - - - - Wrong - Not accurate, correct, or appropriate. - - relatedTag - Correct - - - - - Categorical-judgment - Categorical values that are based on the judgment or perception of the participant such familiar and famous. - - Abnormal - Deviating in any way from the state, position, structure, condition, behavior, or rule which is considered a norm. - - relatedTag - Normal - - - - Asymmetrical - Lacking symmetry or having parts that fail to correspond to one another in shape, size, or arrangement; lacking symmetry. - - relatedTag - Symmetrical - - - - Congruent - Concordance of multiple evidence lines. In agreement or harmony. - - relatedTag - Incongruent - - - - Constrained - Keeping something within particular limits or bounds. - - relatedTag - Unconstrained - - - - Disordered - Not neatly arranged; confused and untidy. A structural quality in which the parts of an object are non-rigid. - - relatedTag - Ordered - - - - Familiar - Recognized, familiar, or within the scope of knowledge. - - relatedTag - Unfamiliar - Famous - - - - Famous - A person who has a high degree of recognition by the general population for his or her success or accomplishments; a famous person. - - relatedTag - Familiar - UnfamiliarrelatedTag - Unfamiliar - - - - Incongruent - Not in agreement or harmony. - - relatedTag - Congruent - - - - Involuntary - An action that is not made by choice. In the body, involuntary actions (such as blushing) occur automatically, and cannot be controlled by choice. - - relatedTag - Voluntary - - - - Masked - Information exists but is not provided or is partially obscured due to security, privacy, or other concerns. - - relatedTag - Unmasked - - - - Normal - Being approximately average or within certain limits; conforming with or constituting a norm or standard or level or type or social norm. - - relatedTag - Abnormal - - - - Ordered - Conforming to a logical or comprehensible arrangement of separate elements; a condition of regular or proper arrangement. - - relatedTag - Disordered - - - - Symmetrical - Made up of exactly similar parts facing each other or around an axis; showing symmetry. - - relatedTag - Asymmetrical - - - - Unconstrained - Moving without restriction. - - relatedTag - Constrained - - - - Unfamiliar - Not having knowledge or experience of. - - relatedTag - Familiar - Famous - - - - Unmasked - Information is revealed. - - relatedTag - Masked - - - - Voluntary - Using free will or design; not forced or compelled; controlled by individual volition. - - relatedTag - Involuntary - - - - - Categorical-level - Categorical values based on dividing a continuous variable into levels such as high and low. - - Deep - Extending relatively far inward or downward. - - relatedTag - Shallow - - - - High - Having an elevated level or position or degree; having a greater than normal in degree or intensity or amount. - - relatedTag - Low - Medium - - - - Liminal - Situated at a sensory threshold; barely perceptible or capable of eliciting a response. - - relatedTag - Subliminal - Supraliminal - - - - Low - A minimum level or position or degree; less than normal in degree, intensity or amount. - - relatedTag - High - - - - Medium - Mid-way between small and large in number, quantity, magnitude or extent. - - relatedTag - Low - High - - - - Negative - Involving disadvantage or harm. - - relatedTag - Positive - - - - Positive - Involving advantage or good. - - relatedTag - Negative - - - - Shallow - Having a depth which is relatively low. - - relatedTag - Deep - - - - Subliminal - Situated below a sensory threshold; imperceptible or not capable of eliciting a response. - - relatedTag - Liminal - Supraliminal - - - - Supraliminal - Situated above a sensory threshold; perceptible or capable of eliciting a response. - - relatedTag - Liminal - Subliminal - - - - Thick - Wide in width, extent or cross-section. - - relatedTag - Thin - - - - Thin - Narrow in width, extent or cross-section. - - relatedTag - Thick - - - - - - Descriptive - Involving a written or verbal account, representation, statement, or explanation of something. - - Abstract - A concept or idea not associated with any specific instance. - - - Clinical - Relating to the examination and treatment of patients dependent on direct observation. - - - Complex - Hard, involved or complicated, elaborate, having many parts. - - - Composite - Consisting of separate interconnected parts. - - - Numerical - A numeral or string of numerals expressing value, quantity, or identification. - - - Symbolic - A representation such as a tattoo with a specific meaning. Significant purely in terms of what is being represented or implied. - - - - Sensory - Relating to sensation or the physical senses; transmitted or perceived by the senses. - - Auditory - Of or relating to the process of hearing. - - Audible - Any action or condition designed to cause the registration or perception of a stimulus by organs and receptors involved in the sense of hearing. - - - Loudness - A physical quality inhering in a sound wave by virtue of the maximum magnitude (value without regard to sign) of its disturbance. - - # - - isNumeric - - - takesValue - - - - - Monophonic - Relating to sound transmission, recording, or reproduction involving a single transmission path. - - - Silent - The absence of ambient audible sound, the emission of sounds of such low intensity that they do not draw attention to themselves, or the state of having ceased to produce sounds. - - - Stereophonic - Relating to, or constituting sound reproduction involving the use of separated microphones and two transmission channels to achieve the sound separation of a live hearing. - - - Timbre - The quality of tone distinctive of a particular singing voice or musical instrument. - - - - Gustatory - Concerned with tasting or the sense of taste. - - Bitter - Having a sharp, pungent taste. - - - Salty - Tasting of or like salt. - - - Savory - Belonging to a taste that is salty or spicy rather than sweet. - - - Sour - Having a sharp, acidic taste. - - - Sweet - Having or resembling the taste of sugar. - - - - Tactile - Of or connected with the sense of touch. - - Tactile-pressure - Having a feeling of heaviness. - - - Tactile-texture - Having a feeling of roughness. - - - Tactile-vibration - Having a feeling of mechanical oscillation. - - - - Olfactory - Having to do with the faculty of smell. - - - Somatic - Having to do with feelings in the body. - - Pain - The sensation of discomfort, distress, or agony, resulting from the stimulation of specialized nerve endings. - - - Stress - The negative mental, emotional, and physical reactions that occur when environmental stressors are perceived as exceeding the adaptive capacities of the individual. - - - - Vestibular - Relating to or affecting the perception of body position and movement. - - - Visual - Relating to or using sight; able to be seen. - - Luminance - A quality that exists by virtue of the luminous intensity per unit area projected in a given direction. - - - Color - The appearance of objects (or light sources) described in terms of perception of their hue and lightness (or brightness) and saturation. - - Color-shade - A slight degree of difference between colors, especially with regard to how light or dark it is or as distinguished from one nearly like it. - - Dark-shade - A color tone not reflecting much light. - - - Light-shade - A color tone reflecting more light. - - - - HSV-color - A color representation that models how colors appear under light. - - Hue - Attribute of a visual sensation according to which an area appears to be similar to one of the perceived colors. - - # - Angular value between 0 and 360 - - isNumeric - - - takesValue - - - - - Saturation - Colorfulness of a stimulus relative to its own brightness. - - # - B value of RGB between 0 and 1 - - isNumeric - - - takesValue - - - - - HSV-value - AAttribute of a visual sensation according to which an area appears to emit more or less light. - - # - - isNumeric - - - takesValue - - - - - - RGB-color - - RGB-red - - # - R value of RGB between 0 and 1 - - isNumeric - - - takesValue - - - - - RGB-blue - - # - B value of RGB between 0 and 1 - - isNumeric - - - takesValue - - - - - RGB-green - - # - G value of RGB between 0 and 1 - - isNumeric - - - takesValue - - - - - - Grayscale - Using a color map composed of shades of gray, varying from black at the weakest intensity to white at the strongest. - - # - White intensity between 0 and 1 - - isNumeric - - - takesValue - - - - - CSS-color - One of 140 colors supported by all browsers. For more details such as the color RGB or HEX values, check: https://www.w3schools.com/colors/colors_groups.asp - - Blue-color - CSS color group - - CadetBlue - CSS-color 0x5F9EA0 - - - SteelBlue - CSS-color 0x4682B4 - - - LightSteelBlue - CSS-color 0xB0C4DE - - - LightBlue - CSS-color 0xADD8E6 - - - PowderBlue - CSS-color 0xB0E0E6 - - - LightSkyBlue - CSS-color 0x87CEFA - - - SkyBlue - CSS-color 0x87CEEB - - - CornflowerBlue - CSS-color 0x6495ED - - - DeepSkyBlue - CSS-color 0x00BFFF - - - DodgerBlue - CSS-color 0x1E90FF - - - RoyalBlue - CSS-color 0x4169E1 - - - Blue - CSS-color 0x0000FF - - - MediumBlue - CSS-color 0x0000CD - - - DarkBlue - CSS-color 0x00008B - - - Navy - CSS-color 0x000080 - - - MidnightBlue - CSS-color 0x191970 - - - - Brown-color - CSS color group - - Cornsilk - CSS-color 0xFFF8DC - - - BlanchedAlmond - CSS-color 0xFFEBCD - - - Bisque - CSS-color 0xFFE4C4 - - - NavajoWhite - CSS-color 0xFFDEAD - - - Wheat - CSS-color 0xF5DEB3 - - - BurlyWood - CSS-color 0xDEB887 - - - Tan - CSS-color 0xD2B48C - - - RosyBrown - CSS-color 0xBC8F8F - - - SandyBrown - CSS-color 0xF4A460 - - - GoldenRod - CSS-color 0xDAA520 - - - DarkGoldenRod - CSS-color 0xB8860B - - - Peru - CSS-color 0xCD853F - - - Chocolate - CSS-color 0xD2691E - - - Olive - CSS-color 0x808000 - - - SaddleBrown - CSS-color 0x8B4513 - - - Sienna - CSS-color 0xA0522D - - - Brown - CSS-color 0xA52A2A - - - Maroon - CSS-color 0x800000 - - - - Cyan-color - CSS color group - - Aqua - CSS-color 0x00FFFF - - - Cyan - CSS-color 0x00FFFF - - - LightCyan - CSS-color 0xE0FFFF - - - PaleTurquoise - CSS-color 0xAFEEEE - - - Aquamarine - CSS-color 0x7FFFD4 - - - Turquoise - CSS-color 0x40E0D0 - - - MediumTurquoise - CSS-color 0x48D1CC - - - DarkTurquoise - CSS-color 0x00CED1 - - - - Green-color - CSS color group - - GreenYellow - CSS-color 0xADFF2F - - - Chartreuse - CSS-color 0x7FFF00 - - - LawnGreen - CSS-color 0x7CFC00 - - - Lime - CSS-color 0x00FF00 - - - LimeGreen - CSS-color 0x32CD32 - - - PaleGreen - CSS-color 0x98FB98 - - - LightGreen - CSS-color 0x90EE90 - - - MediumSpringGreen - CSS-color 0x00FA9A - - - SpringGreen - CSS-color 0x00FF7F - - - MediumSeaGreen - CSS-color 0x3CB371 - - - SeaGreen - CSS-color 0x2E8B57 - - - ForestGreen - CSS-color 0x228B22 - - - Green - CSS-color 0x008000 - - - DarkGreen - CSS-color 0x006400 - - - YellowGreen - CSS-color 0x9ACD32 - - - OliveDrab - CSS-color 0x6B8E23 - - - DarkOliveGreen - CSS-color 0x556B2F - - - MediumAquaMarine - CSS-color 0x66CDAA - - - DarkSeaGreen - CSS-color 0x8FBC8F - - - LightSeaGreen - CSS-color 0x20B2AA - - - DarkCyan - CSS-color 0x008B8B - - - Teal - CSS-color 0x008080 - - - - Gray-color - CSS color group - - Gainsboro - CSS-color 0xDCDCDC - - - LightGray - CSS-color 0xD3D3D3 - - - Silver - CSS-color 0xC0C0C0 - - - DarkGray - CSS-color 0xA9A9A9 - - - DimGray - CSS-color 0x696969 - - - Gray - CSS-color 0x808080 - - - LightSlateGray - CSS-color 0x778899 - - - SlateGray - CSS-color 0x708090 - - - DarkSlateGray - CSS-color 0x2F4F4F - - - Black - CSS-color 0x000000 - - - - Orange-color - CSS color group - - Orange - CSS-color 0xFFA500 - - - DarkOrange - CSS-color 0xFF8C00 - - - Coral - CSS-color 0xFF7F50 - - - Tomato - CSS-color 0xFF6347 - - - OrangeRed - CSS-color 0xFF4500 - - - - Pink-color - CSS color group - - Pink - CSS-color 0xFFC0CB - - - LightPink - CSS-color 0xFFB6C1 - - - HotPink - CSS-color 0xFF69B4 - - - DeepPink - CSS-color 0xFF1493 - - - PaleVioletRed - CSS-color 0xDB7093 - - - MediumVioletRed - CSS-color 0xC71585 - - - - Purple-color - CSS color group - - Lavender - CSS-color 0xE6E6FA - - - Thistle - CSS-color 0xD8BFD8 - - - Plum - CSS-color 0xDDA0DD - - - Orchid - CSS-color 0xDA70D6 - - - Violet - CSS-color 0xEE82EE - - - Fuchsia - CSS-color 0xFF00FF - - - Magenta - CSS-color 0xFF00FF - - - MediumOrchid - CSS-color 0xBA55D3 - - - DarkOrchid - CSS-color 0x9932CC - - - DarkViolet - CSS-color 0x9400D3 - - - BlueViolet - CSS-color 0x8A2BE2 - - - DarkMagenta - CSS-color 0x8B008B - - - Purple - CSS-color 0x800080 - - - MediumPurple - CSS-color 0x9370DB - - - MediumSlateBlue - CSS-color 0x7B68EE - - - SlateBlue - CSS-color 0x6A5ACD - - - DarkSlateBlue - CSS-color 0x483D8B - - - RebeccaPurple - CSS-color 0x663399 - - - Indigo - CSS-color 0x4B0082 - - - - Red-color - CSS color group - - LightSalmon - CSS-color 0xFFA07A - - - Salmon - CSS-color 0xFA8072 - - - DarkSalmon - CSS-color 0xE9967A - - - LightCoral - CSS-color 0xF08080 - - - IndianRed - CSS-color 0xCD5C5C - - - Crimson - CSS-color 0xDC143C - - - Red - CSS-color 0xFF0000 - - - FireBrick - CSS-color 0xB22222 - - - DarkRed - CSS-color 0x8B0000 - - - - Yellow-color - CSS color group - - Gold - CSS-color 0xFFD700 - - - Yellow - CSS-color 0xFFFF00 - - - LightYellow - CSS-color 0xFFFFE0 - - - LemonChiffon - CSS-color 0xFFFACD - - - LightGoldenRodYellow - CSS-color 0xFAFAD2 - - - PapayaWhip - CSS-color 0xFFEFD5 - - - Moccasin - CSS-color 0xFFE4B5 - - - PeachPuff - CSS-color 0xFFDAB9 - - - PaleGoldenRod - CSS-color 0xEEE8AA - - - Khaki - CSS-color 0xF0E68C - - - DarkKhaki - CSS-color 0xBDB76B - - - - White-color - CSS color group - - White - CSS-color 0xFFFFFF - - - Snow - CSS-color 0xFFFAFA - - - HoneyDew - CSS-color 0xF0FFF0 - - - MintCream - CSS-color 0xF5FFFA - - - Azure - CSS-color 0xF0FFFF - - - AliceBlue - CSS-color 0xF0F8FF - - - GhostWhite - CSS-color 0xF8F8FF - - - WhiteSmoke - CSS-color 0xF5F5F5 - - - SeaShell - CSS-color 0xFFF5EE - - - Beige - CSS-color 0xF5F5DC - - - OldLace - CSS-color 0xFDF5E6 - - - FloralWhite - CSS-color 0xFFFAF0 - - - Ivory - CSS-color 0xFFFFF0 - - - AntiqueWhite - CSS-color 0xFAEBD7 - - - Linen - CSS-color 0xFAF0E6 - - - LavenderBlush - CSS-color 0xFFF0F5 - - - MistyRose - CSS-color 0xFFE4E1 - - - - - - View - A specific visual representation of data, situations, topics, etc. - - 2D-view - A view showing only two dimensions. - - - 3D-view - A view showing three dimensions. - - - Background-view - Parts of the view that are farthest from the viewer and usually the not part of the visual focus. - - - Bistable-view - Something having two stable visual forms that have two distinguishable stable forms as in optical illusions. - - - Foreground-view - Parts of the view that are closest to the viewer and usually the most important part of the visual focus. - - - Foveal-view - Visual presentation directly on the fovea. A view projected on the small depression in the retina containing only cones and where vision is most acute. - - - Map-view - A diagrammatic representation of an area of land or sea showing physical features, cities, roads. - - Aerial-view - Elevated view of an object from above, with a perspective as though the observer were a bird. - - - Satellite-view - A representation as captured by technology such as a satellite. - - - Street-view - A 360-degrees panoramic view from a position on the ground. - - - - Peripheral-view - Indirect vision as it occurs outside the point of fixation. - - - - - - Environmental - Relating to or arising from the surroundings of an agent. - - Indoors - Located inside a building or enclosure. - - - Outdoors - Any area outside a building or shelter. - - - Real-world - Located in a place that exists in real space and time under realistic conditions. - - - Virtual-world - Using technology that creates immersive, computer-generated experiences that a person can interact with and navigate through. The digital content is generally delivered to the user through some type of headset and responds to changes in head position or through interaction with other types of sensors. Existing in a virtual setting such as a simulation or game environment. - - - Augmented-reality - Using technology that enhances real-world experiences with computer-derived digital overlays to change some aspects of perception of the natural environment. The digital content is shown to the user through a smart device or glasses and responds to changes in the environment. - - - Motion-platform - A mechanism that creates the feelings of being in a real motion environment. - - - Urban - Relating to, located in, or characteristic of a city or densely populated area. - - - Rural - Of or pertaining to the country as opposed to the city. - - Wooden-walkway - A path made out of wood. - - - - Terrain - Characterization of the physical features of a tract of land. - - Composite-terrain - Tracts of land characterized by a mixure of physical features. - - - Dirt-terrain - Tracts of land characterized by a soil surface and lack of vegetation. - - - Grassy-terrain - Tracts of land covered by grass. - - - Gravel-terrain - Tracts of land covered by a surface consisting a loose aggregation of small water-worn or pounded stones. - - - Leaf-covered-terrain - Tracts of land covered by leaves and composited organic material. - - - Muddy-terrain - Tracts of land covered by a liquid or semi-liquid mixture of water and some combination of soil, silt, and clay. - - - Paved-terrain - Tracts of land covered with concrete, asphalt, stones, or bricks. - - - Rocky-terrain - Tracts of land consisting or full of rock or rocks. - - - Sloped-terrain - Tracts of land arranged in a sloping position; inclined. - - - Uneven-terrain - Tracts of land that are not level, smooth, or regular. - - - - - Anatomical - Relating to bodily structure. - - - - - acceleration - - defaultUnits - m-per-s^2 - - - m-per-s^2 - - SIUnit - - - unitSymbol - - - - - angle - - defaultUnits - radian - - - radian - - SIUnit - - - - rad - - SIUnit - - - unitSymbol - - - - degree - - - - area - - defaultUnits - m^2 - - - m^2 - - SIUnit - - - unitSymbol - - - - px^2 - - unitSymbol - - - - pixel^2 - - - - currency - - allowedCharacter - $ - - - defaultUnits - $ - - - dollar - - - $ - - unitPrefix - - - unitSymbol - - - - point - - - - dateTime - - allowedCharacter - : - - - - - defaultUnits - YYYY-MM-DDThh:mm:ss - - - YYYY-MM-DDThh:mm:ss - Date-times should conform to ISO8601 date-time format. Any variation on the full form is allowed. - - - - frequency - - defaultUnits - Hz - - - hertz - - SIUnit - - - - Hz - - SIUnit - - - unitSymbol - - - - - intensity - - defaultUnits - dB - - - dB - - unitSymbol - - - - - jerk - - defaultUnits - m-per-s^3 - - - m-per-s^3 - - unitSymbol - - - - - luminousIntensity - - defaultUnits - cd - - - candela - - SIUnit - - - - cd - - SIUnit - - - unitSymbol - - - - - memorySize - - defaultUnits - B - - - byte - - SIUnit - - - - B - - SIUnit - - - unitSymbol - - - - - posixPath - Posix path specification. - - allowedCharacter - / - : - - - - physicalLength - - defaultUnits - m - - - metre - - SIUnit - - - - m - - SIUnit - - - unitSymbol - - - - foot - - - mile - - - - pixels - - defaultUnits - px - - - pixel - - - px - - unitSymbol - - - - - speed - - defaultUnits - m-per-s - - - m-per-s - - SIUnit - - - unitSymbol - - - - mph - - unitSymbol - - - - kph - - unitSymbol - - - - - time - - defaultUnits - s - - - second - - SIUnit - - - - s - - SIUnit - - - unitSymbol - - - - day - - - minute - - - hour - Should be in 24-hour format. - - - - volume - - defaultUnits - m^3 - - - m^3 - - SIUnit - - - unitSymbol - - - - - - - deca - SI unit multiple representing 10^1 - - SIUnitModifier - - - - da - SI unit multiple representing 10^1 - - SIUnitSymbolModifier - - - - hecto - SI unit multiple representing 10^2 - - SIUnitModifier - - - - h - SI unit multiple representing 10^2 - - SIUnitSymbolModifier - - - - kilo - SI unit multiple representing 10^3 - - SIUnitModifier - - - - k - SI unit multiple representing 10^3 - - SIUnitSymbolModifier - - - - mega - SI unit multiple representing 10^6 - - SIUnitModifier - - - - M - SI unit multiple representing 10^6 - - SIUnitSymbolModifier - - - - giga - SI unit multiple representing 10^9 - - SIUnitModifier - - - - G - SI unit multiple representing 10^9 - - SIUnitSymbolModifier - - - - tera - SI unit multiple representing 10^12 - - SIUnitModifier - - - - T - SI unit multiple representing 10^12 - - SIUnitSymbolModifier - - - - peta - SI unit multiple representing 10^15 - - SIUnitModifier - - - - P - SI unit multiple representing 10^15 - - SIUnitSymbolModifier - - - - exa - SI unit multiple representing 10^18 - - SIUnitModifier - - - - E - SI unit multiple representing 10^18 - - SIUnitSymbolModifier - - - - zetta - SI unit multiple representing 10^21 - - SIUnitModifier - - - - Z - SI unit multiple representing 10^21 - - SIUnitSymbolModifier - - - - yotta - SI unit multiple representing 10^24 - - SIUnitModifier - - - - Y - SI unit multiple representing 10^24 - - SIUnitSymbolModifier - - - - deci - SI unit submultiple representing 10^-1 - - SIUnitModifier - - - - d - SI unit submultiple representing 10^-1 - - SIUnitSymbolModifier - - - - centi - SI unit submultiple representing 10^-2 - - SIUnitModifier - - - - c - SI unit submultiple representing 10^-2 - - SIUnitSymbolModifier - - - - milli - SI unit submultiple representing 10^-3 - - SIUnitModifier - - - - m - SI unit submultiple representing 10^-3 - - SIUnitSymbolModifier - - - - micro - SI unit submultiple representing 10^-6 - - SIUnitModifier - - - - u - SI unit submultiple representing 10^-6 - - SIUnitSymbolModifier - - - - nano - SI unit submultiple representing 10^-9 - - SIUnitModifier - - - - n - SI unit submultiple representing 10^-9 - - SIUnitSymbolModifier - - - - pico - SI unit submultiple representing 10^-12 - - SIUnitModifier - - - - p - SI unit submultiple representing 10^-12 - - SIUnitSymbolModifier - - - - femto - SI unit submultiple representing 10^-15 - - SIUnitModifier - - - - f - SI unit submultiple representing 10^-15 - - SIUnitSymbolModifier - - - - atto - SI unit submultiple representing 10^-18 - - SIUnitModifier - - - - a - SI unit submultiple representing 10^-18 - - SIUnitSymbolModifier - - - - zepto - SI unit submultiple representing 10^-21 - - SIUnitModifier - - - - z - SI unit submultiple representing 10^-21 - - SIUnitSymbolModifier - - - - yocto - SI unit submultiple representing 10^-24 - - SIUnitModifier - - - - y - SI unit submultiple representing 10^-24 - - SIUnitSymbolModifier - - - - - - allowedCharacter - A schema attribute of unit classes specifying a special character that is allowed in expressing the value of a placeholder with those units. - - unitClassProperty - - - - defaultUnits - A schema attribute of unit classes specifying the default units for a tag. - - unitClassProperty - - - - extensionAllowed - A schema attribute indicating that users can add unlimited levels of child nodes under this tag. - - boolProperty - - - - isNumeric - A schema attribute indicating that the tag hashtag placeholder must be replaced by a numerical value. - - boolProperty - - - - recommended - A schema attribute indicating that the event-level HED string should include this tag. - - boolProperty - - - - relatedTag - A schema attribute suggesting HED tags that are closely related to this tag. This attribute is used by tagging tools. - - - requireChild - A schema attribute indicating that one of the node elements descendants must be included when using this tag. - - boolProperty - - - - required - A schema attribute indicating that every event-level HED string should include this tag. - - boolProperty - - - - SIUnit - A schema attribute indicating that this unit element is an SI unit and can be modified by multiple and submultiple names. Note that some units such as byte are designated as SI units although they are not part of the standard. - - boolProperty - - - unitProperty - - - - SIUnitModifier - A schema attribute indicating that this SI unit modifier represents a multiple or submultiple of a base unit rather than a unit symbol. - - boolProperty - - - unitModifierProperty - - - - SIUnitSymbolModifier - A schema attribute indicating that this SI unit modifier represents a multiple or submultiple of a unit symbol rather than a base symbol. - - boolProperty - - - unitModifierProperty - - - - suggestedTag - A schema attribute that indicates another tag that is often associated with this tag. This attribute is used by tagging tools to provide tagging suggestions. - - - tagGroup - A schema attribute indicating the tag can only appear inside a tag group. - - boolProperty - - - - takesValue - A schema attribute indicating the tag is a hashtag placeholder which is expected to be replaced with a user-defined value. - - boolProperty - - - - topLevelTagGroup - A schema attribute indicating that this tag (or its descendants) can only appear in a top-level tag group. - - boolProperty - - - - unique - A schema attribute indicating that only one of this tag or its descendants can be used in the event-level HED string. - - boolProperty - - - - unitClass - A schema attribute specifying which unit class this value tag belongs to. - - - unitPrefix - A schema attribute applied specifically to unit elements to designate that the unit indicator is a prefix (e.g., dollar sign in the currency units). - - boolProperty - - - unitProperty - - - - unitSymbol - A schema attribute indicating this tag is an abbreviation or symbol representing a type of unit. Unit symbols represent both the singular and the plural and thus cannot be pluralized. - - boolProperty - - - unitProperty - - - - This is the new format for the mediawiki schema. The schema attributes are designed to be checked in software rather than hard-coded. The schema attributes, themselves have properties. These are: -* boolProperty - indicates that that attribute represents something that is either true or false and does not have a value. Attributes without this value are assumed to have string values. -* unitClassProperty - indicates that this attribute is designed to be applied to unit classes. -* unitModifierProperty - indicates that this attribute is designed to be applied to unit classes. -* unitProperty - indicates that this a applies to units within a unit class. - diff --git a/tests/data/HED8.0.0.xml b/tests/data/HED8.0.0.xml new file mode 100644 index 00000000..24a5241a --- /dev/null +++ b/tests/data/HED8.0.0.xml @@ -0,0 +1,6524 @@ + + + This schema is the first official release that includes an xsd and requires unit class, unit modifier, value class, schema attribute and property sections. + + + + Event + Something that happens at a given time and (typically) place. Elements of this tag subtree designate the general category in which an event falls. + + suggestedTag + Task-property + + + Sensory-event + Something perceivable by the participant. An event meant to be an experimental stimulus should include the tag Task-property/Task-event-role/Experimental-stimulus. + + suggestedTag + Task-event-role + Attribute/Sensory + + + + Agent-action + Any action engaged in by an agent (see the Agent subtree for agent categories). A participant response to an experiment stimulus should include the tag Agent-property/Agent-task-role/Experiment-participant. + + suggestedTag + Task-event-role + Agent + + + + Data-feature + An event marking the occurrence of a data feature such as an interictal spike or alpha burst that is often added post hoc to the data record. + + suggestedTag + Data-property + + + + Experiment-control + An event pertaining to the physical control of the experiment during its operation. + + + Experiment-procedure + An event indicating an experimental procedure, as in performing a saliva swab during the experiment or administering a survey. + + + Experiment-structure + An event specifying a change-point of the structure of experiment. This event is typically used to indicate a change in experimental conditions or tasks. + + + Measurement-event + A discrete measure returned by an instrument. + + suggestedTag + Data-property + + + + + Agent + Someone or something that takes an active role or produces a specified effect.The role or effect may be implicit. Being alive or performing an activity such as a computation may qualify something to be an agent. An agent may also be something that simulates something else. + + suggestedTag + Agent-property + + + Animal-agent + An agent that is an animal. + + + Avatar-agent + An agent associated with an icon or avatar representing another agent. + + + Controller-agent + An agent experiment control software or hardware. + + + Human-agent + A person who takes an active role or produces a specified effect. + + + Robotic-agent + An agent mechanical device capable of performing a variety of often complex tasks on command or by being programmed in advance. + + + Software-agent + An agent computer program. + + + + Action + Do something. + + extensionAllowed + + + Communicate + Convey knowledge of or information about something. + + Communicate-gesturally + Communicate nonverbally using visible bodily actions, either in place of speech or together and in parallel with spoken words. Gestures include movement of the hands, face, or other parts of the body. + + relatedTag + Move-face + Move-upper-extremity + + + Clap-hands + Strike the palms of against one another resoundingly, and usually repeatedly, especially to express approval. + + + Clear-throat + Cough slightly so as to speak more clearly, attract attention, or to express hesitancy before saying something awkward. + + relatedTag + Move-face + Move-head + + + + Frown + Express disapproval, displeasure, or concentration, typically by turning down the corners of the mouth. + + relatedTag + Move-face + + + + Grimace + Make a twisted expression, typically expressing disgust, pain, or wry amusement. + + relatedTag + Move-face + + + + Nod-head + Tilt head in alternating up and down arcs along the sagittal plane. It is most commonly, but not universally, used to indicate agreement, acceptance, or acknowledgement. + + relatedTag + Move-head + + + + Pump-fist + Raise with fist clenched in triumph or affirmation. + + relatedTag + Move-upper-extremity + + + + Raise-eyebrows + Move eyebrows upward. + + relatedTag + Move-face + Move-eyes + + + + Shake-fist + Clench hand into a fist and shake to demonstrate anger. + + relatedTag + Move-upper-extremity + + + + Shake-head + Turn head from side to side as a way of showing disagreement or refusal. + + relatedTag + Move-head + + + + Shhh + Place finger over lips and possibly uttering the syllable shhh to indicate the need to be quiet. + + relatedTag + Move-upper-extremity + + + + Shrug + Lift shoulders up towards head to indicate a lack of knowledge about a particular topic. + + relatedTag + Move-upper-extremity + Move-torso + + + + Smile + Form facial features into a pleased, kind, or amused expression, typically with the corners of the mouth turned up and the front teeth exposed. + + relatedTag + Move-face + + + + Spread-hands + Spread hands apart to indicate ignorance. + + relatedTag + Move-upper-extremity + + + + Thumbs-down + Extend the thumb downward to indicate disapproval. + + relatedTag + Move-upper-extremity + + + + Thumb-up + Extend the thumb upward to indicate approval. + + relatedTag + Move-upper-extremity + + + + Wave + Raise hand and move left and right, as a greeting or sign of departure. + + relatedTag + Move-upper-extremity + + + + Widen-eyes + Open eyes and possibly with eyebrows lifted especially to express surprise or fear. + + relatedTag + Move-face + Move-eyes + + + + Wink + Close and open one eye quickly, typically to indicate that something is a joke or a secret or as a signal of affection or greeting. + + relatedTag + Move-face + Move-eyes + + + + + Communicate-musically + Communicate using music. + + Hum + Make a low, steady continuous sound like that of a bee. Sing with the lips closed and without uttering speech. + + + Play-instrument + Make musical sounds using an instrument. + + + Sing + Produce musical tones by means of the voice. + + + Vocalize + Utter vocal sounds. + + + Whistle + Produce a shrill clear sound by forcing breath out or air in through the puckered lips. + + + + Communicate-vocally + Communicate using mouth or vocal cords. + + Cry + Shed tears associated with emotions, usually sadness but also joy or frustration. + + + Groan + Make a deep inarticulate sound in response to pain or despair. + + + Laugh + Make the spontaneous sounds and movements of the face and body that are the instinctive expressions of lively amusement and sometimes also of contempt or derision. + + + Scream + Make loud, vociferous cries or yells to express pain, excitement, or fear. + + + Shout + Say something very loudly. + + + Sigh + Emit a long, deep, audible breath expressing sadness, relief, tiredness, or a similar feeling. + + + Speak + Communicate using spoken language. + + + Whisper + Speak very softly using breath without vocal cords. + + + + + Move + Move in a specified direction or manner. Change position or posture. + + Breathe + Inhale or exhale during respiration. + + Blow + Expel air through pursed lips. + + + Cough + Suddenly and audibly expel air from the lungs through a partially closed glottis, preceded by inhalation. + + + Exhale + Blow out or expel breath. + + + Hiccup + Involuntarily spasm the diaphragm and respiratory organs, with a sudden closure of the glottis and a characteristic sound like that of a cough. + + + Hold-breath + Interrupt normal breathing by ceasing to inhale or exhale. + + + Inhale + Draw in with the breath through the nose or mouth. + + + Sneeze + Suddenly and violently expel breath through the nose and mouth. + + + Sniff + Draw in air audibly through the nose to detect a smell, to stop it from running, or to express contempt. + + + + Move-body + Move entire body. + + Bend + Move body in a bowed or curved manner. + + + Dance + Perform a purposefully selected sequences of human movement often with aesthetic or symbolic value. Move rhythmically to music, typically following a set sequence of steps. + + + Fall-down + Lose balance and collapse. + + + Flex + Cause a muscle to stand out by contracting or tensing it. Bend a limb or joint. + + + Jerk + Make a quick, sharp, sudden movement. + + + Lie-down + Move to a horizontal or resting position. + + + Recover-balance + Return to a stable, upright body position. + + + Sit-down + Move from a standing to a sitting position. + + + Sit-up + Move from lying down to a sitting position. + + + Stand-up + Move from a sitting to a standing position. + + + Stretch + Straighten or extend body or a part of body to its full length, typically so as to tighten muscles or in order to reach something. + + + Shudder + Tremble convulsively, sometimes as a result of fear or revulsion. + + + Stumble + Trip or momentarily lose balance and almost fall. + + + Turn + Change or cause to change direction. + + + + Move-body-part + Move one part of a body. + + Move-eyes + Move eyes. + + Blink + Shut and open the eyes quickly. + + + Close-eyes + Lower and keep eyelids in a closed position. + + + Fixate + Direct eyes to a specific point or target. + + + Inhibit-blinks + Purposely prevent blinking. + + + Open-eyes + Raise eyelids to expose pupil. + + + Saccade + Move eyes rapidly between fixation points. + + + Squint + Squeeze one or both eyes partly closed in an attempt to see more clearly or as a reaction to strong light. + + + Stare + Look fixedly or vacantly at someone or something with eyes wide open. + + + + Move-face + Move the face or jaw. + + Bite + Seize with teeth or jaws an object or organism so as to grip or break the surface covering. + + + Burp + Noisily release air from the stomach through the mouth. Belch. + + + Chew + Repeatedly grinding, tearing, and or crushing with teeth or jaws. + + + Gurgle + Make a hollow bubbling sound like that made by water running out of a bottle. + + + Swallow + Cause or allow something, especially food or drink to pass down the throat. + + Gulp + Swallow quickly or in large mouthfuls, often audibly, sometimes to indicate apprehension. + + + + Yawn + Take a deep involuntary inhalation with the mouth open often as a sign of drowsiness or boredom. + + + + Move-head + Move head. + + Lift-head + Tilt head back lifting chin. + + + Lower-head + Move head downward so that eyes are in a lower position. + + + Turn-head + Rotate head horizontally to look in a different direction. + + + + Move-lower-extremity + Move leg and/or foot. + + Curl-toes + Bend toes sometimes to grip. + + + Hop + Jump on one foot. + + + Jog + Run at a trot to exercise. + + + Jump + Move off the ground or other surface through sudden muscular effort in the legs. + + + Kick + Strike out or flail with the foot or feet. Strike using the leg, in unison usually with an area of the knee or lower using the foot. + + + Pedal + Move by working the pedals of a bicycle or other machine. + + + Press-foot + Move by pressing foot. + + + Run + Travel on foot at a fast pace. + + + Step + Put one leg in front of the other and shift weight onto it. + + Heel-strike + Strike the ground with the heel during a step. + + + Toe-off + Push with toe as part of a stride. + + + + Trot + Run at a moderate pace, typically with short steps. + + + Walk + Move at a regular pace by lifting and setting down each foot in turn never having both feet off the ground at once. + + + + Move-torso + Move body trunk. + + + Move-upper-extremity + Move arm, shoulder, and/or hand. + + Drop + Let or cause to fall vertically. + + + Grab + Seize suddenly or quickly. Snatch or clutch. + + + Grasp + Seize and hold firmly. + + + Hold-down + Prevent someone or something from moving by holding them firmly. + + + Lift + Raising something to higher position. + + + Make-fist + Close hand tightly with the fingers bent against the palm. + + + Point + Draw attention to something by extending a finger or arm. + + + Press + Apply pressure to something to flatten, shape, smooth or depress it. This action tag should be used to indicate key presses and mouse clicks. + + relatedTag + Push + + + + Push + Apply force in order to move something away. Use Press to indicate a key press or mouse click. + + relatedTag + Press + + + + Reach + Stretch out your arm in order to get or touch something. + + + Release + Make available or set free. + + + Retract + Draw or pull back. + + + Scratch + Drag claws or nails over a surface or on skin. + + + Snap-fingers + Make a noise by pushing second finger hard against thumb and then releasing it suddenly so that it hits the base of the thumb. + + + Touch + Come into or be in contact with. + + + + + + Perceive + Produce an internal, conscious image through stimulating a sensory system. + + Hear + Give attention to a sound. + + + See + Direct gaze toward someone or something or in a specified direction. + + + Smell + Inhale in order to ascertain an odor or scent. + + + Taste + Sense a flavor in the mouth and throat on contact with a substance. + + + Sense-by-touch + Sense something through receptors in the skin. + + + + Perform + Carry out or accomplish an action, task, or function. + + Close + Act as to blocked against entry or passage. + + + Collide-with + Hit with force when moving. + + + Halt + Bring or come to an abrupt stop. + + + Modify + Change something. + + + Open + Widen an aperture, door, or gap, especially one allowing access to something. + + + Operate + Control the functioning of a machine, process, or system. + + + Play + Engage in activity for enjoyment and recreation rather than a serious or practical purpose. + + + Read + Interpret something that is written or printed. + + + Repeat + Make do or perform again. + + + Rest + Be inactive in order to regain strength, health, or energy. + + + Write + Communicate or express by means of letters or symbols written or imprinted on a surface. + + + + Think + Direct the mind toward someone or something or use the mind actively to form connected ideas. + + Allow + Allow access to something such as allowing a car to pass. + + + Attend-to + Focus mental experience on specific targets. + + + Count + Tally items either silently or aloud. + + + Deny + Refuse to give or grant something requested or desired by someone. + + + Detect + Discover or identify the presence or existence of something. + + + Discriminate + Recognize a distinction. + + + Encode + Convert information or an instruction into a particular form. + + + Evade + Escape or avoid, especially by cleverness or trickery. + + + Generate + Cause something, especially an emotion or situation to arise or come about. + + + Identify + Establish or indicate who or what someone or something is. + + + Imagine + Form a mental image or concept of something. + + + Judge + Evaluate evidence to make a decision or form a belief. + + + Learn + Adaptively change behavior as the result of experience. + + + Memorize + Adaptively change behavior as the result of experience. + + + Plan + Think about the activities required to achieve a desired goal. + + + Predict + Say or estimate that something will happen or will be a consequence of something without having exact informaton. + + + Recognize + Identify someone or something from having encountered them before. + + + Respond + React to something such as a treatment or a stimulus. + + + Recall + Remember information by mental effort. + + + Switch-attention + Transfer attention from one focus to another. + + + Track + Follow a person, animal, or object through space or time. + + + + + Item + An independently existing thing (living or nonliving). + + extensionAllowed + + + Biological-item + An entity that is biological, that is related to living organisms. + + Anatomical-item + A biological structure, system, fluid or other substance excluding single molecular entities. + + Body-part + Any part of an organism. + + Head + The upper part of the human body, or the front or upper part of the body of an animal, typically separated from the rest of the body by a neck, and containing the brain, mouth, and sense organs. + + Hair + The filamentous outgrowth of the epidermis. + + + Ear + A sense organ needed for the detection of sound and for establishing balance. + + + Face + The anterior portion of the head extending from the forehead to the chin and ear to ear. The facial structures contain the eyes, nose and mouth, cheeks and jaws. + + Cheek + The fleshy part of the face bounded by the eyes, nose, ear, and jaw line. + + + Chin + The part of the face below the lower lip and including the protruding part of the lower jaw. + + + Eye + The organ of sight or vision. + + + Eyebrow + The arched strip of hair on the bony ridge above each eye socket. + + + Forehead + The part of the face between the eyebrows and the normal hairline. + + + Lip + Fleshy fold which surrounds the opening of the mouth. + + + Nose + A structure of special sense serving as an organ of the sense of smell and as an entrance to the respiratory tract. + + + Mouth + The proximal portion of the digestive tract, containing the oral cavity and bounded by the oral opening. + + + Teeth + The hard bonelike structures in the jaws. A collection of teeth arranged in some pattern in the mouth or other part of the body. + + + + + Lower-extremity + Refers to the whole inferior limb (leg and/or foot). + + Ankle + A gliding joint between the distal ends of the tibia and fibula and the proximal end of the talus. + + + Calf + The fleshy part at the back of the leg below the knee. + + + Foot + The structure found below the ankle joint required for locomotion. + + Big-toe + The largest toe on the inner side of the foot. + + + Heel + The back of the foot below the ankle. + + + Instep + The part of the foot between the ball and the heel on the inner side. + + + Little-toe + The smallest toe located on the outer side of the foot. + + + Toes + The terminal digits of the foot. + + + + Knee + A joint connecting the lower part of the femur with the upper part of the tibia. + + + Shin + Front part of the leg below the knee. + + + Thigh + Upper part of the leg between hip and knee. + + + + Torso + The body excluding the head and neck and limbs. + + Torso-back + The rear surface of the human body from the shoulders to the hips. + + + Buttocks + The round fleshy parts that form the lower rear area of a human trunk. + + + Torso-chest + The anterior side of the thorax from the neck to the abdomen. + + + Gentalia + The external organs of reproduction. + + + Hip + The lateral prominence of the pelvis from the waist to the thigh. + + + Waist + The abdominal circumference at the navel. + + + + Upper-extremity + Refers to the whole superior limb (shoulder, arm, elbow, wrist, hand). + + Elbow + A type of hinge joint located between the forearm and upper arm. + + + Forearm + Lower part of the arm between the elbow and wrist. + + + Hand + The distal portion of the upper extremity. It consists of the carpus, metacarpus, and digits. + + Finger + Any of the digits of the hand. + + Index-finger + The second finger from the radial side of the hand, next to the thumb. + + + Little-finger + The fifth and smallest finger from the radial side of the hand. + + + Middle-finger + The middle or third finger from the radial side of the hand. + + + Ring-finger + The fourth finger from the radial side of the hand. + + + Thumb + The thick and short hand digit which is next to the index finger in humans. + + + + Palm + The part of the inner surface of the hand that extends from the wrist to the bases of the fingers. + + + Knuckles + A part of a finger at a joint where the bone is near the surface, especially where the finger joins the hand. + + + + Shoulder + Joint attaching upper arm to trunk. + + + Upper-arm + Portion of arm between shoulder and elbow. + + + Wrist + A joint between the distal end of the radius and the proximal row of carpal bones. + + + + + + Organism + A living entity, more specifically a biological entity that consists of one or more cells and is capable of genomic replication (independently or not). + + Animal + A living organism that has membranous cell walls, requires oxygen and organic foods, and is capable of voluntary movement. + + + Human + The bipedal primate mammal Homo sapiens. + + + Plant + Any living organism that typically synthesizes its food from inorganic substances and possesses cellulose cell walls. + + + + + Language-item + An entity related to a systematic means of communicating by the use of sounds, symbols, or gestures. + + suggestedTag + Attribute/Sensory + + + Character + A mark or symbol used in writing. + + + Clause + A unit of grammatical organization next below the sentence in rank, usually consisting of a subject and predicate. + + + Glyph + A hieroglyphic character, symbol, or pictograph. + + + Nonword + A group of letters or speech sounds that looks or sounds like a word but that is not accepted as such by native speakers. + + + Paragraph + A distinct section of a piece of writing, usually dealing with a single theme. + + + Phoneme + A speech sound that is distinguished by the speakers of a particular language. + + + Phrase + A phrase is a group of words functioning as a single unit in the syntax of a sentence. + + + Sentence + A set of words that is complete in itself, conveying a statement, question, exclamation, or command and typically containing an explicit or implied subject and a predicate containing a finite verb. + + + Syllable + A unit of spoken language larger than a phoneme. + + + Textblock + A block of text. + + + Word + A word is the smallest free form (an item that may be expressed in isolation with semantic or pragmatic content) in a language. + + + + Object + Something perceptible by one or more of the senses, especially by vision or touch. A material thing. + + suggestedTag + Attribute/Sensory + + + Geometric-object + An object or a representation that has structure and topology in space. + + Pattern + An arrangement of objects, facts, behaviors, or other things which have scientific, mathematical, geometric, statistical, or other meaning. + + Dots + A small round mark or spot. + + + LED-pattern + A pattern created by lighting selected members of a fixed light emitting diode array. + + + + 2D-shape + A planar, two-dimensional shape. + + Clockface + The dial face of a clock. A location identifier based on clockface numbering or anatomic subregion. + + + Cross + A figure or mark formed by two intersecting lines crossing at their midpoints. + + + Dash + A horizontal stroke in writing or printing to mark a pause or break in sense or to represent omitted letters or words. + + + Ellipse + A closed plane curve resulting from the intersection of a circular cone and a plane cutting completely through it, especially a plane not parallel to the base. + + Circle + A ring-shaped structure with every point equidistant from the center. + + + + Rectangle + A parallelogram with four right angles. + + Square + A square is a special rectangle with four equal sides. + + + + Single-point + A point is a geometric entity that is located in a zero-dimensional spatial region and whose position is defined by its coordinates in some coordinate system. + + + Star + A conventional or stylized representation of a star, typically one having five or more points. + + + Triangle + A three-sided polygon. + + + + 3D-shape + A geometric three-dimensional shape. + + Box + A square or rectangular vessel, usually made of cardboard or plastic. + + Cube + A solid or semi-solid in the shape of a three dimensional square. + + + + Cone + A shape whose base is a circle and whose sides taper up to a point. + + + Cylinder + A surface formed by circles of a given radius that are contained in a plane perpendicular to a given axis, whose centers align on the axis. + + + Ellipsoid + A closed plane curve resulting from the intersection of a circular cone and a plane cutting completely through it, especially a plane not parallel to the base. + + Sphere + A solid or hollow three-dimensional object bounded by a closed surface such that every point on the surface is equidistant from the center. + + + + Pyramid + A polyhedron of which one face is a polygon of any number of sides, and the other faces are triangles with a common vertex. + + + + + Ingestible-object + Something that can be taken into the body by the mouth for digestion or absorption. + + + Man-made-object + Something constructed by human means. + + Building + A structure that has a roof and walls and stands more or less permanently in one place. + + Room + An area within a building enclosed by walls and floor and ceiling. + + + Roof + A roof is the covering on the uppermost part of a building which provides protection from animals and weather, notably rain, but also heat, wind and sunlight. + + + Entrance + The means or place of entry. + + + Attic + A room or a space immediately below the roof of a building. + + + Basement + The part of a building that is wholly or partly below ground level. + + + + Clothing + A covering designed to be worn on the body. + + + Device + An object contrived for a specific purpose. + + Assistive-device + A device that help an individual accomplish a task. + + Glasses + Frames with lenses worn in front of the eye for vision correction, eye protection, or protection from UV rays. + + + Writing-device + A device used for writing. + + Pen + A common writing instrument used to apply ink to a surface for writing or drawing. + + + Pencil + An implement for writing or drawing that is constructed of a narrow solid pigment core in a protective casing that prevents the core from being broken or marking the hand. + + + + + Computing-device + An electronic device which take inputs and processes results from the inputs. + + Cellphone + A telephone with access to a cellular radio system so it can be used over a wide area, without a physical connection to a network. + + + Desktop-computer + A computer suitable for use at an ordinary desk. + + + Laptop-computer + A computer that is portable and suitable for use while traveling. + + + Tablet-computer + A small portable computer that accepts input directly on to its screen rather than via a keyboard or mouse. + + + + Engine + A motor is a machine designed to convert one or more forms of energy into mechanical energy. + + + IO-device + Hardware used by a human (or other system) to communicate with a computer. + + Input-device + A piece of equipment used to provide data and control signals to an information processing system such as a computer or information appliance. + + Computer-mouse + A hand-held pointing device that detects two-dimensional motion relative to a surface. + + Mouse-button + An electric switch on a computer mouse which can be pressed or clicked to select or interact with an element of a graphical user interface. + + + Scroll-wheel + A scroll wheel or mouse wheel is a wheel used for scrolling made of hard plastic with a rubbery surface usually located between the left and right mouse buttons and is positioned perpendicular to the mouse surface. + + + + Joystick + A control device that uses a movable handle to create two-axis input for a computer device. + + + Keyboard + A device consisting of mechanical keys that are pressed to create input to a computer. + + Keyboard-key + A button on a keyboard usually representing letters, numbers, functions, or symbols. + + # + Value of a keyboard key. + + takesValue + + + + + + Keypad + A device consisting of keys, usually in a block arrangement, that provides limited input to a system. + + Keypad-key + A key on a separate section of a computer keyboard that groups together numeric keys and those for mathematical or other special functions in an arrangement like that of a calculator. + + # + Value of keypad key. + + takesValue + + + + + + Microphone + A device designed to convert sound to an electrical signal. + + + Push-button + A switch designed to be operated by pressing a button. + + + + Output-device + Any piece of computer hardware equipment which converts information into human understandable form. + + Display-device + An output device for presentation of information in visual or tactile form the latter used for example in tactile electronic displays for blind people. + + Head-mounted-display + An instrument that functions as a display device, worn on the head or as part of a helmet, that has a small display optic in front of one (monocular HMD) or each eye (binocular HMD). + + + LED-display + A LED display is a flat panel display that uses an array of light-emitting diodes as pixels for a video display. + + + Computer-screen + An electronic device designed as a display or a physical device designed to be a protective meshwork. + + Screen-window + A part of a computer screen that contains a display different from the rest of the screen. A window is a graphical control element consisting of a visual area containing some of the graphical user interface of the program it belongs to and is framed by a window decoration. + + + + + Auditory-device + A device designed to produce sound. + + Headphones + An instrument that consists of a pair of small loudspeakers, or less commonly a single speaker, held close to ears and connected to a signal source such as an audio amplifier, radio, CD player or portable media player. + + + Loudspeaker + A device designed to convert electrical signals to sounds that can be heard. + + + + + Recording-device + A device that copies information in a signal into a persistent information bearer. + + EEG-recorder + A device for recording electric currents in the brain using electrodes applied to the scalp, to the surface of the brain, or placed within the substance of the brain. + + + File-storage + A device for recording digital information to a permanent media. + + + MEG-recorder + A device for measuring the magnetic fields produced by electrical activity in the brain, usually conducted externally. + + + Motion-capture + A device for recording the movement of objects or people. + + + Tape-recorder + A device for recording and reproduction usually using magnetic tape for storage that can be saved and played back. + + + + Touchscreen + A control component that operates an electronic device by pressing the display on the screen. + + + + Machine + A human-made device that uses power to apply forces and control movement to perform an action. + + + Measurement-device + A device in which a measure function inheres. + + Clock + A device designed to indicate the time of day or to measure the time duration of an event or action. + + Clock-face + A location identifier based on clockface numbering or anatomic subregion. + + + + + Robot + A mechanical device that sometimes resembles a living animal and is capable of performing a variety of often complex human tasks on command or by being programmed in advance. + + + Tool + A component that is not part of a device but is designed to support its assemby or operation. + + + + Document + A physical object, or electronic counterpart, that is characterized by containing writing which is meant to be human-readable. + + Letter + A written message addressed to a person or organization. + + + Note + A brief written record. + + + Book + A volume made up of pages fastened along one edge and enclosed between protective covers. + + + Notebook + A book for notes or memoranda. + + + + Furnishing + Furniture, fittings, and other decorative accessories, such as curtains and carpets, for a house or room. + + + Manufactured-material + Substances created or extracted from raw materials. + + Ceramic + A hard, brittle, heat-resistant and corrosion-resistant material made by shaping and then firing a nonmetallic mineral, such as clay, at a high temperature. + + + Glass + A brittle transparent solid with irregular atomic structure. + + + Paper + A thin sheet material produced by mechanically or chemically processing cellulose fibres derived from wood, rags, grasses or other vegetable sources in water. + + + Plastic + Various high-molecular-weight thermoplastic or thermosetting polymers that are capable of being molded, extruded, drawn, or otherwise shaped and then hardened into a form. + + + Steel + An alloy made up of iron with typically a few tenths of a percent of carbon to improve its strength and fracture resistance compared to iron. + + + + Media + Media are audo/visual/audiovisual modes of communicating information for mass consumption. + + Media-clip + A short segment of media. + + Audio-clip + A short segment of audio. + + + Audiovisual-clip + A short media segment containing both audio and video. + + + Video-clip + A short segment of video. + + + + Visualization + An planned process that creates images, diagrams or animations from the input data. + + Animation + A form of graphical illustration that changes with time to give a sense of motion or represent dynamic changes in the portrayal. + + + Art-installation + A large-scale, mixed-media constructions, often designed for a specific place or for a temporary period of time. + + + Braille + A display using a system of raised dots that can be read with the fingers by people who are blind. + + + Image + Any record of an imaging event whether physical or electronic. + + Cartoon + A type of illustration, sometimes animated, typically in a non-realistic or semi-realistic style. The specific meaning has evolved over time, but the modern usage usually refers to either an image or series of images intended for satire, caricature, or humor. A motion picture that relies on a sequence of illustrations for its animation. + + + Drawing + A representation of an object or outlining a figure, plan, or sketch by means of lines. + + + Icon + A sign (such as a word or graphic symbol) whose form suggests its meaning. + + + Painting + A work produced through the art of painting. + + + Photograph + An image recorded by a camera. + + + + Movie + A sequence of images displayed in succession giving the illusion of continuous movement. + + + Outline-visualization + A visualization consisting of a line or set of lines enclosing or indicating the shape of an object in a sketch or diagram. + + + Point-light-visualization + A display in which action is depicted using a few points of light, often generated from discrete sensors in motion capture. + + + Sculpture + A two- or three-dimensional representative or abstract forms, especially by carving stone or wood or by casting metal or plaster. + + + Stick-figure-visualization + A drawing showing the head of a human being or animal as a circle and all other parts as straight lines. + + + + + Navigational-object + An object whose purpose is to assist directed movement from one location to another. + + Path + A trodden way. A way or track laid down for walking or made by continual treading. + + + Road + An open way for the passage of vehicles, persons, or animals on land. + + Lane + A defined path with physical dimensions through which an object or substance may traverse. + + + + Runway + A paved strip of ground on a landing field for the landing and takeoff of aircraft. + + + + Vehicle + A mobile machine which transports people or cargo. + + Aircraft + A vehicle which is able to travel through air in an atmosphere. + + + Bicycle + A human-powered, pedal-driven, single-track vehicle, having two wheels attached to a frame, one behind the other. + + + Boat + A watercraft of any size which is able to float or plane on water. + + + Car + A wheeled motor vehicle used primarily for the transportation of human passengers. + + + Cart + A cart is a vehicle which has two wheels and is designed to transport human passengers or cargo. + + + Tractor + A mobile machine specifically designed to deliver a high tractive effort at slow speeds, and mainly used for the purposes of hauling a trailer or machinery used in agriculture or construction. + + + Train + A connected line of railroad cars with or without a locomotive. + + + Truck + A motor vehicle which, as its primary funcion, transports cargo rather than human passangers. + + + + + Natural-object + Something that exists in or is produced by nature, and is not artificial or man-made. + + Mineral + A solid, homogeneous, inorganic substance occurring in nature and having a definite chemical composition. + + + Natural-feature + A feature that occurs in nature. A prominent or identifiable aspect, region, or site of interest. + + Field + An unbroken expanse as of ice or grassland. + + + Hill + A rounded elevation of limited extent rising above the surrounding land with local relief of less than 300m. + + + Mountain + A landform that extends above the surrounding terrain in a limited area. + + + River + A natural freshwater surface stream of considerable volume and a permanent or seasonal flow, moving in a definite channel toward a sea, lake, or another river. + + + Waterfall + A sudden descent of water over a step or ledge in the bed of a river. + + + + + + Sound + Mechanical vibrations transmitted by an elastic medium. Something that can be heard. + + Environmental-sound + Sounds occuring in the environment. An accumulation of noise pollution that occurs outside. This noise can be caused by transport, industrial, and recreational activities. + + Crowd-sound + Noise produced by a mixture of sounds from a large group of people. + + + Signal-noise + Any part of a signal that is not the true or original signal but is introduced by the communication mechanism. + + + + Musical-sound + Sound produced by continuous and regular vibrations, as opposed to noise. + + Tone + A musical note, warble, or other sound used as a particular signal on a telephone or answering machine. + + + Instrument-sound + Sound produced by a musical instrument. + + + Vocalized-sound + Musical sound produced by vocal cords in a biological agent. + + + + Named-animal-sound + A sound recognizable as being associated with particular animals. + + Barking + Sharp explosive cries like sounds made by certain animals, especially a dog, fox, or seal. + + + Bleating + Wavering cries like sounds made by a sheep, goat, or calf. + + + Crowing + Loud shrill sounds characteristic of roosters. + + + Chirping + Short, sharp, high-pitched noises like sounds made by small birds or an insects. + + + Growling + Low guttural sounds like those that made in the throat by a hostile dog or other animal. + + + Meowing + Vocalizations like those made by as those cats. These sounds have diverse tones and are sometimes chattered, murmured or whispered. The purpose can be assertive. + + + Mooing + Deep vocal sounds like those made by a cow. + + + Purring + Low continuous vibratory sound such as those made by cats. The sound expresses contentment. + + + Roaring + Loud, deep, or harsh prolonged sounds such as those made by big cats and bears for long-distance communication and intimidation. + + + Squawking + Loud, harsh noises such as those made by geese. + + + + Named-object-sound + A sound identifiable as coming from a particular type of object. + + Alarm-sound + A loud signal often loud continuous ringing to alert people to a problem or condition that requires urgent attention. + + + Beep + A short, single tone, that is typically high-pitched and generally made by a computer or other machine. + + + Buzz + A persistent vibratory sound often made by a buzzer device and used to indicate something incorrect. + + + Ka-ching + The sound made by a mechanical cash register, often to designate a reward. + + + Click + The sound made by a mechanical cash register, often to designate a reward. + + + Ding + A short ringing sound such as that made by a bell, often to indicate a correct response or the expiration of time. + + + Horn-blow + A loud sound made by forcing air through a sound device that funnels air to create the sound, often used to sound an alert. + + + Siren + A loud, continuous sound often varying in frequency designed to indicate an emergency. + + + + + + Property + Something that pertains to a thing. A characteristic of some entity. A quality or feature regarded as a characteristic or inherent part of someone or something. HED attributes are adjectives or adverbs. + + extensionAllowed + + + Agent-property + Something that pertains to an agent. + + extensionAllowed + + + Agent-state + The state of the agent. + + Agent-cognitive-state + The state of the cognitive processes or state of mind of the agent. + + Alert + Condition of heightened watchfulness or preparation for action. + + + Anesthetized + Having lost sensation to pain or having senses dulled due to the effects of an anesthetic. + + + Asleep + Having entered a periodic, readily reversible state of reduced awareness and metabolic activity, usually accompanied by physical relaxation and brain activity. + + + Attentive + Concentrating and focusing mental energy on the task or surroundings. + + + Awake + In a non sleeping state. + + + Brain-dead + Characterized by the irreversible absence of cortical and brain stem functioning. + + + Comatose + In a state of profound unconsciousness associated with markedly depressed cerebral activity. + + + Drowsy + In a state of near-sleep, a strong desire for sleep, or sleeping for unusually long periods. + + + Intoxicated + In a state with disturbed psychophysiological functions and responses as a result of administration or ingestion of a psychoactive substance. + + + Locked-in + In a state of complete paralysis of all voluntary muscles except for the ones that control the movements of the eyes. + + + Passive + Not responding or initiating an action in response to a stimulus. + + + Resting + A state in which the agent is not exhibiting any physical exertion. + + + Vegetative + A state of wakefulness and conscience, but (in contrast to coma) with involuntary opening of the eyes and movements (such as teeth grinding, yawning, or thrashing of the extremities). + + + + Agent-emotional-state + The status of the general temperament and outlook of an agent. + + Angry + Experiencing emotions characterized by marked annoyance or hostility. + + + Aroused + In a state reactive to stimuli leading to increased heart rate and blood pressure, sensory alertness, mobility and readiness to respond. + + + Awed + Filled with wonder. Feeling grand, sublime or powerful emotions characterized by a combination of joy, fear, admiration, reverence, and/or respect. + + + Compassionate + Feeling or showing sympathy and concern for others often evoked for a person who is in distress and associated with altruistic motivation. + + + Content + Feeling satisfaction with things as they are. + + + Disgusted + Feeling revulsion or profound disapproval aroused by something unpleasant or offensive. + + + Emotionally-neutral + Feeling neither satisfied nor dissatisfied. + + + Empathetic + Understanding and sharing the feelings of another. Being aware of, being sensitive to, and vicariously experiencing the feelings, thoughts, and experience of another. + + + Excited + Feeling great enthusiasm and eagerness. + + + Fearful + Feeling apprehension that one may be in danger. + + + Frustrated + Feeling annoyed as a result of being blocked, thwarted, disappointed or defeated. + + + Grieving + Feeling sorrow in response to loss, whether physical or abstract. + + + Happy + Feeling pleased and content. + + + Jealous + Feeling threatened by a rival in a relationship with another individual, in particular an intimate partner, usually involves feelings of threat, fear, suspicion, distrust, anxiety, anger, betrayal, and rejection. + + + Joyful + Feeling delight or intense happiness. + + + Loving + Feeling a strong positive emotion of affection and attraction. + + + Relieved + No longer feeling pain, distress, anxiety, or reassured. + + + Sad + Feeling grief or unhappiness. + + + Stressed + Experiencing mental or emotional strain or tension. + + + + Agent-physiological-state + Having to do with the mechanical, physical, or biochemical function of an agent. + + Healthy + Having no significant health-related issues. + + relatedTag + Sick + + + + Hungry + Being in a state of craving or desiring food. + + relatedTag + Sated + Thirsty + + + + Rested + Feeling refreshed and relaxed. + + relatedTag + Tired + + + + Sated + Feeling full. + + relatedTag + Hungry + + + + Sick + Being in a state of ill health, bodily malfunction, or discomfort. + + relatedTag + Healthy + + + + Thirsty + Feeling a need to drink. + + relatedTag + Hungry + + + + Tired + Feeling in need of sleep or rest. + + relatedTag + Rested + + + + + Agent-postural-state + Pertaining to the position in which agent holds their body. + + Crouching + Adopting a position where the knees are bent and the upper body is brought forward and down, sometimes to avoid detection or to defend oneself. + + + Eyes-closed + Keeping eyes closed with no blinking. + + + Eyes-open + Keeping eyes open with occasional blinking. + + + Kneeling + Positioned where one or both knees are on the ground. + + + On-treadmill + Ambulation on an exercise apparatus with an endless moving belt to support moving in place. + + + Prone + Positioned in a recumbent body position whereby the person lies on its stomach and faces downward. + + + Sitting + In a seated position. + + + Standing + Assuming or maintaining an erect upright position. + + + Seated-with-chin-rest + Using a device that supports the chin and head. + + + + + Agent-task-role + The function or part that is ascribed to an agent in performing the task. + + Experiment-actor + An agent who plays a predetermined role to create the experiment scenario. + + + Experiment-controller + An agent exerting control over some aspect of the experiment. + + + Experiment-participant + Someone who takes part in an activity related to an experiment. + + + Experimenter + Person who is the owner of the experiment and has its responsibility. + + + + Agent-trait + A genetically, environmentally, or socially determined characteristic of an agent. + + Age + Length of time elapsed time since birth of the agent. + + # + + takesValue + + + + + Agent-experience-level + Amount of skill or knowledge that the agent has as pertains to the task. + + Expert-level + Having comprehensive and authoritative knowledge of or skill in a particular area related to the task. + + relatedTag + Intermediate-experience-level + Novice-level + + + + Intermediate-experience-level + Having a moderate amount of knowledge or skill related to the task. + + relatedTag + Expert-level + Novice-level + + + + Novice-level + Being inexperienced in a field or situation related to the task. + + relatedTag + Expert-level + Intermediate-experience-level + + + + + Gender + Characteristics that are socially constructed, including norms, behaviors, and roles based on sex. + + + Sex + Physical properties or qualities by which male is distinguished from female. + + Female + Biological sex of an individual with female sexual organs such ova. + + + Male + Biological sex of an individual with male sexual organs producing sperm. + + + Intersex + Having genitalia and/or secondary sexual characteristics of indeterminate sex. + + + + Handedness + Individual preference for use of a hand, known as the dominant hand. + + Left-handed + Preference for using the left hand or foot for tasks requiring the use of a single hand or foot. + + + Right-handed + Preference for using the right hand or foot for tasks requiring the use of a single hand or foot. + + + Ambidextrous + Having no overall dominance in the use of right or left hand or foot in the performance of tasks that require one hand or foot. + + + + + + Data-property + Something that pertains to data or information. + + extensionAllowed + + + Data-marker + An indicator placed to mark something. + + Temporal-marker + An indicator placed at a particular time in the data. + + Onset + Labels the start or beginning of something, usually an event. + + topLevelTagGroup + + + + Offset + Labels the time at which something stops. + + topLevelTagGroup + + + + Pause + Indicates the temporary interruption of the operation a process and subsequently wait for a signal to continue. + + + Time-out + A cancellation or cessation that automatically occurs when a predefined interval of time has passed without a certain event occurring. + + + Time-sync + A synchronization signal whose purpose to help synchronize different signals or processes. Often used to indicate a marker inserted into the recorded data to allow post hoc synchronization of concurrently recorded data streams. + + + + + Data-resolution + Smallest change in a quality being measured by an sensor that causes a perceptible change. + + Printer-resolution + Resolution of a printer, usually expressed as the number of dots-per-inch for a printer. + + # + + takesValue + + + + + Screen-resolution + Resolution of a screen, usually expressed as the of pixels in a dimension for a digital display device. + + # + + takesValue + + + + + Sensory-resolution + Resolution of measurements by a sensing device. + + # + + takesValue + + + + + Spatial-resolution + Linear spacing of a spatial measurement. + + # + + takesValue + + + + + Spectral-resolution + Measures the ability of a sensor to resolve features in the electromagnetic spectrum. + + # + + takesValue + + + + + Temporal-resolution + Measures the ability of a sensor to resolve features in time. + + # + + takesValue + + + + + + Data-source-type + The type of place, person, or thing from which the data comes or can be obtained. + + Computed-feature + A feature computed from the data by a tool. This tag should be grouped with a label of the form Toolname_propertyName. + + + Computed-prediction + A computed extrapolation of known data. + + + Expert-annotation + An explanatory or critical comment or other in-context information provided by an authority. + + + Instrument-measurement + Information obtained from a device that is used to measure material properties or make other observations. + + + Observation + Active acquisition of information from a primary source. Should be grouped with a label of the form AgentID_featureName. + + + + Data-value + Designation of the type of a data item. + + Categorical-value + Indicates that something can take on a limited and usually fixed number of possible values. + + Categorical-class-value + Categorical values that fall into discrete classes such as true or false. The grouping is absolute in the sense that it is the same for all participants. + + All + To a complete degree or to the full or entire extent. + + relatedTag + Some + None + + + + Correct + Free from error. Especially conforming to fact or truth. + + relatedTag + Incorrect + + + + Explicit + Stated clearly and in detail, leaving no room for confusion or doubt. + + relatedTag + Implicit + + + + False + Not in accordance with facts, reality or definitive criteria. + + relatedTag + True + + + + Implicit + Implied though not plainly expressed. + + relatedTag + Explicit + + + + Invalid + Not true because based on erroneous information or unsound reasoning or not conforming to the correct format or specifications. + + relatedTag + Valid + + + + None + No person or thing, nobody, not any. + + relatedTag + All + Some + + + + Some + At least a small amount or number of, but not a large amount of, or often. + + relatedTag + All + None + + + + True + Conforming to facts, reality or definitive criteria. + + relatedTag + False + + + + Valid + Allowable, usable, or acceptable. + + relatedTag + Invalid + + + + Wrong + Not accurate, correct, or appropriate. + + relatedTag + Correct + + + + + Categorical-judgment-value + Categorical values that are based on the judgment or perception of the participant such familiar and famous. + + Abnormal + Deviating in any way from the state, position, structure, condition, behavior, or rule which is considered a norm. + + relatedTag + Normal + + + + Asymmetrical + Lacking symmetry or having parts that fail to correspond to one another in shape, size, or arrangement. + + relatedTag + Symmetrical + + + + Audible + A sound that can be perceived by the participant. + + relatedTag + Inaudible + + + + Congruent + Concordance of multiple evidence lines. In agreement or harmony. + + relatedTag + Incongruent + + + + Complex + Hard, involved or complicated, elaborate, having many parts. + + relatedTag + Simple + + + + Constrained + Keeping something within particular limits or bounds. + + relatedTag + Unconstrained + + + + Disordered + Not neatly arranged. Confused and untidy. A structural quality in which the parts of an object are non-rigid. + + relatedTag + Ordered + + + + Familiar + Recognized, familiar, or within the scope of knowledge. + + relatedTag + Unfamiliar + Famous + + + + Famous + A person who has a high degree of recognition by the general population for his or her success or accomplishments. A famous person. + + relatedTag + Familiar + Unfamiliar + + + + Inaudible + A sound below the threshold of perception of the participant. + + relatedTag + Audible + + + + Incongruent + Not in agreement or harmony. + + relatedTag + Congruent + + + + Involuntary + An action that is not made by choice. In the body, involuntary actions (such as blushing) occur automatically, and cannot be controlled by choice. + + relatedTag + Voluntary + + + + Masked + Information exists but is not provided or is partially obscured due to security, privacy, or other concerns. + + relatedTag + Unmasked + + + + Normal + Being approximately average or within certain limits. Conforming with or constituting a norm or standard or level or type or social norm. + + relatedTag + Abnormal + + + + Ordered + Conforming to a logical or comprehensible arrangement of separate elements. + + relatedTag + Disordered + + + + Simple + Easily understood or presenting no difficulties. + + relatedTag + Complex + + + + Symmetrical + Made up of exactly similar parts facing each other or around an axis. Showing aspects of symmetry. + + relatedTag + Asymmetrical + + + + Unconstrained + Moving without restriction. + + relatedTag + Constrained + + + + Unfamiliar + Not having knowledge or experience of. + + relatedTag + Familiar + Famous + + + + Unmasked + Information is revealed. + + relatedTag + Masked + + + + Voluntary + Using free will or design; not forced or compelled; controlled by individual volition. + + relatedTag + Involuntary + + + + + Categorical-level-value + Categorical values based on dividing a continuous variable into levels such as high and low. + + Cold + Characterized by an absence of heat. + + relatedTag + Hot + + + + Deep + Extending relatively far inward or downward. + + relatedTag + Shallow + + + + High + Having a greater than normal degree, intensity, or amount. + + relatedTag + Low + Medium + + + + Hot + Characterized by an excess of heat. + + relatedTag + Cold + + + + Liminal + Situated at a sensory threshold that is barely perceptible or capable of eliciting a response. + + relatedTag + Subliminal + Supraliminal + + + + Loud + Characterizing a perceived high intensity of sound. + + relatedTag + Quiet + + + + Low + Less than normal in degree, intensity or amount. + + relatedTag + High + + + + Medium + Mid-way between small and large in number, quantity, magnitude or extent. + + relatedTag + Low + High + + + + Negative + Involving disadvantage or harm. + + relatedTag + Positive + + + + Positive + Involving advantage or good. + + relatedTag + Negative + + + + Quiet + Characterizing a perceived low intensity of sound. + + relatedTag + Loud + + + + Rough + Having a surface with perceptible bumps, ridges, or irregularities. + + relatedTag + Smooth + + + + Shallow + Having a depth which is relatively low. + + relatedTag + Deep + + + + Smooth + Having a surface free from bumps, ridges, or irregularities. + + relatedTag + Rough + + + + Subliminal + Situated below a sensory threshold that is imperceptible or not capable of eliciting a response. + + relatedTag + Liminal + Supraliminal + + + + Supraliminal + Situated above a sensory threshold that is perceptible or capable of eliciting a response. + + relatedTag + Liminal + Subliminal + + + + Thick + Wide in width, extent or cross-section. + + relatedTag + Thin + + + + Thin + Narrow in width, extent or cross-section. + + relatedTag + Thick + + + + + Categorical-orientation-value + Value indicating the orientation or direction of something. + + Backward + Directed behind or to the rear. + + relatedTag + Forward + + + + Downward + Moving or leading toward a lower place or level. + + relatedTag + Leftward + Rightward + Upward + + + + Forward + At or near or directed toward the front. + + relatedTag + Backward + + + + Horizontally-oriented + Oriented parallel to or in the plane of the horizon. + + + Leftward + Going toward or facing the left. + + relatedTag + Downward + Rightward + Upward + + + + Oblique + Slanting or inclined in direction, course, or position that is neither parallel nor perpendicular nor right-angular. + + relatedTag + Rotated + + + + Rightward + Going toward or situated on the right. + + relatedTag + Downward + Leftward + Upward + + + + Rotated + Positioned offset around an axis or center. + + + Upward + Moving, pointing, or leading to a higher place, point, or level. + + relatedTag + Downward + Leftward + Rightward + + + + Vertically-oriented + Oriented perpendicular to the plane of the horizon. + + + + + Physical-value + The value of some physical property of something. + + Weight + The relative mass or the quantity of matter contained by something. + + # + + takesValue + + + unitClass + weightUnits + + + valueClass + numericClass + + + + + + Quantitative-value + Something capable of being estimated or expressed with numeric values. + + Fraction + A numerical value betwee 0 and 1. + + # + + takesValue + + + valueClass + numericClass + + + + + Item-count + The integer count of something which is usually grouped with the entity it is counting. (Item-count/3, A) indicates that 3 of A have occurred up to this point. + + # + + takesValue + + + valueClass + numericClass + + + + + Item-interval + An integer indicating how many items or entities have passed since the last one of these. An item interval of 0 indicates the current item. + + # + + takesValue + + + valueClass + numericClass + + + + + Percentage + A fraction or ratio with 100 understood as the denominator. + + # + + takesValue + + + valueClass + numericClass + + + + + Ratio + A quotient of quantities of the same kind for different components within the same system. + + # + + takesValue + + + valueClass + numericClass + + + + + + Statistical-value + A value based on or employing the principles of statistics. + + extensionAllowed + + + Data-maximum + The largest possible quantity or degree. + + # + + takesValue + + + valueClass + numericClass + + + + + Data-mean + The sum of a set of values divided by the number of values in the set. + + # + + takesValue + + + valueClass + numericClass + + + + + Data-median + The value which has an equal number of values greater and less than it. + + # + + takesValue + + + valueClass + numericClass + + + + + Data-minimum + The smallest possible quantity. + + # + + takesValue + + + valueClass + numericClass + + + + + Probability + A measure of the expectation of the occurrence of a particular event. + + # + + takesValue + + + valueClass + numericClass + + + + + Standard-deviation + A measure of the range of values in a set of numbers. Standard deviation is a statistic used as a measure of the dispersion or variation in a distribution, equal to the square root of the arithmetic mean of the squares of the deviations from the arithmetic mean. + + # + + takesValue + + + valueClass + numericClass + + + + + Statistical-accuracy + A measure of closeness to true value expressed as a number between 0 and 1. + + # + + takesValue + + + valueClass + numericClass + + + + + Statistical-precision + A quantitative representation of the degree of accuracy necessary for or associated with a particular action. + + # + + takesValue + + + valueClass + numericClass + + + + + Statistical-recall + Sensitivity is a measurement datum qualifying a binary classification test and is computed by substracting the false negative rate to the integral numeral 1. + + # + + takesValue + + + valueClass + numericClass + + + + + Statistical-uncertainty + A measure of the inherent variability of repeated observation measurements of a quantity including quantities evaluated by statistical methods and by other means. + + # + + takesValue + + + valueClass + numericClass + + + + + + Spatiotemporal-value + A property relating to space and/or time. + + Rate-of-change + The amount of change accumulated per unit time. + + Acceleration + Magnitude of the rate of change in either speed or direction. The direction of change should be given separately. + + # + + takesValue + + + unitClass + accelerationUnits + + + valueClass + numericClass + + + + + Frequency + Frequency is the number of occurrences of a repeating event per unit time. + + # + + takesValue + + + unitClass + frequencyUnits + + + valueClass + numericClass + + + + + Jerk-rate + Magnitude of the rate at which the acceleration of an object changes with respect to time. The direction of change should be given separately. + + # + + takesValue + + + unitClass + jerkUnits + + + valueClass + numericClass + + + + + Sampling-rate + The number of digital samples taken or recorded per unit of time. + + # + + takesValue + + + unitClass + frequencyUnits + + + + + Refresh-rate + The frequency with which the image on a computer monitor or similar electronic display screen is refreshed, usually expressed in hertz. + + # + + takesValue + + + valueClass + numericClass + + + + + Speed + A scalar measure of the rate of movement of the object expressed either as the distance travelled divided by the time taken (average speed) or the rate of change of position with respect to time at a particular point (instantaneous speed). The direction of change should be given separately. + + # + + takesValue + + + unitClass + speedUnits + + + valueClass + numericClass + + + + + Temporal-rate + The number of items per unit of time. + + # + + takesValue + + + unitClass + frequencyUnits + + + valueClass + numericClass + + + + + + Spatial-value + Value of an item involving space. + + Angle + The amount of inclination of one line to another or the plane of one object to another. + + unitClass + angleUnits + + + # + + takesValue + + + valueClass + numericClass + + + + + Distance + A measure of the space separating two objects or points. + + # + + takesValue + + + unitClass + physicalLengthUnits + + + valueClass + numericClass + + + + + Position + A reference to the alignment of an object, a particular situation or view of a situation, or the location of an object. Coordinates with respect a specified frame of reference or the default Screen-frame if no frame is given. + + X-position + The position along the x-axis of the frame of reference. + + # + + takesValue + + + unitClass + physicalLengthUnits + + + valueClass + numericClass + + + + + Y-position + The position along the y-axis of the frame of reference. + + # + + takesValue + + + unitClass + physicalLengthUnits + + + valueClass + numericClass + + + + + Z-position + The position along the z-axis of the frame of reference. + + # + + takesValue + + + unitClass + physicalLengthUnits + + + valueClass + numericClass + + + + + + Size + The physical magnitude of something. + + Area + The extent of a 2-dimensional surface enclosed within a boundary. + + # + + takesValue + + + unitClass + areaUnits + + + valueClass + numericClass + + + + + Depth + The distance from the surface of something especially from the perspective of looking from the front. + + # + + takesValue + + + unitClass + physicalLengthUnits + + + valueClass + numericClass + + + + + Length + The linear extent in space from one end of something to the other end, or the extent of something from beginning to end. + + # + + takesValue + + + unitClass + physicalLengthUnits + + + valueClass + numericClass + + + + + Width + The extent or measurement of something from side to side. + + # + + takesValue + + + unitClass + physicalLengthUnits + + + valueClass + numericClass + + + + + Height + The vertical measurement or distance from the base to the top of an object. + + # + + takesValue + + + unitClass + physicalLengthUnits + + + valueClass + numericClass + + + + + Volume + The amount of three dimensional space occupied by an object or the capacity of a space or container. + + # + + takesValue + + + unitClass + volumeUnits + + + valueClass + numericClass + + + + + + + Temporal-value + A characteristic of or relating to time or limited by time. + + Delay + Time during which some action is awaited. + + # + + takesValue + + + unitClass + timeUnits + + + valueClass + numericClass + + + + + Duration + The period of time during which something occurs or continues. + + # + + takesValue + + + unitClass + timeUnits + + + valueClass + numericClass + + + + + Time-interval + The period of time separating two instances, events, or occurrences. + + # + + takesValue + + + unitClass + timeUnits + + + valueClass + numericClass + + + + + Time-value + A value with units of time. Usually grouped with tags identifying what the value represents. + + # + + takesValue + + + unitClass + timeUnits + + + valueClass + numericClass + + + + + + + + Data-variability-attribute + An attribute describing how something changes or varies. + + Abrupt + Marked by sudden change. + + + Constant + Continually recurring or continuing without interruption. Not changing in time or space. + + + Continuous + Uninterrupted in time, sequence, substance, or extent. + + relatedTag + Discrete + Discontinuous + + + + Decreasing + Becoming smaller or fewer in size, amount, intensity, or degree. + + relatedTag + Increasing + + + + Deterministic + No randomness is involved in the development of the future states of the element. + + relatedTag + Random + Stochastic + + + + Discontinuous + Having a gap in time, sequence, substance, or extent. + + relatedTag + Continuous + + + + Discrete + Constituting a separate entities or parts. + + relatedTag + Continuous + Discontinuous + + + + Flickering + Moving irregularly or unsteadily or burning or shining fitfully or with a fluctuating light. + + + Estimated-value + Something that has been calculated or measured approximately. + + + Exact-value + A value that is viewed to the true value according to some standard. + + + Fractal + Having extremely irregular curves or shapes for which any suitably chosen part is similar in shape to a given larger or smaller part when magnified or reduced to the same size. + + + Increasing + Becoming greater in size, amount, or degree. + + relatedTag + Decreasing + + + + Random + Governed by or depending on chance. Lacking any definite plan or order or purpose. + + relatedTag + Deterministic + Stochastic + + + + Repetitive + A recurring action that is often non-purposeful. + + + Stochastic + Uses a random probability distribution or pattern that may be analysed statistically but may not be predicted precisely to determine future states. + + relatedTag + Deterministic + Random + + + + Varying + Differing in size, amount, degree, or nature. + + + + + Environmental-property + Relating to or arising from the surroundings of an agent. + + Indoors + Located inside a building or enclosure. + + + Outdoors + Any area outside a building or shelter. + + + Real-world + Located in a place that exists in real space and time under realistic conditions. + + + Virtual-world + Using technology that creates immersive, computer-generated experiences that a person can interact with and navigate through. The digital content is generally delivered to the user through some type of headset and responds to changes in head position or through interaction with other types of sensors. Existing in a virtual setting such as a simulation or game environment. + + + Augmented-reality + Using technology that enhances real-world experiences with computer-derived digital overlays to change some aspects of perception of the natural environment. The digital content is shown to the user through a smart device or glasses and responds to changes in the environment. + + + Motion-platform + A mechanism that creates the feelings of being in a real motion environment. + + + Urban + Relating to, located in, or characteristic of a city or densely populated area. + + + Rural + Of or pertaining to the country as opposed to the city. + + + Terrain + Characterization of the physical features of a tract of land. + + Composite-terrain + Tracts of land characterized by a mixure of physical features. + + + Dirt-terrain + Tracts of land characterized by a soil surface and lack of vegetation. + + + Grassy-terrain + Tracts of land covered by grass. + + + Gravel-terrain + Tracts of land covered by a surface consisting a loose aggregation of small water-worn or pounded stones. + + + Leaf-covered-terrain + Tracts of land covered by leaves and composited organic material. + + + Muddy-terrain + Tracts of land covered by a liquid or semi-liquid mixture of water and some combination of soil, silt, and clay. + + + Paved-terrain + Tracts of land covered with concrete, asphalt, stones, or bricks. + + + Rocky-terrain + Tracts of land consisting or full of rock or rocks. + + + Sloped-terrain + Tracts of land arranged in a sloping or inclined position. + + + Uneven-terrain + Tracts of land that are not level, smooth, or regular. + + + + + Informational-property + Something that pertains to a task. + + extensionAllowed + + + Description + An explanation of what the tag group it is in means. If the description is at the top-level of an event string, the description applies to the event. + + requireChild + + + # + + takesValue + + + valueClass + textClass + + + + + ID + An alphanumeric name that identifies either a unique object or a unique class of objects. Here the object or class may be an idea, physical countable object (or class), or physical uncountable substance (or class). + + requireChild + + + # + + takesValue + + + valueClass + textClass + + + + + Label + A string of 20 or fewer characters identifying something. Labels usually refer to general classes of things while IDs refer to specific instances. A term that is associated with some entity. A brief description given for purposes of identification. An identifying or descriptive marker that is attached to an object. + + requireChild + + + # + + takesValue + + + valueClass + nameClass + + + + + Metadata + Data about data. Information that describes another set of data. + + CogAtlas + The Cognitive Atlas ID number of something. + + # + + takesValue + + + + + CogPo + The CogPO ID number of something. + + # + + takesValue + + + + + Creation-date + The date on which data creation of this element began. + + requireChild + + + # + + takesValue + + + valueClass + dateTimeClass + + + + + Experimental-note + A brief written record about the experiment. + + # + + takesValue + + + valueClass + textClass + + + + + Library-name + Official name of a HED library. + + # + + takesValue + + + valueClass + nameClass + + + + + OBO-identifier + The identifier of a term in some Open Biology Ontology (OBO) ontology. + + # + + takesValue + + + valueClass + nameClass + + + + + Pathname + The specification of a node (file or directory) in a hierarchical file system, usually specified by listing the nodes top-down. + + # + + takesValue + + + + + Subject-identifier + A sequence of characters used to identify, name, or characterize a trial or study subject. + + # + + takesValue + + + + + Version-identifier + An alphanumeric character string that identifies a form or variant of a type or original. + + # + Usually is a semantic version. + + takesValue + + + + + + Parameter + Something user-defined for this experiment. + + Parameter-label + The name of the parameter. + + # + + takesValue + + + valueClass + labelClass + + + + + Parameter-value + The value of the parameter. + + # + + takesValue + + + valueClass + textClass + + + + + + + Organizational-property + Relating to an organization or the action of organizing something. + + Collection + A tag designating a grouping of items such as in a set or list. + + # + Name of the collection. + + takesValue + + + valueClass + nameClass + + + + + Condition-variable + An aspect of the experiment or task that is to be varied during the experiment. Task-conditions are sometimes called independent variables or contrasts. + + # + Name of the condition variable. + + takesValue + + + valueClass + nameClass + + + + + Control-variable + An aspect of the experiment that is fixed throughout the study and usually is explicitly controlled. + + # + Name of the control variable. + + takesValue + + + valueClass + nameClass + + + + + Def + A HED-specific utility tag used with a defined name to represent the tags associated with that definition. + + requireChild + + + # + Name of the definition. + + takesValue + + + valueClass + nameClass + + + + + Def-expand + A HED specific utility tag that is grouped with an expanded definition. The child value of the Def-expand is the name of the expanded definition. + + requireChild + + + tagGroup + + + # + + takesValue + + + valueClass + nameClass + + + + + Definition + A HED-specific utility tag whose child value is the name of the concept and the tag group associated with the tag is an English language explanation of a concept. + + requireChild + + + topLevelTagGroup + + + # + Name of the definition. + + takesValue + + + valueClass + nameClass + + + + + Event-context + A special HED tag inserted as part of a top-level tag group to contain information about the interrelated conditions under which the event occurs. The event context includes information about other events that are ongoing when this event happens. + + topLevelTagGroup + + + unique + + + + Event-stream + A special HED tag indicating that this event is a member of an ordered succession of events. + + # + Name of the event stream. + + takesValue + + + valueClass + nameClass + + + + + Experimental-intertrial + A tag used to indicate a part of the experiment between trials usually where nothing is happening. + + # + Optional label for the intertrial block. + + takesValue + + + valueClass + nameClass + + + + + Experimental-trial + Designates a run or execution of an activity, for example, one execution of a script. A tag used to indicate a particular organizational part in the experimental design often containing a stimulus-response pair or stimulus-response-feedback triad. + + # + Optional label for the trial (often a numerical string). + + takesValue + + + valueClass + nameClass + + + + + Indicator-variable + An aspect of the experiment or task that is measured as task conditions are varied during the experiment. Experiment indicators are sometimes called dependent variables. + + # + Name of the indicator variable. + + takesValue + + + valueClass + nameClass + + + + + Recording + A tag designating the data recording. Recording tags are usually have temporal scope which is the entire recording. + + # + Optional label for the recording. + + takesValue + + + valueClass + nameClass + + + + + Task + An assigned piece of work, usually with a time allotment. A tag used to indicate a linkage the structured activities performed as part of the experiment. + + # + Optional label for the task block. + + takesValue + + + valueClass + nameClass + + + + + Time-block + A tag used to indicate a contiguous time block in the experiment during which something is fixed or noted. + + # + Optional label for the task block. + + takesValue + + + valueClass + nameClass + + + + + + Sensory-property + Relating to sensation or the physical senses. + + Sensory-attribute + A sensory characteristic associated with another entity. + + Auditory-attribute + Pertaining to the sense of hearing. + + Loudness + Perceived intensity of a sound. + + # + + takesValue + + + valueClass + numericClass + + + + + Pitch + A perceptual property that allows the user to order sounds on a frequency scale. + + # + + takesValue + + + unitClass + frequencyUnits + + + valueClass + numericClass + + + + + Sound-envelope + Description of how a sound changes over time. + + Sound-envelope-attack + The time taken for initial run-up of level from nil to peak usually beginning when the key on a musical instrument is pressed. + + # + + takesValue + + + unitClass + timeUnits + + + valueClass + numericClass + + + + + Sound-envelope-decay + The time taken for the subsequent run down from the attack level to the designated sustain level. + + # + + takesValue + + + unitClass + timeUnits + + + valueClass + numericClass + + + + + Sound-envelope-release + The time taken for the level to decay from the sustain level to zero after the key is released + + # + + takesValue + + + unitClass + timeUnits + + + valueClass + numericClass + + + + + Sound-envelope-sustain + The time taken for the main sequence of the sound duration, until the key is released. + + # + + takesValue + + + unitClass + timeUnits + + + valueClass + numericClass + + + + + + Timbre + The perceived sound quality of a singing voice or musical instrument. + + # + + takesValue + + + valueClass + labelClass + + + + + + Gustatory-attribute + Pertaining to the sense of taste. + + Bitter + Having a sharp, pungent taste. + + + Salty + Tasting of or like salt. + + + Savory + Belonging to a taste that is salty or spicy rather than sweet. + + + Sour + Having a sharp, acidic taste. + + + Sweet + Having or resembling the taste of sugar. + + + + Olfactory-attribute + Having a smell. + + + Somatic-attribute + Pertaining to the feelings in the body or of the nervous system. + + Pain + The sensation of discomfort, distress, or agony, resulting from the stimulation of specialized nerve endings. + + + Stress + The negative mental, emotional, and physical reactions that occur when environmental stressors are perceived as exceeding the adaptive capacities of the individual. + + + + Tactile-attribute + Pertaining to the sense of touch. + + Tactile-pressure + Having a feeling of heaviness. + + + Tactile-temperature + Having a feeling of hotness or coldness. + + + Tactile-texture + Having a feeling of roughness. + + + Tactile-vibration + Having a feeling of mechanical oscillation. + + + + Vestibular-attribute + Pertaining to the sense of balance or body position. + + + Visual-attribute + Pertaining to the sense of sight. + + Color + The appearance of objects (or light sources) described in terms of perception of their hue and lightness (or brightness) and saturation. + + CSS-color + One of 140 colors supported by all browsers. For more details such as the color RGB or HEX values, check: https://www.w3schools.com/colors/colors_groups.asp + + Blue-color + CSS color group + + CadetBlue + CSS-color 0x5F9EA0 + + + SteelBlue + CSS-color 0x4682B4 + + + LightSteelBlue + CSS-color 0xB0C4DE + + + LightBlue + CSS-color 0xADD8E6 + + + PowderBlue + CSS-color 0xB0E0E6 + + + LightSkyBlue + CSS-color 0x87CEFA + + + SkyBlue + CSS-color 0x87CEEB + + + CornflowerBlue + CSS-color 0x6495ED + + + DeepSkyBlue + CSS-color 0x00BFFF + + + DodgerBlue + CSS-color 0x1E90FF + + + RoyalBlue + CSS-color 0x4169E1 + + + Blue + CSS-color 0x0000FF + + + MediumBlue + CSS-color 0x0000CD + + + DarkBlue + CSS-color 0x00008B + + + Navy + CSS-color 0x000080 + + + MidnightBlue + CSS-color 0x191970 + + + + Brown-color + CSS color group + + Cornsilk + CSS-color 0xFFF8DC + + + BlanchedAlmond + CSS-color 0xFFEBCD + + + Bisque + CSS-color 0xFFE4C4 + + + NavajoWhite + CSS-color 0xFFDEAD + + + Wheat + CSS-color 0xF5DEB3 + + + BurlyWood + CSS-color 0xDEB887 + + + Tan + CSS-color 0xD2B48C + + + RosyBrown + CSS-color 0xBC8F8F + + + SandyBrown + CSS-color 0xF4A460 + + + GoldenRod + CSS-color 0xDAA520 + + + DarkGoldenRod + CSS-color 0xB8860B + + + Peru + CSS-color 0xCD853F + + + Chocolate + CSS-color 0xD2691E + + + Olive + CSS-color 0x808000 + + + SaddleBrown + CSS-color 0x8B4513 + + + Sienna + CSS-color 0xA0522D + + + Brown + CSS-color 0xA52A2A + + + Maroon + CSS-color 0x800000 + + + + Cyan-color + CSS color group + + Aqua + CSS-color 0x00FFFF + + + Cyan + CSS-color 0x00FFFF + + + LightCyan + CSS-color 0xE0FFFF + + + PaleTurquoise + CSS-color 0xAFEEEE + + + Aquamarine + CSS-color 0x7FFFD4 + + + Turquoise + CSS-color 0x40E0D0 + + + MediumTurquoise + CSS-color 0x48D1CC + + + DarkTurquoise + CSS-color 0x00CED1 + + + + Green-color + CSS color group + + GreenYellow + CSS-color 0xADFF2F + + + Chartreuse + CSS-color 0x7FFF00 + + + LawnGreen + CSS-color 0x7CFC00 + + + Lime + CSS-color 0x00FF00 + + + LimeGreen + CSS-color 0x32CD32 + + + PaleGreen + CSS-color 0x98FB98 + + + LightGreen + CSS-color 0x90EE90 + + + MediumSpringGreen + CSS-color 0x00FA9A + + + SpringGreen + CSS-color 0x00FF7F + + + MediumSeaGreen + CSS-color 0x3CB371 + + + SeaGreen + CSS-color 0x2E8B57 + + + ForestGreen + CSS-color 0x228B22 + + + Green + CSS-color 0x008000 + + + DarkGreen + CSS-color 0x006400 + + + YellowGreen + CSS-color 0x9ACD32 + + + OliveDrab + CSS-color 0x6B8E23 + + + DarkOliveGreen + CSS-color 0x556B2F + + + MediumAquaMarine + CSS-color 0x66CDAA + + + DarkSeaGreen + CSS-color 0x8FBC8F + + + LightSeaGreen + CSS-color 0x20B2AA + + + DarkCyan + CSS-color 0x008B8B + + + Teal + CSS-color 0x008080 + + + + Gray-color + CSS color group + + Gainsboro + CSS-color 0xDCDCDC + + + LightGray + CSS-color 0xD3D3D3 + + + Silver + CSS-color 0xC0C0C0 + + + DarkGray + CSS-color 0xA9A9A9 + + + DimGray + CSS-color 0x696969 + + + Gray + CSS-color 0x808080 + + + LightSlateGray + CSS-color 0x778899 + + + SlateGray + CSS-color 0x708090 + + + DarkSlateGray + CSS-color 0x2F4F4F + + + Black + CSS-color 0x000000 + + + + Orange-color + CSS color group + + Orange + CSS-color 0xFFA500 + + + DarkOrange + CSS-color 0xFF8C00 + + + Coral + CSS-color 0xFF7F50 + + + Tomato + CSS-color 0xFF6347 + + + OrangeRed + CSS-color 0xFF4500 + + + + Pink-color + CSS color group + + Pink + CSS-color 0xFFC0CB + + + LightPink + CSS-color 0xFFB6C1 + + + HotPink + CSS-color 0xFF69B4 + + + DeepPink + CSS-color 0xFF1493 + + + PaleVioletRed + CSS-color 0xDB7093 + + + MediumVioletRed + CSS-color 0xC71585 + + + + Purple-color + CSS color group + + Lavender + CSS-color 0xE6E6FA + + + Thistle + CSS-color 0xD8BFD8 + + + Plum + CSS-color 0xDDA0DD + + + Orchid + CSS-color 0xDA70D6 + + + Violet + CSS-color 0xEE82EE + + + Fuchsia + CSS-color 0xFF00FF + + + Magenta + CSS-color 0xFF00FF + + + MediumOrchid + CSS-color 0xBA55D3 + + + DarkOrchid + CSS-color 0x9932CC + + + DarkViolet + CSS-color 0x9400D3 + + + BlueViolet + CSS-color 0x8A2BE2 + + + DarkMagenta + CSS-color 0x8B008B + + + Purple + CSS-color 0x800080 + + + MediumPurple + CSS-color 0x9370DB + + + MediumSlateBlue + CSS-color 0x7B68EE + + + SlateBlue + CSS-color 0x6A5ACD + + + DarkSlateBlue + CSS-color 0x483D8B + + + RebeccaPurple + CSS-color 0x663399 + + + Indigo + CSS-color 0x4B0082 + + + + Red-color + CSS color group + + LightSalmon + CSS-color 0xFFA07A + + + Salmon + CSS-color 0xFA8072 + + + DarkSalmon + CSS-color 0xE9967A + + + LightCoral + CSS-color 0xF08080 + + + IndianRed + CSS-color 0xCD5C5C + + + Crimson + CSS-color 0xDC143C + + + Red + CSS-color 0xFF0000 + + + FireBrick + CSS-color 0xB22222 + + + DarkRed + CSS-color 0x8B0000 + + + + Yellow-color + CSS color group + + Gold + CSS-color 0xFFD700 + + + Yellow + CSS-color 0xFFFF00 + + + LightYellow + CSS-color 0xFFFFE0 + + + LemonChiffon + CSS-color 0xFFFACD + + + LightGoldenRodYellow + CSS-color 0xFAFAD2 + + + PapayaWhip + CSS-color 0xFFEFD5 + + + Moccasin + CSS-color 0xFFE4B5 + + + PeachPuff + CSS-color 0xFFDAB9 + + + PaleGoldenRod + CSS-color 0xEEE8AA + + + Khaki + CSS-color 0xF0E68C + + + DarkKhaki + CSS-color 0xBDB76B + + + + White-color + CSS color group + + White + CSS-color 0xFFFFFF + + + Snow + CSS-color 0xFFFAFA + + + HoneyDew + CSS-color 0xF0FFF0 + + + MintCream + CSS-color 0xF5FFFA + + + Azure + CSS-color 0xF0FFFF + + + AliceBlue + CSS-color 0xF0F8FF + + + GhostWhite + CSS-color 0xF8F8FF + + + WhiteSmoke + CSS-color 0xF5F5F5 + + + SeaShell + CSS-color 0xFFF5EE + + + Beige + CSS-color 0xF5F5DC + + + OldLace + CSS-color 0xFDF5E6 + + + FloralWhite + CSS-color 0xFFFAF0 + + + Ivory + CSS-color 0xFFFFF0 + + + AntiqueWhite + CSS-color 0xFAEBD7 + + + Linen + CSS-color 0xFAF0E6 + + + LavenderBlush + CSS-color 0xFFF0F5 + + + MistyRose + CSS-color 0xFFE4E1 + + + + + Color-shade + A slight degree of difference between colors, especially with regard to how light or dark it is or as distinguished from one nearly like it. + + Dark-shade + A color tone not reflecting much light. + + + Light-shade + A color tone reflecting more light. + + + + Grayscale + Using a color map composed of shades of gray, varying from black at the weakest intensity to white at the strongest. + + # + White intensity between 0 and 1 + + takesValue + + + valueClass + numericClass + + + + + HSV-color + A color representation that models how colors appear under light. + + Hue + Attribute of a visual sensation according to which an area appears to be similar to one of the perceived colors. + + # + Angular value between 0 and 360 + + takesValue + + + valueClass + numericClass + + + + + Saturation + Colorfulness of a stimulus relative to its own brightness. + + # + B value of RGB between 0 and 1 + + takesValue + + + valueClass + numericClass + + + + + HSV-value + AAttribute of a visual sensation according to which an area appears to emit more or less light. + + # + + takesValue + + + valueClass + numericClass + + + + + + RGB-color + A color from the RGB schema. + + RGB-red + The red component. + + # + R value of RGB between 0 and 1 + + takesValue + + + valueClass + numericClass + + + + + RGB-blue + The blue component. + + # + B value of RGB between 0 and 1 + + takesValue + + + valueClass + numericClass + + + + + RGB-green + The green component. + + # + G value of RGB between 0 and 1 + + takesValue + + + valueClass + numericClass + + + + + + + Luminance + A quality that exists by virtue of the luminous intensity per unit area projected in a given direction. + + + Opacity + A measure of impenetrability to light. + + + + + Sensory-presentation + The entity has a sensory manifestation. + + Auditory-presentation + The sense of hearing is used in the presentation to the user. + + Loudspeaker-separation + The distance between two loudspeakers. Grouped with the Distance tag. + + suggestedTag + Distance + + + + Monophonic + Relating to sound transmission, recording, or reproduction involving a single transmission path. + + + Silent + The absence of ambient audible sound or the state of having ceased to produce sounds. + + + Stereophonic + Relating to, or constituting sound reproduction involving the use of separated microphones and two transmission channels to achieve the sound separation of a live hearing. + + + + Gustatory-presentation + The sense of taste used in the presentation to the user. + + + Olfactory-presentation + The sense of smell used in the presentation to the user. + + + Somatic-presentation + The nervous system is used in the presentation to the user. + + + Tactile-presentation + The sense of touch used in the presentation to the user. + + + Vestibular-presentation + The sense balance used in the presentation to the user. + + + Visual-presentation + The sense of sight used in the presentation to the user. + + 2D-view + A view showing only two dimensions. + + + 3D-view + A view showing three dimensions. + + + Background-view + Parts of the view that are farthest from the viewer and usually the not part of the visual focus. + + + Bistable-view + Something having two stable visual forms that have two distinguishable stable forms as in optical illusions. + + + Foreground-view + Parts of the view that are closest to the viewer and usually the most important part of the visual focus. + + + Foveal-view + Visual presentation directly on the fovea. A view projected on the small depression in the retina containing only cones and where vision is most acute. + + + Map-view + A diagrammatic representation of an area of land or sea showing physical features, cities, roads. + + Aerial-view + Elevated view of an object from above, with a perspective as though the observer were a bird. + + + Satellite-view + A representation as captured by technology such as a satellite. + + + Street-view + A 360-degrees panoramic view from a position on the ground. + + + + Peripheral-view + Indirect vision as it occurs outside the point of fixation. + + + + + + Task-property + Something that pertains to a task. + + extensionAllowed + + + Task-attentional-demand + Strategy for allocating attention toward goal-relevant information. + + Bottom-up-attention + Attentional guidance purely by externally driven factors to stimuli that are salient because of their inherent properties relative to the background. Sometimes this is referred to as stimulus driven. + + relatedTag + Top-down-attention + + + + Covert-attention + Paying attention without moving the eyes. + + relatedTag + Overt-attention + + + + Divided-attention + Integrating parallel multiple stimuli. Behavior involving responding simultaneously to multiple tasks or multiple task demands. + + relatedTag + Focused-attention + + + + Focused-attention + Responding discretely to specific visual, auditory, or tactile stimuli. + + relatedTag + Divided-attention + + + + Orienting-attention + Directing attention to a target stimulus. + + + Overt-attention + Selectively processing one location over others by moving the eyes to point at that location. + + relatedTag + Covert-attention + + + + Selective-attention + Maintaining a behavioral or cognitive set in the face of distracting or competing stimuli. Ability to pay attention to a limited array of all available sensory information. + + + Sustained-attention + Maintaining a consistent behavioral response during continuous and repetitive activity. + + + Switched-attention + Having to switch attention between two or more modalities of presentation. + + + Top-down-attention + Voluntary allocation of attention to certain features. Sometimes this is referred to goal-oriented attention. + + relatedTag + Bottom-up-attention + + + + + Task-effect-evidence + The evidence supporting the conclusion that the event had the specified effect. + + Computational-evidence + A type of evidence in which data are produced, and/or generated, and/or analyzed on a computer. + + + External-evidence + A phenomenon that follows and is caused by some previous phenomenon. + + + Intended-effect + A phenomenon that is intended to follow and be caused by some previous phenomenon. + + + Behavioral-evidence + An indication or conclusion based on the behavior of an agent. + + + + Task-event-role + The purpose of an event with respect to the task. + + Experimental-stimulus + Part of something designed to elicit a response in the experiment. + + + Incidental + Usually associated with a sensory event intended to give instructions to the participant about the task or behavior. + + + Instructional + Usually associated with a sensory event intended to give instructions to the participant about the task or behavior. + + + Mishap + Unplanned disruption such as an equipment or experiment control abnormality or experimenter error. + + + Participant-response + Something related to a participant actions in performing the task. + + + Task-activity + Something that is part of the overall task or is necessary to the overall experiment but is not directly part of a stimulus-response cycle. Examples would be taking a survey or provided providing a silva sample. + + + Warning + Something that should warn the participant that the parameters of the task have been or are about to be exceeded such as a warning message about getting too close to the shoulder of the road in a driving task. + + + + Task-action-type + How an agent action should be interpreted in terms of the task specification. + + Appropriate-action + An action suitable or proper in the circumstances. + + relatedTag + Inappropriate-action + + + + Correct-action + An action that was a correct response in the context of the task. + + relatedTag + Incorrect-action + Indeterminate-action + + + + Correction + An action offering an improvement to replace a mistake or error. + + + Incorrect-action + An action considered wrong or incorrect in the context of the task. + + relatedTag + Correct-action + Indeterminate-action + + + + Imagined-action + Form a mental image or concept of something. This is used to identity something that only happened in the imagination of the participant as in imagined movements in motor imagery paradigms. + + + Inappropriate-action + An action not in keeping with what is correct or proper for the task. + + relatedTag + Appropriate-action + + + + Indeterminate-action + An action that cannot be distinguished between two or more possibibities in the current context. This tag might be applied when an outside evaluator or a classification algorithm cannot determine a definitive result. + + relatedTag + Correct-action + Incorrect-action + Miss + Near-miss + + + + Omitted-action + An expected response was skipped. + + + Miss + An action considered to be a failure in the context of the task. For example, if the agent is supposed to try to hit a target and misses. + + relatedTag + Near-miss + + + + Near-miss + An action barely satisfied the requirements of the task. In a driving experiment for example this could pertain to a narrowly avoided collision or other accident. + + relatedTag + Miss + + + + + Task-relationship + Specifying organizational importance of sub-tasks. + + Background-subtask + A part of the task which should be performed in the background as for example inhibiting blinks due to instruction while performing the primary task. + + + Primary-subtask + A part of the task which should be the primary focus of the participant. + + + + Task-stimulus-role + The role the stimulus plays in the task. + + Cue + A signal for an action, a pattern of stimuli indicating a particular response. + + + Distractor + A person or thing that distracts or a plausible but incorrect option in a multiple-choice question. In pyschological studies this is sometimes referred to as a foil. + + + Expected + Considered likely, probable or anticipated. Something of low information value as in frequent non-targets in an RSVP paradigm. + + relatedTag + Unexpected + + + suggestedTag + Target + + + + Extraneous + Irrelevant or unrelated to the subject being dealt with. + + + Feedback + An evaluative response to an inquiry, process, event, or activity. + + + Go-signal + An indicator to proceed with a planned action. + + relatedTag + Stop-signal + + + + Meaningful + Conveying significant or relevant information. + + + Newly-learned + Representing recently acquired information or understanding. + + + Non-informative + Something that is not useful in forming an opinion or judging an outcome. + + + Non-target + Something other than that done or looked for. Also tag Expected if the Non-target is frequent. + + relatedTag + Target + + + + Not-meaningful + Not having a serious, important, or useful quality or purpose. + + + Novel + Having no previous example or precedent or parallel. + + + Oddball + Something unusual, or infrequent. + + relatedTag + Unexpected + + + suggestedTag + Target + + + + Planned + Something that was decided on or arranged in advance. + + relatedTag + Unplanned + + + + Penalty + A disadvantage, loss, or hardship due to some action. + + + Priming + An implicit memory effect in which exposure to a stimulus influences response to a later stimulus. + + + Query + A sentence of inquiry that asks for a reply. + + + Reward + A positive reinforcement for a desired action, behavior or response. + + + Stop-signal + An indicator that the agent should stop the current activity. + + relatedTag + Go-signal + + + + Target + Something fixed as a goal, destination, or point of examination. + + + Threat + An indicator that signifies hostility and predicts an increased probability of attack. + + + Timed + Something planned or scheduled to be done at a particular time or lasting for a specified amount of time. + + + Unexpected + Something that is not anticipated. + + relatedTag + Expected + + + + Unplanned + Something that has not been planned as part of the task. + + relatedTag + Planned + + + + + + + Relation + Concerns the way in which two or more people or things are connected. + + Comparative-relation + Something considered in comparison to something else. + + Approximately-equal-to + (A (Approximately-equal-to B)) indicates that A and B have almost the same value. Here A and B could refer to sizes, orders, positions or other quantities. + + + Less-than + (A (Less-than B)) indicates that A is smaller than B. Here A and B could refer to sizes, orders, positions or other quantities. + + + Less-than-or-equal-to + (A (Less-than-or-equal-to B)) indicates that the relative size or order of A is smaller than or equal to B. + + + Greater-than + (A (Greater-than B)) indicates that the relative size or order of A is bigger than that of B. + + + Greater-than-or-equal-to + (A (Greater-than-or-equal-to B)) indicates that the relative size or order of A is bigger than or the same as that of B. + + + Equal-to + (A (Equal-to B)) indicates that the size or order of A is the same as that of B. + + + Not-equal-to + (A (Not-equal-to B)) indicates that the size or order of A is not the same as that of B. + + + + Connective-relation + Indicates two items are related in some way. + + Belongs-to + (A (Belongs-to B)) indicates that A is a member of B. + + + Connected-to + (A (Connected-to) B) indicates that A is related to B in some respect, usually through a direct link. + + + Contained-in + (A (Contained-in B)) indicates that A is completely inside of B. + + + Described-by + (A (Described-by B)) indicates that B provides information about A. + + + From-to + (A (From-to B)) indicates a directional relation from A to B. A is considered the source. + + + Group-of + (A (Group-of B)) indicates A is a group of items of type B. + + + Implied-by + (A (Implied-by B)) indicates B is suggested by A. + + + Interacts-with + (A (Interacts-with B)) indicates A and B interact, possibly reciprocally. + + + Member-of + (A (Member-of B)) indicates A is a member of group B. + + + Part-of + (A (Part-of B)) indicates A is a part of the whole B. + + + Performed-by + (A (Performed-by B)) Indicates that ction or procedure A was carried out by agent B. + + + Related-to + (A (Relative-to B)) indicates A is a part of the whole B. + + + + Directional-relation + A relationship indicating direction of change. + + Away-from + Go away from a place or object. + + + Towards + Moving in the direction of. A relation binding a relational quality or disposition to the relevant type of entity + + + + Spatial-relation + Indicating information about position. + + Above + (A (Adjacent-to B)) means A is in a place or position that is higher than B. + + + Across-from + (A (Across-from B)) means A is on the opposite side of something from B. + + + Adjacent-to + (A (Adjacent-to B)) indicates that A is next to B in time or space. + + + Ahead-of + (A (Ahead-of B)) indicates that A is further forward in time or space in B. + + + Around + (A (Around B)) means A is in or near the present place or situation of B. + + + Behind + (A (Behind B)) means A is at or to the far side of B, typically so as to be hidden by it. + + + Below + (A (Below B)) means A is in a place or position that is lower than the position of B. + + + Between + (A (Between, (B, C))) means A is in the space or interval separating B and C. + + + Bilateral-to + (A (Bilateral B)) means A is on both sides of B or affects both sides of B. + + + Bottom-edge-of + (A (Bottom-edge-of B)) means A is on the bottom most part or or near the boundary of B. + + relatedTag + Left-edge-of + Right-edge-of + Top-edge-of + + + + Boundary-of + (A (Boundary-of B)) means A is on or part of the edge or boundary of B. + + + Center-of + (A (Center-of B)) means A is at a point or or in an area that is approximately central within B. + + + Close-to + (A (Close-to B)) means A is at a small distance from or is located near in space to B. + + + Far-from + (A (Far-from B)) means A is at a large distance from or is not located near in space to B. + + + In-front-of + (A (In-front-of B)) means A is in a position just ahead or at the front part of B, potentially partially blocking B from view. + + + Left-edge-of + (A (Left-edge-of B)) means A is located on the left side of B on or near the boundary of B. + + relatedTag + Bottom-edge-of + Right-edge-of + Top-edge-of + + + + Left-side-of + (A (Left-side-of B)) means A is located on the left side of B usually as part of B. + + relatedTag + Right-side-of + + + + Lower-left-of + (A (Lower-left-of B)) means A is situated on the lower left part of B. This relation is often used to specify qualitative information about screen position. + + relatedTag + Lower-right-of + + + + Lower-right-of + (A (Lower-right-of B)) means A is situated on the lower right part of B. This relation is often used to specify qualitative information about screen position. + + relatedTag + Upper-left-of + + + + Outside-of + (A (Outside-of B)) means A is located in the space around but not including B. + + + Over + (A (over B)) means A above is above B so as to cover or protect or A extends over the a general area as from a from a vantage point. + + + Right-edge-of + (A (Right-edge-of B)) means A is located on the right side of B on or near the boundary of B. + + relatedTag + Bottom-edge-of + Left-edge-of + Top-edge-of + + + + Right-side-of + (A (Right-side-of B)) means A is located on the right side of B usually as part of B. + + relatedTag + Left-side-of + + + + To-left-of + (A (To-left-of B)) means A is located on or directed toward the side to the west of B when B is facing north. This term is used when A is not part of B. + + + To-right-of + (A (To-right-of B)) means A is located on or directed toward the side to the east of B when B is facing north. This term is used when A is not part of B. + + + Top-edge-of + (A (Top-edge-of B)) means A is on the uppermost part or or near the boundary of B. + + relatedTag + Left-edge-of + Right-edge-of + Bottom-edge-of + + + + Top-of + (A (Top-of B)) means A is on the uppermost part, side, or surface of B. + + + Underneath + (A (Underneath B)) means A is situated directly below and may be concealed by B. + + + Upper-left-of + (A (Upper-left-of B)) means A is situated on the upper left part of B. This relation is often used to specify qualitative information about screen position. + + relatedTag + Lower-left-of + + + + Upper-right-of + (A (Upper-right-of B)) means A is situated on the upper right part of B. This relation is often used to specify qualitative information about screen position. + + relatedTag + Lower-left-of + + + + Within + (A (Within B)) means A is on the inside of or contained in B. + + + + Temporal-relation + Any relationship which includes a temporal or time-based component. + + After + (A After B) means A happens at a time subsequent to a reference time related to B. + + + Asynchronous-with + (A Asynchronous-with B) means A happens at times not occurring at the same time or having the same period or phase as B. + + + Before + (A Before B) means A happens at a time earlier in time or order than B. + + + During + (A During B) means A happens at some point in a given period of time in which B is ongoing. + + + Synchronous-with + (A Synchronous-with B) means A happens at occurs at the same time or rate as B. + + + Waiting-for + (A Waiting-for B) means A pauses for something to happen in B. + + + + + + + accelerationUnits + + defaultUnits + m-per-s^2 + + + m-per-s^2 + + SIUnit + + + unitSymbol + + + + + angleUnits + + defaultUnits + radian + + + radian + + SIUnit + + + + rad + + SIUnit + + + unitSymbol + + + + degree + + + + areaUnits + + defaultUnits + m^2 + + + m^2 + + SIUnit + + + unitSymbol + + + + + currencyUnits + Units indicating the worth of something. + + defaultUnits + $ + + + dollar + + + $ + + unitPrefix + + + unitSymbol + + + + point + + + + frequencyUnits + + defaultUnits + Hz + + + hertz + + SIUnit + + + + Hz + + SIUnit + + + unitSymbol + + + + + intensityUnits + + defaultUnits + dB + + + dB + Intensity expressed as ratio to a threshold. Often used for sound intensity. + + unitSymbol + + + + candela + Units used to express light intensity. + + SIUnit + + + + cd + Units used to express light intensity. + + SIUnit + + + unitSymbol + + + + + jerkUnits + + defaultUnits + m-per-s^3 + + + m-per-s^3 + + unitSymbol + + + + + memorySizeUnits + + defaultUnits + B + + + byte + + SIUnit + + + + B + + SIUnit + + + unitSymbol + + + + + physicalLengthUnits + + defaultUnits + m + + + foot + + + inch + + + metre + + SIUnit + + + + m + + SIUnit + + + unitSymbol + + + + mile + + + + speedUnits + + defaultUnits + m-per-s + + + m-per-s + + SIUnit + + + unitSymbol + + + + mph + + unitSymbol + + + + kph + + unitSymbol + + + + + timeUnits + + defaultUnits + s + + + second + + SIUnit + + + + s + + SIUnit + + + unitSymbol + + + + day + + + minute + + + hour + Should be in 24-hour format. + + + + volumeUnits + + defaultUnits + m^3 + + + m^3 + + SIUnit + + + unitSymbol + + + + + weightUnits + + defaultUnits + g + + + g + + SIUnit + + + unitSymbol + + + + gram + + SIUnit + + + + pound + + + lb + + + + + + deca + SI unit multiple representing 10^1 + + SIUnitModifier + + + + da + SI unit multiple representing 10^1 + + SIUnitSymbolModifier + + + + hecto + SI unit multiple representing 10^2 + + SIUnitModifier + + + + h + SI unit multiple representing 10^2 + + SIUnitSymbolModifier + + + + kilo + SI unit multiple representing 10^3 + + SIUnitModifier + + + + k + SI unit multiple representing 10^3 + + SIUnitSymbolModifier + + + + mega + SI unit multiple representing 10^6 + + SIUnitModifier + + + + M + SI unit multiple representing 10^6 + + SIUnitSymbolModifier + + + + giga + SI unit multiple representing 10^9 + + SIUnitModifier + + + + G + SI unit multiple representing 10^9 + + SIUnitSymbolModifier + + + + tera + SI unit multiple representing 10^12 + + SIUnitModifier + + + + T + SI unit multiple representing 10^12 + + SIUnitSymbolModifier + + + + peta + SI unit multiple representing 10^15 + + SIUnitModifier + + + + P + SI unit multiple representing 10^15 + + SIUnitSymbolModifier + + + + exa + SI unit multiple representing 10^18 + + SIUnitModifier + + + + E + SI unit multiple representing 10^18 + + SIUnitSymbolModifier + + + + zetta + SI unit multiple representing 10^21 + + SIUnitModifier + + + + Z + SI unit multiple representing 10^21 + + SIUnitSymbolModifier + + + + yotta + SI unit multiple representing 10^24 + + SIUnitModifier + + + + Y + SI unit multiple representing 10^24 + + SIUnitSymbolModifier + + + + deci + SI unit submultiple representing 10^-1 + + SIUnitModifier + + + + d + SI unit submultiple representing 10^-1 + + SIUnitSymbolModifier + + + + centi + SI unit submultiple representing 10^-2 + + SIUnitModifier + + + + c + SI unit submultiple representing 10^-2 + + SIUnitSymbolModifier + + + + milli + SI unit submultiple representing 10^-3 + + SIUnitModifier + + + + m + SI unit submultiple representing 10^-3 + + SIUnitSymbolModifier + + + + micro + SI unit submultiple representing 10^-6 + + SIUnitModifier + + + + u + SI unit submultiple representing 10^-6 + + SIUnitSymbolModifier + + + + nano + SI unit submultiple representing 10^-9 + + SIUnitModifier + + + + n + SI unit submultiple representing 10^-9 + + SIUnitSymbolModifier + + + + pico + SI unit submultiple representing 10^-12 + + SIUnitModifier + + + + p + SI unit submultiple representing 10^-12 + + SIUnitSymbolModifier + + + + femto + SI unit submultiple representing 10^-15 + + SIUnitModifier + + + + f + SI unit submultiple representing 10^-15 + + SIUnitSymbolModifier + + + + atto + SI unit submultiple representing 10^-18 + + SIUnitModifier + + + + a + SI unit submultiple representing 10^-18 + + SIUnitSymbolModifier + + + + zepto + SI unit submultiple representing 10^-21 + + SIUnitModifier + + + + z + SI unit submultiple representing 10^-21 + + SIUnitSymbolModifier + + + + yocto + SI unit submultiple representing 10^-24 + + SIUnitModifier + + + + y + SI unit submultiple representing 10^-24 + + SIUnitSymbolModifier + + + + + + dateTimeClass + Date-times should conform to ISO8601 date-time format YYYY-MM-DDThh:mm:ss. Any variation on the full form is allowed. + + allowedCharacter + digits + T + - + : + + + + nameClass + Value class designating values that have the characteristics of node names. The allowed characters are alphanumeric, hyphen, and underbar. + + allowedCharacter + letters + digits + _ + - + + + + numericClass + Value must be a valid numerical value. + + allowedCharacter + digits + E + e + + + - + . + + + + posixPath + Posix path specification. + + allowedCharacter + digits + letters + / + : + + + + textClass + Value class designating values that have the characteristics of text such as in descriptions. + + allowedCharacter + letters + digits + blank + + + - + : + ; + . + / + ( + ) + ? + * + % + $ + @ + + + + + + allowedCharacter + A schema attribute of value classes specifying a special character that is allowed in expressing the value of a placeholder. Normally the allowed characters are listed individually. However, the word letters designates the upper and lower case alphabetic characters and the word digits designates the digits 0-9. The word blank designates the blank character. + + valueClassProperty + + + + defaultUnits + A schema attribute of unit classes specifying the default units to use if the placeholder has a unit class but the substituted value has no units. + + unitClassProperty + + + + extensionAllowed + A schema attribute indicating that users can add unlimited levels of child nodes under this tag. This tag is propagated to child nodes with the exception of the hashtag placeholders. + + boolProperty + + + + recommended + A schema attribute indicating that the event-level HED string should include this tag. + + boolProperty + + + + relatedTag + A schema attribute suggesting HED tags that are closely related to this tag. This attribute is used by tagging tools. + + + requireChild + A schema attribute indicating that one of the node elements descendants must be included when using this tag. + + boolProperty + + + + required + A schema attribute indicating that every event-level HED string should include this tag. + + boolProperty + + + + SIUnit + A schema attribute indicating that this unit element is an SI unit and can be modified by multiple and submultiple names. Note that some units such as byte are designated as SI units although they are not part of the standard. + + boolProperty + + + unitProperty + + + + SIUnitModifier + A schema attribute indicating that this SI unit modifier represents a multiple or submultiple of a base unit rather than a unit symbol. + + boolProperty + + + unitModifierProperty + + + + SIUnitSymbolModifier + A schema attribute indicating that this SI unit modifier represents a multiple or submultiple of a unit symbol rather than a base symbol. + + boolProperty + + + unitModifierProperty + + + + suggestedTag + A schema attribute that indicates another tag that is often associated with this tag. This attribute is used by tagging tools to provide tagging suggestions. + + + tagGroup + A schema attribute indicating the tag can only appear inside a tag group. + + boolProperty + + + + takesValue + A schema attribute indicating the tag is a hashtag placeholder that is expected to be replaced with a user-defined value. + + boolProperty + + + + topLevelTagGroup + A schema attribute indicating that this tag (or its descendants) can only appear in a top-level tag group. + + boolProperty + + + + unique + A schema attribute indicating that only one of this tag or its descendants can be used in the event-level HED string. + + boolProperty + + + + unitClass + A schema attribute specifying which unit class this value tag belongs to. + + + unitPrefix + A schema attribute applied specifically to unit elements to designate that the unit indicator is a prefix (e.g., dollar sign in the currency units). + + boolProperty + + + unitProperty + + + + unitSymbol + A schema attribute indicating this tag is an abbreviation or symbol representing a type of unit. Unit symbols represent both the singular and the plural and thus cannot be pluralized. + + boolProperty + + + unitProperty + + + + valueClass + A schema attribute specifying which value class this value tag belongs to. + + + + + boolProperty + Indicates that the schema attribute represents something that is either true or false and does not have a value. Attributes without this value are assumed to have string values. + + + unitClassProperty + Indicates that the schema attribute is meant to be applied to unit classes. + + + unitModifierProperty + Indicates that the schema attribute is meant to be applied to unit modifier classes. + + + unitProperty + Indicates that the schema attribute is meant to be applied to units within a unit class. + + + valueClassProperty + Indicates that the schema attribute is meant to be applied to value classes. + + + This is an updated version of the schema format. The properties are now part of the schema. The schema attributes are designed to be checked in software rather than hard-coded. The schema attributes, themselves have properties. + + diff --git a/tests/dataset.spec.js b/tests/dataset.spec.js index 19c94679..d012a6e6 100644 --- a/tests/dataset.spec.js +++ b/tests/dataset.spec.js @@ -1,11 +1,11 @@ const assert = require('chai').assert const hed = require('../validator/dataset') -const schema = require('../validator/schema') +const schema = require('../validator/schema/init') const generateValidationIssue = require('../common/issues/issues').generateIssue const generateConverterIssue = require('../converter/issues') describe('HED dataset validation', () => { - const hedSchemaFile = 'tests/data/HED8.0.0-alpha.1.xml' + const hedSchemaFile = 'tests/data/HED8.0.0.xml' let hedSchemaPromise beforeAll(() => { @@ -45,11 +45,11 @@ describe('HED dataset validation', () => { multipleValidLong: [ 'Event/Sensory-event', 'Item/Object/Man-made-object/Vehicle/Train', - 'Attribute/Sensory/Visual/Color/RGB-color/RGB-red/0.5', + 'Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/RGB-color/RGB-red/0.5', ], multipleValidShort: ['Sensory-event', 'Train', 'RGB-red/0.5'], multipleValidMixed: ['Event/Sensory-event', 'Train', 'RGB-red/0.5'], - multipleInvalid: ['Train/Maglev', 'Duration/0.5 cm', 'InvalidEvent'], + multipleInvalid: ['Duration/0.5 cm', 'InvalidEvent'], } const legalTimeUnits = ['s', 'second', 'day', 'minute', 'hour'] const expectedIssues = { @@ -60,20 +60,17 @@ describe('HED dataset validation', () => { multipleValidShort: [], multipleValidMixed: [], multipleInvalid: [ - generateValidationIssue('extension', { - tag: testDatasets.multipleInvalid[0], - }), generateValidationIssue('unitClassInvalidUnit', { - tag: testDatasets.multipleInvalid[1], + tag: testDatasets.multipleInvalid[0], unitClassUnits: legalTimeUnits.sort().join(','), }), // TODO: Duplication temporary generateValidationIssue('invalidTag', { - tag: testDatasets.multipleInvalid[2], + tag: testDatasets.multipleInvalid[1], }), generateConverterIssue( 'invalidTag', - testDatasets.multipleInvalid[2], + testDatasets.multipleInvalid[1], {}, [0, 12], ), diff --git a/tests/event.spec.js b/tests/event.spec.js index 3d4d2f0d..c58133f5 100644 --- a/tests/event.spec.js +++ b/tests/event.spec.js @@ -1,7 +1,8 @@ const assert = require('chai').assert const hed = require('../validator/event') -const schema = require('../validator/schema') -const { parseHedString, ParsedHedTag } = require('../validator/stringParser') +const schema = require('../validator/schema/init') +const { parseHedString } = require('../validator/stringParser') +const { ParsedHedTag } = require('../validator/types/parsedHed') const { HedValidator, Hed2Validator, @@ -1012,7 +1013,7 @@ describe('HED string and event validation', () => { }) describe('HED-3G validation', () => { - const hedSchemaFile = 'tests/data/HED8.0.0-alpha.3.xml' + const hedSchemaFile = 'tests/data/HED8.0.0.xml' let hedSchemaPromise beforeAll(() => { @@ -1082,7 +1083,6 @@ describe('HED string and event validation', () => { return hedSchemaPromise.then((hedSchemas) => { validatorBase( hedSchemas, - Hed3Validator, testStrings, expectedIssues, testFunction, @@ -1140,15 +1140,15 @@ describe('HED string and event validation', () => { ], } return validatorSemantic(testStrings, expectedIssues, (validator) => { - validator.validateFullParsedHedString() + validator.validateEventLevel() }) }) it('should not validate strings with short-to-long conversion errors', () => { const testStrings = { // Duration/20 cm is an obviously invalid tag that should not be caught due to the first error. - red: 'Attribute/RGB-red, Duration/20 cm', - redAndBlue: 'Attribute/RGB-red, Attribute/RGB-blue, Duration/20 cm', + red: 'Property/RGB-red, Duration/20 cm', + redAndBlue: 'Property/RGB-red, Property/RGB-blue, Duration/20 cm', } const expectedIssues = { red: [ @@ -1156,9 +1156,10 @@ describe('HED string and event validation', () => { 'invalidParentNode', testStrings.red, { - parentTag: 'Attribute/Sensory/Visual/Color/RGB-color/RGB-red', + parentTag: + 'Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/RGB-color/RGB-red', }, - [10, 17], + [9, 16], ), ], redAndBlue: [ @@ -1166,17 +1167,19 @@ describe('HED string and event validation', () => { 'invalidParentNode', testStrings.redAndBlue, { - parentTag: 'Attribute/Sensory/Visual/Color/RGB-color/RGB-red', + parentTag: + 'Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/RGB-color/RGB-red', }, - [10, 17], + [9, 16], ), converterGenerateIssue( 'invalidParentNode', testStrings.redAndBlue, { - parentTag: 'Attribute/Sensory/Visual/Color/RGB-color/RGB-blue', + parentTag: + 'Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/RGB-color/RGB-blue', }, - [29, 37], + [27, 35], ), ], } @@ -1252,6 +1255,7 @@ describe('HED string and event validation', () => { } } } + validator.definitions = definitionMap for (const tag of validator.parsedString.tags) { testFunction(validator, tag) } @@ -1263,7 +1267,7 @@ describe('HED string and event validation', () => { it('should exist in the schema or be an allowed extension', () => { const testStrings = { takesValue: 'Duration/3 ms', - full: 'Left-side', + full: 'Left-side-of', extensionAllowed: 'Human/Driver', leafExtension: 'Sensory-event/Something', nonExtensionAllowed: 'Event/Nonsense', @@ -1284,6 +1288,12 @@ describe('HED string and event validation', () => { }), ], illegalComma: [ + converterGenerateIssue( + 'invalidTag', + testStrings.illegalComma, + { tag: 'This' }, + [22, 26], + ), generateIssue('extraCommaOrInvalid', { previousTag: 'Label/This_is_a_label', tag: 'This/Is/A/Tag', @@ -1445,7 +1455,7 @@ describe('HED string and event validation', () => { * * @param {object} testStrings A mapping of test strings. * @param {object} expectedIssues The expected issues for each test string. - * @param {function(HedValidator, ParsedHedGroup): void} testFunction A test-specific function that executes the required validation check. + * @param {function(Hed3Validator, ParsedHedGroup): void} testFunction A test-specific function that executes the required validation check. * @param {object?} testOptions Any needed custom options for the validator. */ const validatorSemantic = function ( @@ -1474,20 +1484,20 @@ describe('HED string and event validation', () => { tagGroupDefinition: '(Definition/TagGroupDefinition, (Square, RGB-blue))', illegalSiblingDefinition: - '(Definition/IllegalSiblingDefinition, Train, (Visual))', + '(Definition/IllegalSiblingDefinition, Train, (Rectangle))', nestedDefinition: - '(Definition/NestedDefinition, (Screen, (Definition/InnerDefinition, (Square))))', + '(Definition/NestedDefinition, (Touchscreen, (Definition/InnerDefinition, (Square))))', multipleTagGroupDefinition: - '(Definition/MultipleTagGroupDefinition, (Screen), (Square))', + '(Definition/MultipleTagGroupDefinition, (Touchscreen), (Square))', defExpandOnly: '(Def-expand/SimpleDefExpand)', tagGroupDefExpand: '(Def-expand/TagGroupDefExpand, (Square, RGB-blue))', illegalSiblingDefExpand: - '(Def-expand/IllegalSiblingDefExpand, Train, (Visual))', + '(Def-expand/IllegalSiblingDefExpand, Train, (Rectangle))', nestedDefExpand: - '(Def-expand/NestedDefExpand, (Screen, (Def-expand/InnerDefExpand, (Square))))', + '(Def-expand/NestedDefExpand, (Touchscreen, (Def-expand/InnerDefExpand, (Square))))', multipleTagGroupDefExpand: - '(Def-expand/MultipleTagGroupDefExpand, (Screen), (Square))', + '(Def-expand/MultipleTagGroupDefExpand, (Touchscreen), (Square))', mixedDefinitionFirst: '(Definition/DefinitionFirst, Def-expand/DefExpandSecond, (Square))', mixedDefExpandFirst: @@ -1655,7 +1665,7 @@ describe('HED string and event validation', () => { singlePlaceholderWithValidDefinitionPlaceholder: 'Duration/#, (Definition/SinglePlaceholderWithValidPlaceholderDefinition/#, (RGB-green/#))', nestedDefinitionPlaceholder: - '(Definition/NestedPlaceholderDefinition/#, (Screen, (Square, RGB-blue/#)))', + '(Definition/NestedPlaceholderDefinition/#, (Touchscreen, (Square, RGB-blue/#)))', threePlaceholderDefinition: '(Definition/ThreePlaceholderDefinition/#, (RGB-green/#, RGB-blue/#))', fourPlaceholderDefinition: @@ -1680,7 +1690,7 @@ describe('HED string and event validation', () => { singlePlaceholderWithValidDefinitionPlaceholder: 'Duration/#, (Definition/SinglePlaceholderWithValidPlaceholderDefinition/#, (RGB-green/#))', nestedDefinitionPlaceholder: - '(Definition/NestedPlaceholderDefinition/#, (Screen, (Square, RGB-blue/#)))', + '(Definition/NestedPlaceholderDefinition/#, (Touchscreen, (Square, RGB-blue/#)))', threePlaceholderDefinition: '(Definition/ThreePlaceholderDefinition/#, (RGB-green/#, RGB-blue/#))', fourPlaceholderDefinition: diff --git a/tests/schema.spec.js b/tests/schema.spec.js index 13c34542..8287e642 100644 --- a/tests/schema.spec.js +++ b/tests/schema.spec.js @@ -1,5 +1,5 @@ const assert = require('chai').assert -const schema = require('../validator/schema') +const schema = require('../validator/schema/init') const schemaCommon = require('../common/schema') const fallbackHedSchemaPath = schemaCommon.config.fallbackFilePath @@ -29,24 +29,24 @@ describe('HED schemas', () => { }) }) - /* - describe('Remote HED library schemas', function() { - it('can be loaded from a central GitHub repository', function() { + describe.skip('Remote HED library schemas', () => { + it('can be loaded from a central GitHub repository', () => { const remoteHedSchemaLibrary = 'test' const remoteHedSchemaVersion = '0.0.1' - return schemaUtils - .loadSchema({ + return schema + .buildSchema({ library: remoteHedSchemaLibrary, version: remoteHedSchemaVersion, }) - .then(hedSchema => { - const schema = new schemaUtils.Schema(hedSchema) - assert.strictEqual(schema.library, remoteHedSchemaLibrary) - assert.strictEqual(schema.version, remoteHedSchemaVersion) + .then((hedSchemas) => { + const hedSchema = hedSchemas.librarySchemas.get( + remoteHedSchemaLibrary, + ) + assert.strictEqual(hedSchema.library, remoteHedSchemaLibrary) + assert.strictEqual(hedSchema.version, remoteHedSchemaVersion) }) }) }) - */ describe('Fallback HED schemas', () => { it('loads the fallback schema if a remote schema cannot be found', () => { @@ -350,8 +350,9 @@ describe('HED schemas', () => { }) }) - describe('HED-3G schemas', () => { - const localHedSchemaFile = 'tests/data/HED8.0.0-alpha.3.xml' + // TODO: Rewrite + describe.skip('HED-3G schemas', () => { + const localHedSchemaFile = 'tests/data/HED8.0.0.xml' let hedSchemaPromise beforeAll(() => { diff --git a/tests/stringParser.spec.js b/tests/stringParser.spec.js index 3838d7d6..d662606b 100644 --- a/tests/stringParser.spec.js +++ b/tests/stringParser.spec.js @@ -4,14 +4,18 @@ const { buildSchema } = require('../converter/schema') const { parseHedString, splitHedString } = require('../validator/stringParser') const { ParsedHedTag } = require('../validator/types/parsedHed') const { generateIssue } = require('../common/issues/issues') +const { recursiveMap } = require('../utils/array') describe('HED string parsing', () => { const nullSchema = new Schemas(null) - const originalMap = (parsedTag) => { - return parsedTag.originalTag - } + /** + * Retrieve the original tag from a parsed HED tag object. + * @param {ParsedHedTag} parsedTag The parsed tag. + * @returns {string} The original tag. + */ + const originalMap = (parsedTag) => parsedTag.originalTag - const hedSchemaFile = 'tests/data/HED8.0.0-alpha.1.xml' + const hedSchemaFile = 'tests/data/HED8.0.0.xml' let hedSchemaPromise beforeAll(() => { @@ -48,8 +52,8 @@ describe('HED string parsing', () => { expectedResults[testStringKey], testStrings[testStringKey], ) - assert.sameDeepMembers( - Object.values(testIssues).flat(), + assert.deepOwnInclude( + testIssues, expectedIssues[testStringKey], testStrings[testStringKey], ) @@ -60,32 +64,33 @@ describe('HED string parsing', () => { it('cannot have invalid characters', () => { const testStrings = { openingCurly: - '/Attribute/Object side/Left,/Participant/Effect{/Body part/Arm', + 'Relation/Spatial-relation/Left-side-of,/Action/Move/Bend{/Upper-extremity/Elbow', closingCurly: - '/Attribute/Object side/Left,/Participant/Effect}/Body part/Arm', + 'Relation/Spatial-relation/Left-side-of,/Action/Move/Bend}/Upper-extremity/Elbow', openingSquare: - '/Attribute/Object side/Left,/Participant/Effect[/Body part/Arm', + 'Relation/Spatial-relation/Left-side-of,/Action/Move/Bend[/Upper-extremity/Elbow', closingSquare: - '/Attribute/Object side/Left,/Participant/Effect]/Body part/Arm', - tilde: '/Attribute/Object side/Left,/Participant/Effect~/Body part/Arm', + 'Relation/Spatial-relation/Left-side-of,/Action/Move/Bend]/Upper-extremity/Elbow', + tilde: + 'Relation/Spatial-relation/Left-side-of,/Action/Move/Bend~/Upper-extremity/Elbow', } const expectedResultList = [ new ParsedHedTag( - '/Attribute/Object side/Left', - '/Attribute/Object side/Left', - [0, 27], + 'Relation/Spatial-relation/Left-side-of', + 'Relation/Spatial-relation/Left-side-of', + [0, 38], nullSchema, ), new ParsedHedTag( - '/Participant/Effect', - '/Participant/Effect', - [28, 47], + '/Action/Move/Bend', + '/Action/Move/Bend', + [39, 56], nullSchema, ), new ParsedHedTag( - '/Body part/Arm', - '/Body part/Arm', - [48, 62], + '/Upper-extremity/Elbow', + '/Upper-extremity/Elbow', + [57, 79], nullSchema, ), ] @@ -97,41 +102,51 @@ describe('HED string parsing', () => { tilde: expectedResultList, } const expectedIssues = { - openingCurly: [ - generateIssue('invalidCharacter', { - character: '{', - index: 47, - string: testStrings.openingCurly, - }), - ], - closingCurly: [ - generateIssue('invalidCharacter', { - character: '}', - index: 47, - string: testStrings.closingCurly, - }), - ], - openingSquare: [ - generateIssue('invalidCharacter', { - character: '[', - index: 47, - string: testStrings.openingSquare, - }), - ], - closingSquare: [ - generateIssue('invalidCharacter', { - character: ']', - index: 47, - string: testStrings.closingSquare, - }), - ], - tilde: [ - generateIssue('invalidCharacter', { - character: '~', - index: 47, - string: testStrings.tilde, - }), - ], + openingCurly: { + syntax: [ + generateIssue('invalidCharacter', { + character: '{', + index: 56, + string: testStrings.openingCurly, + }), + ], + }, + closingCurly: { + syntax: [ + generateIssue('invalidCharacter', { + character: '}', + index: 56, + string: testStrings.closingCurly, + }), + ], + }, + openingSquare: { + syntax: [ + generateIssue('invalidCharacter', { + character: '[', + index: 56, + string: testStrings.openingSquare, + }), + ], + }, + closingSquare: { + syntax: [ + generateIssue('invalidCharacter', { + character: ']', + index: 56, + string: testStrings.closingSquare, + }), + ], + }, + tilde: { + syntax: [ + generateIssue('invalidCharacter', { + character: '~', + index: 56, + string: testStrings.tilde, + }), + ], + }, } validatorWithIssues( testStrings, @@ -144,36 +159,36 @@ describe('HED string parsing', () => { }) }) - describe('Lists of HED Tags', () => { + describe('Lists of HED tags', () => { it('should be an array', () => { const hedString = - 'Event/Category/Experimental stimulus,Item/Object/Vehicle/Train,Attribute/Visual/Color/Purple' + 'Event/Category/Sensory-event,Item/Object/Man-made-object/Vehicle/Train,Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/CSS-color/Purple-color/Purple' const [result] = splitHedString(hedString, nullSchema) - assert(result instanceof Array) + assert.isTrue(Array.isArray(result)) }) it('should include each top-level tag as its own single element', () => { const hedString = - 'Event/Category/Experimental stimulus,Item/Object/Vehicle/Train,Attribute/Visual/Color/Purple' + 'Event/Category/Sensory-event,Item/Object/Man-made-object/Vehicle/Train,Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/CSS-color/Purple-color/Purple' const [result, issues] = splitHedString(hedString, nullSchema) assert.deepStrictEqual(Object.values(issues).flat(), []) assert.deepStrictEqual(result, [ new ParsedHedTag( - 'Event/Category/Experimental stimulus', - 'Event/Category/Experimental stimulus', - [0, 36], + 'Event/Category/Sensory-event', + 'Event/Category/Sensory-event', + [0, 28], nullSchema, ), new ParsedHedTag( - 'Item/Object/Vehicle/Train', - 'Item/Object/Vehicle/Train', - [37, 62], + 'Item/Object/Man-made-object/Vehicle/Train', + 'Item/Object/Man-made-object/Vehicle/Train', + [29, 70], nullSchema, ), new ParsedHedTag( - 'Attribute/Visual/Color/Purple', - 'Attribute/Visual/Color/Purple', - [63, 92], + 'Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/CSS-color/Purple-color/Purple', + 'Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/CSS-color/Purple-color/Purple', + [71, 167], nullSchema, ), ]) @@ -181,32 +196,32 @@ describe('HED string parsing', () => { it('should include each group as its own single element', () => { const hedString = - '/Action/Reach/To touch,(/Attribute/Object side/Left,/Participant/Effect/Body part/Arm),/Attribute/Location/Screen/Top/70 px,/Attribute/Location/Screen/Left/23 px' + '/Action/Move/Flex,(Relation/Spatial-relation/Left-side-of,/Action/Move/Bend,/Upper-extremity/Elbow),/Position/X-position/70 px,/Position/Y-position/23 px' const [result, issues] = splitHedString(hedString, nullSchema) assert.deepStrictEqual(Object.values(issues).flat(), []) assert.deepStrictEqual(result, [ new ParsedHedTag( - '/Action/Reach/To touch', - '/Action/Reach/To touch', - [0, 22], + '/Action/Move/Flex', + '/Action/Move/Flex', + [0, 17], nullSchema, ), new ParsedHedTag( - '(/Attribute/Object side/Left,/Participant/Effect/Body part/Arm)', - '(/Attribute/Object side/Left,/Participant/Effect/Body part/Arm)', - [23, 86], + '(Relation/Spatial-relation/Left-side-of,/Action/Move/Bend,/Upper-extremity/Elbow)', + '(Relation/Spatial-relation/Left-side-of,/Action/Move/Bend,/Upper-extremity/Elbow)', + [18, 99], nullSchema, ), new ParsedHedTag( - '/Attribute/Location/Screen/Top/70 px', - '/Attribute/Location/Screen/Top/70 px', - [87, 123], + '/Position/X-position/70 px', + '/Position/X-position/70 px', + [100, 126], nullSchema, ), new ParsedHedTag( - '/Attribute/Location/Screen/Left/23 px', - '/Attribute/Location/Screen/Left/23 px', - [124, 161], + '/Position/Y-position/23 px', + '/Position/Y-position/23 px', + [127, 153], nullSchema, ), ]) @@ -214,9 +229,9 @@ describe('HED string parsing', () => { it('should not include double quotes', () => { const doubleQuoteString = - 'Event/Category/Experimental stimulus,"Item/Object/Vehicle/Train",Attribute/Visual/Color/Purple' + 'Event/Category/Sensory-event,"Item/Object/Man-made-object/Vehicle/Train",Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/CSS-color/Purple-color/Purple' const normalString = - 'Event/Category/Experimental stimulus,Item/Object/Vehicle/Train,Attribute/Visual/Color/Purple' + 'Event/Category/Sensory-event,Item/Object/Man-made-object/Vehicle/Train,Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/CSS-color/Purple-color/Purple' const [doubleQuoteResult, doubleQuoteIssues] = splitHedString( doubleQuoteString, nullSchema, @@ -242,23 +257,23 @@ describe('HED string parsing', () => { it('should not include blanks', () => { const testStrings = { doubleComma: - '/Item/Object/Vehicle/Car,,/Attribute/Object control/Perturb', + '/Item/Object/Man-made-object/Vehicle/Car,,/Action/Perform/Operate', doubleInvalidCharacter: - '/Item/Object/Vehicle/Car[]/Attribute/Object control/Perturb', + '/Item/Object/Man-made-object/Vehicle/Car[]/Action/Perform/Operate', trailingBlank: - '/Item/Object/Vehicle/Car, /Attribute/Object control/Perturb,', + '/Item/Object/Man-made-object/Vehicle/Car, /Action/Perform/Operate,', } const expectedList = [ new ParsedHedTag( - '/Item/Object/Vehicle/Car', - '/Item/Object/Vehicle/Car', - [0, 24], + '/Item/Object/Man-made-object/Vehicle/Car', + '/Item/Object/Man-made-object/Vehicle/Car', + [0, 40], nullSchema, ), new ParsedHedTag( - '/Attribute/Object control/Perturb', - '/Attribute/Object control/Perturb', - [26, 59], + '/Action/Perform/Operate', + '/Action/Perform/Operate', + [42, 65], nullSchema, ), ] @@ -268,20 +283,22 @@ describe('HED string parsing', () => { trailingBlank: expectedList, } const expectedIssues = { - doubleComma: [], - doubleInvalidCharacter: [ - generateIssue('invalidCharacter', { - character: '[', - index: 24, - string: testStrings.doubleInvalidCharacter, - }), - generateIssue('invalidCharacter', { - character: ']', - index: 25, - string: testStrings.doubleInvalidCharacter, - }), - ], - trailingBlank: [], + doubleComma: {}, + doubleInvalidCharacter: { + syntax: [ + generateIssue('invalidCharacter', { + character: '[', + index: 40, + string: testStrings.doubleInvalidCharacter, + }), + generateIssue('invalidCharacter', { + character: ']', + index: 41, + string: testStrings.doubleInvalidCharacter, + }), + ], + }, + trailingBlank: {}, } validatorWithIssues( testStrings, @@ -294,26 +311,23 @@ describe('HED string parsing', () => { }) }) - describe('Formatted HED Tags', () => { + describe('Formatted HED tags', () => { it('should be lowercase and not have leading or trailing double quotes or slashes', () => { // Correct formatting - const formattedHedTag = 'event/category/experimental stimulus' + const formattedHedTag = 'event/category/sensory-event' const testStrings = { formatted: formattedHedTag, - openingDoubleQuote: '"Event/Category/Experimental stimulus', - closingDoubleQuote: 'Event/Category/Experimental stimulus"', - openingAndClosingDoubleQuote: '"Event/Category/Experimental stimulus"', - openingSlash: '/Event/Category/Experimental stimulus', - closingSlash: 'Event/Category/Experimental stimulus/', - openingAndClosingSlash: '/Event/Category/Experimental stimulus/', - openingDoubleQuotedSlash: '"/Event/Category/Experimental stimulus', - closingDoubleQuotedSlash: 'Event/Category/Experimental stimulus/"', - openingSlashClosingDoubleQuote: - '/Event/Category/Experimental stimulus"', - closingSlashOpeningDoubleQuote: - '"Event/Category/Experimental stimulus/', - openingAndClosingDoubleQuotedSlash: - '"/Event/Category/Experimental stimulus/"', + openingDoubleQuote: '"Event/Category/Sensory-event', + closingDoubleQuote: 'Event/Category/Sensory-event"', + openingAndClosingDoubleQuote: '"Event/Category/Sensory-event"', + openingSlash: '/Event/Category/Sensory-event', + closingSlash: 'Event/Category/Sensory-event/', + openingAndClosingSlash: '/Event/Category/Sensory-event/', + openingDoubleQuotedSlash: '"/Event/Category/Sensory-event', + closingDoubleQuotedSlash: 'Event/Category/Sensory-event/"', + openingSlashClosingDoubleQuote: '/Event/Category/Sensory-event"', + closingSlashOpeningDoubleQuote: '"Event/Category/Sensory-event/', + openingAndClosingDoubleQuotedSlash: '"/Event/Category/Sensory-event/"', } const expectedResults = { formatted: formattedHedTag, @@ -336,35 +350,42 @@ describe('HED string parsing', () => { }) }) - describe('Parsed HED Tags', () => { + describe('Parsed HED strings', () => { it('must have the correct number of tags, top-level tags, and groups', () => { const hedString = - '/Action/Reach/To touch,(/Attribute/Object side/Left,/Participant/Effect/Body part/Arm),/Attribute/Location/Screen/Top/70 px,/Attribute/Location/Screen/Left/23 px' + '/Action/Move/Flex,(Relation/Spatial-relation/Left-side-of,/Action/Move/Bend,/Upper-extremity/Elbow),/Position/X-position/70 px,/Position/Y-position/23 px' const [parsedString, issues] = parseHedString(hedString, nullSchema) assert.deepStrictEqual(Object.values(issues).flat(), []) assert.sameDeepMembers(parsedString.tags.map(originalMap), [ - '/Action/Reach/To touch', - '/Attribute/Object side/Left', - '/Participant/Effect/Body part/Arm', - '/Attribute/Location/Screen/Top/70 px', - '/Attribute/Location/Screen/Left/23 px', + '/Action/Move/Flex', + 'Relation/Spatial-relation/Left-side-of', + '/Action/Move/Bend', + '/Upper-extremity/Elbow', + '/Position/X-position/70 px', + '/Position/Y-position/23 px', ]) assert.sameDeepMembers(parsedString.topLevelTags.map(originalMap), [ - '/Action/Reach/To touch', - '/Attribute/Location/Screen/Top/70 px', - '/Attribute/Location/Screen/Left/23 px', + '/Action/Move/Flex', + '/Position/X-position/70 px', + '/Position/Y-position/23 px', ]) assert.sameDeepMembers( parsedString.tagGroups.map((group) => group.tags.map(originalMap)), - [['/Attribute/Object side/Left', '/Participant/Effect/Body part/Arm']], + [ + [ + 'Relation/Spatial-relation/Left-side-of', + '/Action/Move/Bend', + '/Upper-extremity/Elbow', + ], + ], ) }) it('must include properly formatted tags', () => { const hedString = - '/Action/Reach/To touch,(/Attribute/Object side/Left,/Participant/Effect/Body part/Arm),/Attribute/Location/Screen/Top/70 px,/Attribute/Location/Screen/Left/23 px' + '/Action/Move/Flex,(Relation/Spatial-relation/Left-side-of,/Action/Move/Bend,/Upper-extremity/Elbow),/Position/X-position/70 px,/Position/Y-position/23 px' const formattedHedString = - 'action/reach/to touch,(attribute/object side/left,participant/effect/body part/arm),attribute/location/screen/top/70 px,attribute/location/screen/left/23 px' + 'action/move/flex,(relation/spatial-relation/left-side-of,action/move/bend,upper-extremity/elbow),position/x-position/70 px,position/y-position/23 px' const [parsedString, issues] = parseHedString(hedString, nullSchema) const [parsedFormattedString, formattedIssues] = parseHedString( formattedHedString, @@ -384,6 +405,89 @@ describe('HED string parsing', () => { parsedFormattedString.topLevelTags.map(originalMap), ) }) + + it('must correctly handle multiple levels of parentheses', () => { + const testStrings = { + shapes: 'Square,(Definition/RedCircle,(Circle,Red)),Rectangle', + vehicles: + 'Car,(Definition/TrainVelocity/#,(Train,(Measurement-device/Odometer,Data-maximum/160,Speed/# kph),Blue,Age/12,(Navigational-object/Railway,Data-maximum/150)))', + typing: + '((Human-agent,Joyful),Press,Keyboard-key/F),(Braille,Character/A,Screen-window)', + } + const expectedTags = { + shapes: [ + 'Square', + 'Definition/RedCircle', + 'Circle', + 'Red', + 'Rectangle', + ], + vehicles: [ + 'Car', + 'Definition/TrainVelocity/#', + 'Train', + 'Measurement-device/Odometer', + 'Data-maximum/160', + 'Speed/# kph', + 'Blue', + 'Age/12', + 'Navigational-object/Railway', + 'Data-maximum/150', + ], + typing: [ + 'Human-agent', + 'Joyful', + 'Press', + 'Keyboard-key/F', + 'Braille', + 'Character/A', + 'Screen-window', + ], + } + const expectedGroups = { + shapes: [['Definition/RedCircle', ['Circle', 'Red']]], + vehicles: [ + [ + 'Definition/TrainVelocity/#', + [ + 'Train', + [ + 'Measurement-device/Odometer', + 'Data-maximum/160', + 'Speed/# kph', + ], + 'Blue', + 'Age/12', + ['Navigational-object/Railway', 'Data-maximum/150'], + ], + ], + ], + typing: [ + [['Human-agent', 'Joyful'], 'Press', 'Keyboard-key/F'], + ['Braille', 'Character/A', 'Screen-window'], + ], + } + return hedSchemaPromise.then((hedSchema) => { + for (const testStringKey of Object.keys(testStrings)) { + const testString = testStrings[testStringKey] + const [parsedString, issues] = parseHedString(testString, hedSchema) + assert.deepStrictEqual(Object.values(issues).flat(), []) + assert.sameDeepMembers( + parsedString.tags.map(originalMap), + expectedTags[testStringKey], + testString, + ) + assert.deepStrictEqual( + recursiveMap( + originalMap, + parsedString.tagGroups.map((tagGroup) => tagGroup.nestedGroups()), + ), + expectedGroups[testStringKey], + testString, + ) + } + }) + }) }) describe('Canonical HED tags', () => { @@ -396,7 +500,7 @@ describe('HED string parsing', () => { simple: ['Item/Object/Man-made-object/Vehicle/Car'], groupAndTag: [ 'Item/Object/Man-made-object/Vehicle/Train', - 'Attribute/Sensory/Visual/Color/RGB-color/RGB-red/0.5', + 'Property/Sensory-property/Sensory-attribute/Visual-attribute/Color/RGB-color/RGB-red/0.5', 'Item/Object/Man-made-object/Vehicle/Car', ], } diff --git a/utils/__tests__/hed.spec.js b/utils/__tests__/hed.spec.js index bcc1511c..79dc9c5f 100644 --- a/utils/__tests__/hed.spec.js +++ b/utils/__tests__/hed.spec.js @@ -1,6 +1,6 @@ const assert = require('chai').assert const hed = require('../hed') -const schema = require('../../validator/schema') +const schema = require('../../validator/schema/init') describe('HED tag string utility functions', () => { describe('Syntactic utility functions', () => { @@ -188,8 +188,6 @@ describe('HED tag string utility functions', () => { }) }) - - const validatorBase = function ( testStrings, expectedResults, @@ -234,7 +232,6 @@ describe('HED tag string utility functions', () => { ) } - /* it('should correctly determine if a tag exists', () => { const testStrings = { direction: 'attribute/direction/left', @@ -422,9 +419,8 @@ describe('HED tag string utility functions', () => { }, ) }) - */ - it('should strip valid units from a value', () => { + it.only('should strip valid units from a value', () => { const dollarsString = '$25.99' const volumeString = '100 m^3' const prefixedVolumeString = '100 cm^3' @@ -467,7 +463,7 @@ describe('HED tag string utility functions', () => { }) }) - /*it('should correctly determine if a tag allows extensions', () => { + it('should correctly determine if a tag allows extensions', () => { const testStrings = { vehicle: 'item/object/vehicle/boat', color: 'attribute/color/red/0.5', @@ -488,6 +484,6 @@ describe('HED tag string utility functions', () => { ) }, ) - })*/ + }) }) }) diff --git a/utils/array.js b/utils/array.js index fd4ebf3a..8ef24940 100644 --- a/utils/array.js +++ b/utils/array.js @@ -42,8 +42,25 @@ const asArray = function (array) { return Array.isArray(array) ? array : [array] } +/** + * Apply a function recursively to an array. + * + * @template T,U + * @param {function(T): U} fn The function to apply. + * @param {T[]} array The array to map. + * @returns {U[]} The mapped array. + */ +function recursiveMap(fn, array) { + if (Array.isArray(array)) { + return array.map((element) => recursiveMap(fn, element)) + } else { + return fn(array) + } +} + module.exports = { getElementCount: getElementCount, flattenDeep: flattenDeep, asArray: asArray, + recursiveMap: recursiveMap, } diff --git a/utils/types.js b/utils/types.js index 3b1817cc..394ad4f6 100644 --- a/utils/types.js +++ b/utils/types.js @@ -3,33 +3,39 @@ /** * Mix-in/superclass for property memoization until we can get away with private fields. */ -class Memoizer { - constructor() { - this._memoizedProperties = new Map() - } - - /** - * Memoize the property. - * - * @template T - * @param {string} propertyName The property name - * @param {function() : T} valueComputer A function to compute the value. - * @return {T} The computed value. - * @protected - */ - _memoize(propertyName, valueComputer) { - if (!propertyName) { - throw new Error('Invalid property name in Memoizer subclass.') +const MemoizerMixin = (Base) => { + return class extends Base { + constructor(...args) { + super(...args) + this._memoizedProperties = new Map() } - if (this._memoizedProperties.has(propertyName)) { - return this._memoizedProperties.get(propertyName) + + /** + * Memoize the property. + * + * @template T + * @param {string} propertyName The property name + * @param {function() : T} valueComputer A function to compute the value. + * @return {T} The computed value. + * @protected + */ + _memoize(propertyName, valueComputer) { + if (!propertyName) { + throw new Error('Invalid property name in Memoizer subclass.') + } + if (this._memoizedProperties.has(propertyName)) { + return this._memoizedProperties.get(propertyName) + } + const value = valueComputer() + this._memoizedProperties.set(propertyName, value) + return value } - const value = valueComputer() - this._memoizedProperties.set(propertyName, value) - return value } } +class Memoizer extends MemoizerMixin(Object) {} + module.exports = { Memoizer: Memoizer, + MemoizerMixin: MemoizerMixin, } diff --git a/utils/xpath.js b/utils/xpath.js index 2859130f..1403141f 100644 --- a/utils/xpath.js +++ b/utils/xpath.js @@ -5,7 +5,9 @@ const childToParent = { unitModifier: 'unitModifiers', unitClassDefinition: 'unitClassDefinitions', unitModifierDefinition: 'unitModifierDefinitions', + valueClassDefinition: 'valueClassDefinitions', schemaAttributeDefinition: 'schemaAttributeDefinitions', + propertyDefinition: 'propertyDefinitions', } /** diff --git a/validator/bids/types.js b/validator/bids/types.js index 7dd1859a..f6b02d56 100644 --- a/validator/bids/types.js +++ b/validator/bids/types.js @@ -42,9 +42,22 @@ class BidsTsvFile extends BidsFile { super(name, file) /** * This file's parsed TSV data. - * @type {object} + * @type {object} */ this.parsedTsv = parsedTsv + this.parseHedColumn() + } + + parseHedColumn() { + const hedColumnIndex = this.parsedTsv.headers.indexOf('HED') + if (hedColumnIndex === -1) { + this.hedColumnHedStrings = [] + } else { + this.hedColumnHedStrings = this.parsedTsv.rows + .slice(1) + .map((rowCells) => rowCells[hedColumnIndex]) + .map((hedCell) => (hedCell && hedCell !== 'n/a' ? hedCell : '')) + } } } @@ -56,37 +69,52 @@ class BidsEventFile extends BidsTsvFile { * @type {string[]} */ this.potentialSidecars = potentialSidecars + + this.mergedSidecar = new BidsSidecar(name, mergedDictionary, null) + this.sidecarHedData = this.mergedSidecar.hedData + } +} + +class BidsSidecar extends BidsJsonFile { + constructor(name, sidecarData = {}, file) { + super(name, file) /** - * The merged sidecar dictionary. + * The unparsed sidecar data. * @type {object} */ - this.mergedDictionary = mergedDictionary + this.sidecarData = sidecarData - this.sidecarHedData = this.mergeSidecarHed() + this.filterHedStrings() + this.categorizeHedStrings() } - mergeSidecarHed() { - const sidecarHedTags = Object.entries(this.mergedDictionary) + filterHedStrings() { + const sidecarHedTags = Object.entries(this.sidecarData) .map(([sidecarKey, sidecarValue]) => { if (sidecarValueHasHed(sidecarValue)) { return [sidecarKey, sidecarValue.HED] } else { - return false + return [] } }) - .filter((x) => Boolean(x)) - return new Map(sidecarHedTags) + .filter((x) => x.length > 0) + this.hedData = new Map(sidecarHedTags) } -} -class BidsSidecar extends BidsJsonFile { - constructor(name, sidecarData = {}, file) { - super(name, file) - /** - * The unparsed sidecar data. - * @type {object} - */ - this.sidecarData = sidecarData + categorizeHedStrings() { + this.hedValueStrings = [] + this.hedCategoricalStrings = [] + for (const sidecarValue of this.hedData.values()) { + if (typeof sidecarValue === 'string') { + this.hedValueStrings.push(sidecarValue) + } else { + this.hedCategoricalStrings.push(...Object.values(sidecarValue)) + } + } + } + + get hedStrings() { + return this.hedValueStrings.concat(this.hedCategoricalStrings) } } diff --git a/validator/bids/validate.js b/validator/bids/validate.js index 2a649b79..2c5f14ea 100644 --- a/validator/bids/validate.js +++ b/validator/bids/validate.js @@ -1,6 +1,6 @@ -const { validateHedDataset } = require('../dataset') +const { validateHedDatasetWithContext } = require('../dataset') const { validateHedString } = require('../event') -const { buildSchema } = require('../schema') +const { buildSchema } = require('../schema/init') const { sidecarValueHasHed } = require('../../utils/bids') const { generateIssue } = require('../../common/issues/issues') const { fallbackFilePath } = require('../../common/schema') @@ -52,27 +52,37 @@ function validateBidsDataset(dataset, schemaDefinition) { function buildBidsSchema(dataset, schemaDefinition) { return buildSchema(schemaDefinition, false).then((hedSchemas) => { - return validateDataset(dataset, hedSchemas).catch( + return validateFullDataset(dataset, hedSchemas).catch( generateInternalErrorBidsIssue, ) }) } -function validateDataset(dataset, hedSchemas) { - const [sidecarErrorsFound, sidecarIssues] = validateSidecars( - dataset.sidecarData, - hedSchemas, - ) - if (sidecarErrorsFound) { - return Promise.resolve(sidecarIssues) +function validateFullDataset(dataset, hedSchemas) { + try { + const [sidecarErrorsFound, sidecarIssues] = validateSidecars( + dataset.sidecarData, + hedSchemas, + ) + const [hedColumnErrorsFound, hedColumnIssues] = validateHedColumn( + dataset.eventData, + hedSchemas, + ) + if (sidecarErrorsFound || hedColumnErrorsFound) { + return Promise.resolve([].concat(sidecarIssues, hedColumnIssues)) + } + const eventFileIssues = dataset.eventData.map((eventFileData) => { + return validateBidsEventFile(eventFileData, hedSchemas) + }) + return Promise.resolve( + [].concat(sidecarIssues, hedColumnIssues, ...eventFileIssues), + ) + } catch (e) { + return Promise.reject(e) } - const eventFileIssues = dataset.eventData.map((eventFileData) => { - return validateBidsEventFile(eventFileData, hedSchemas) - }) - return Promise.resolve([].concat(sidecarIssues, ...eventFileIssues)) } -function validateBidsEventFile(eventFileData, hedSchema) { +function validateBidsEventFile(eventFileData, hedSchemas) { // get the json sidecar dictionary associated with the event data const [hedStrings, tsvIssues] = parseTsvHed(eventFileData) @@ -81,7 +91,7 @@ function validateBidsEventFile(eventFileData, hedSchema) { } else { const datasetIssues = validateCombinedDataset( hedStrings, - hedSchema, + hedSchemas, eventFileData, ) return [].concat(tsvIssues, datasetIssues) @@ -89,32 +99,18 @@ function validateBidsEventFile(eventFileData, hedSchema) { } function validateSidecars(sidecarData, hedSchema) { - let issues = [] + const issues = [] let sidecarErrorsFound = false // validate the HED strings in the json sidecars for (const sidecar of sidecarData) { - const sidecarDictionary = sidecar.sidecarData - const sidecarHedValueStrings = [] - let sidecarHedCategoricalStrings = [] - const sidecarHedData = - Object.values(sidecarDictionary).filter(sidecarValueHasHed) - for (const sidecarValue of sidecarHedData) { - if (typeof sidecarValue.HED === 'string') { - sidecarHedValueStrings.push(sidecarValue.HED) - } else { - sidecarHedCategoricalStrings = sidecarHedCategoricalStrings.concat( - Object.values(sidecarValue.HED), - ) - } - } - const valueStringIssues = validateSidecarStrings( - sidecarHedValueStrings, + const valueStringIssues = validateStrings( + sidecar.hedValueStrings, hedSchema, sidecar.file, true, ) - const categoricalStringIssues = validateSidecarStrings( - sidecarHedCategoricalStrings, + const categoricalStringIssues = validateStrings( + sidecar.hedCategoricalStrings, hedSchema, sidecar.file, false, @@ -125,40 +121,29 @@ function validateSidecars(sidecarData, hedSchema) { fileIssues.some((fileIssue) => { return fileIssue.isError() }) - issues = issues.concat(fileIssues) + issues.push(...fileIssues) } return [sidecarErrorsFound, issues] } -function validateSidecarStrings( - sidecarHedStrings, - hedSchema, - jsonFileObject, - areValueStrings, -) { - let sidecarIssues = [] - for (const hedString of sidecarHedStrings) { - const [isHedStringValid, hedIssues] = validateHedString( - hedString, - hedSchema, - true, - areValueStrings, +function validateHedColumn(eventData, hedSchemas) { + const issues = eventData.flatMap((eventFileData) => { + return validateStrings( + eventFileData.hedColumnHedStrings, + hedSchemas, + eventFileData.file, + false, ) - if (!isHedStringValid) { - const convertedIssues = convertHedIssuesToBidsIssues( - hedIssues, - jsonFileObject, - ) - sidecarIssues = sidecarIssues.concat(convertedIssues) - } - } - return sidecarIssues + }) + const errorsFound = issues.some((issue) => { + return issue.isError() + }) + return [errorsFound, issues] } function parseTsvHed(eventFileData) { const hedStrings = [] const issues = [] - const hedColumnIndex = eventFileData.parsedTsv.headers.indexOf('HED') const sidecarHedColumnIndices = {} for (const sidecarHedColumn of eventFileData.sidecarHedData.keys()) { const sidecarHedColumnHeader = @@ -167,17 +152,21 @@ function parseTsvHed(eventFileData) { sidecarHedColumnIndices[sidecarHedColumn] = sidecarHedColumnHeader } } - if (hedColumnIndex === -1 && sidecarHedColumnIndices.length === 0) { + if ( + eventFileData.hedColumnHedStrings.length + + sidecarHedColumnIndices.length === + 0 + ) { return [[], []] } - for (const rowCells of eventFileData.parsedTsv.rows.slice(1)) { + eventFileData.parsedTsv.rows.slice(1).forEach((rowCells, rowIndex) => { // get the 'HED' field const hedStringParts = [] - if (rowCells[hedColumnIndex] && rowCells[hedColumnIndex] !== 'n/a') { - hedStringParts.push(rowCells[hedColumnIndex]) + if (eventFileData.hedColumnHedStrings[rowIndex]) { + hedStringParts.push(eventFileData.hedColumnHedStrings[rowIndex]) } - for (const sidecarHedColumn in sidecarHedColumnIndices) { + for (const sidecarHedColumn of Object.keys(sidecarHedColumnIndices)) { const sidecarHedIndex = sidecarHedColumnIndices[sidecarHedColumn] const sidecarHedData = eventFileData.sidecarHedData.get(sidecarHedColumn) const rowCell = rowCells[sidecarHedIndex] @@ -199,17 +188,18 @@ function parseTsvHed(eventFileData) { } } - if (hedStringParts.length === 0) { - continue + if (hedStringParts.length > 0) { + hedStrings.push(hedStringParts.join(',')) } - hedStrings.push(hedStringParts.join(',')) - } + }) + return [hedStrings, issues] } function validateCombinedDataset(hedStrings, hedSchema, eventFileData) { - const [isHedDatasetValid, hedIssues] = validateHedDataset( + const [isHedDatasetValid, hedIssues] = validateHedDatasetWithContext( hedStrings, + eventFileData.mergedSidecar.hedStrings, hedSchema, true, ) @@ -220,10 +210,36 @@ function validateCombinedDataset(hedStrings, hedSchema, eventFileData) { } } +function validateStrings( + hedStrings, + hedSchema, + fileObject, + areValueStrings = false, +) { + const issues = [] + for (const hedString of hedStrings) { + if (!hedString) { + continue + } + const [isHedStringValid, hedIssues] = validateHedString( + hedString, + hedSchema, + true, + areValueStrings, + ) + if (!isHedStringValid) { + const convertedIssues = convertHedIssuesToBidsIssues( + hedIssues, + fileObject, + ) + issues.push(...convertedIssues) + } + } + return issues +} + function convertHedIssuesToBidsIssues(hedIssues, file) { - return hedIssues.map((hedIssue) => { - return new BidsHedIssue(hedIssue, file) - }) + return hedIssues.map((hedIssue) => new BidsHedIssue(hedIssue, file)) } module.exports = validateBidsDataset diff --git a/validator/dataset.js b/validator/dataset.js index 0ca4620d..3c7b0a5f 100644 --- a/validator/dataset.js +++ b/validator/dataset.js @@ -104,12 +104,62 @@ const validateHedDataset = function ( definitions, checkForWarnings, ) - stringIssues.concat(Object.values(parsingIssues)) + const issues = stringIssues.concat(...Object.values(parsingIssues)) if (!stringsValid) { - return [false, stringIssues] + return [false, issues] } - return [definitionIssues.length === 0, definitionIssues.concat(stringIssues)] + return [definitionIssues.length === 0, definitionIssues.concat(issues)] + //return validateDataset(definitions, newHedStrings, hedSchemas) +} + +/** + * Validate a HED dataset with additional context. + * + * @param {string[]} hedStrings The dataset's HED strings. + * @param {string[]} contextHedStrings The dataset's context HED strings. + * @param {Schemas} hedSchemas The HED schema container object. + * @param {boolean} checkForWarnings Whether to check for warnings or only errors. + * @return {[boolean, Issue[]]} Whether the HED dataset is valid and any issues found. + */ +const validateHedDatasetWithContext = function ( + hedStrings, + contextHedStrings, + hedSchemas, + checkForWarnings = false, +) { + if (hedStrings.length + contextHedStrings.length === 0) { + return [true, []] + } + const [parsedHedStrings, parsingIssues] = parseHedStrings( + hedStrings, + hedSchemas, + ) + const [parsedContextHedStrings, contextParsingIssues] = parseHedStrings( + contextHedStrings, + hedSchemas, + ) + const combinedParsedHedStrings = parsedHedStrings.concat( + parsedContextHedStrings, + ) + const [definitions, definitionIssues] = parseDefinitions( + combinedParsedHedStrings, + ) + const [stringsValid, stringIssues] = validateHedEvents( + parsedHedStrings, + hedSchemas, + definitions, + checkForWarnings, + ) + const issues = stringIssues.concat( + ...Object.values(parsingIssues), + ...Object.values(contextParsingIssues), + ) + if (!stringsValid) { + return [false, issues] + } + + return [definitionIssues.length === 0, definitionIssues.concat(issues)] //return validateDataset(definitions, newHedStrings, hedSchemas) } @@ -118,4 +168,5 @@ module.exports = { validateDataset: validateDataset, validateHedEvents: validateHedEvents, validateHedDataset: validateHedDataset, + validateHedDatasetWithContext: validateHedDatasetWithContext, } diff --git a/validator/event/hed3.js b/validator/event/hed3.js index 0f91a8d5..291c27be 100644 --- a/validator/event/hed3.js +++ b/validator/event/hed3.js @@ -7,6 +7,13 @@ const tagGroupType = 'tagGroup' const topLevelTagGroupType = 'topLevelTagGroup' class Hed3Validator extends HedValidator { + /** + * Constructor. + * @param {ParsedHedString} parsedString + * @param {Schemas} hedSchemas + * @param {Map} definitions + * @param {object} options + */ constructor(parsedString, hedSchemas, definitions, options) { super(parsedString, hedSchemas, options) this.definitions = definitions @@ -51,6 +58,116 @@ class Hed3Validator extends HedValidator { this.checkForInvalidTopLevelTagGroupTags() } + _checkForTagAttribute(attribute, fn) { + const tags = this.hedSchemas.baseSchema.entries.definitions + .get('tags') + .getEntriesWithBooleanAttribute(attribute) + for (const tag of tags) { + fn(tag.name) + } + } + + /** + * Check that the unit is valid for the tag's unit class. + * @param {ParsedHed3Tag} tag A HED tag. + */ + checkIfTagUnitClassUnitsAreValid(tag) { + if (tag.existsInSchema || !tag.hasUnitClass) { + return + } + const [foundUnit, validUnit, value] = this.validateUnits(tag) + if (!foundUnit && this.options.checkForWarnings) { + const defaultUnit = tag.defaultUnit + this.pushIssue('unitClassDefaultUsed', { + tag: tag.originalTag, + defaultUnit: defaultUnit, + }) + } else if (!validUnit) { + const tagUnitClassUnits = Array.from(tag.validUnits).map( + (unit) => unit.name, + ) + this.pushIssue('unitClassInvalidUnit', { + tag: tag.originalTag, + unitClassUnits: tagUnitClassUnits.sort().join(','), + }) + } else { + const validValue = this.validateValue(value, true) + if (!validValue) { + this.pushIssue('invalidValue', { tag: tag.originalTag }) + } + } + } + + /** + * Validate a unit and strip it from the value. + * @param {ParsedHed3Tag} tag A HED tag. + * @return {[boolean, boolean, string]} Whether a unit was found, whether it was valid, and the stripped value. + */ + validateUnits(tag) { + const originalTagUnitValue = tag.originalTagName + const tagUnitClassUnits = tag.validUnits + const validUnits = this.hedSchemas.baseSchema.entries.allUnits + const unitStrings = Array.from(validUnits.keys()) + unitStrings.sort((first, second) => { + return second.length - first.length + }) + let actualUnit = utils.HED.getTagName(originalTagUnitValue, ' ') + let noUnitFound = false + if (actualUnit === originalTagUnitValue) { + actualUnit = '' + noUnitFound = true + } + let foundUnit, foundWrongCaseUnit, strippedValue + for (const unitName of unitStrings) { + const unit = validUnits.get(unitName) + const isPrefixUnit = unit.isPrefixUnit + const isUnitSymbol = unit.isUnitSymbol + for (const derivativeUnit of unit.derivativeUnits()) { + if (isPrefixUnit && originalTagUnitValue.startsWith(derivativeUnit)) { + foundUnit = true + noUnitFound = false + strippedValue = originalTagUnitValue + .substring(derivativeUnit.length) + .trim() + } + if (actualUnit === derivativeUnit) { + foundUnit = true + strippedValue = utils.HED.getParentTag(originalTagUnitValue, ' ') + } else if (actualUnit.toLowerCase() === derivativeUnit.toLowerCase()) { + if (isUnitSymbol) { + foundWrongCaseUnit = true + } else { + foundUnit = true + } + strippedValue = utils.HED.getParentTag(originalTagUnitValue, ' ') + } + if (foundUnit) { + const unitIsValid = tagUnitClassUnits.has(unit) + return [true, unitIsValid, strippedValue] + } + } + if (foundWrongCaseUnit) { + return [true, false, strippedValue] + } + } + return [!noUnitFound, false, originalTagUnitValue] + } + + /** + * Determine if a stripped value is valid. + */ + validateValue(value, isNumeric) { + if (value === '#') { + return true + } + // TODO: Replace with full value class-based implementation. + if (isNumeric) { + return utils.string.isNumber(value) + } + const hed3ValidValueCharacters = /^[-a-zA-Z0-9.$%^+_; ]+$/ + return hed3ValidValueCharacters.test(value) + } + /** * Check the syntax of HED 3 definitions. * @@ -168,10 +285,7 @@ class Hed3Validator extends HedValidator { if ( !utils.HED.hedStringIsAGroup(topLevelTag.formattedTag) && (topLevelTag.hasAttribute(tagGroupType) || - this.hedSchemas.baseSchema.attributes.tagHasAttribute( - utils.HED.getParentTag(topLevelTag.formattedTag), - tagGroupType, - )) + topLevelTag.parentHasAttribute(tagGroupType)) ) { this.pushIssue('invalidTopLevelTag', { tag: topLevelTag.originalTag, @@ -188,10 +302,7 @@ class Hed3Validator extends HedValidator { for (const tag of this.parsedString.tags) { if ( tag.hasAttribute(topLevelTagGroupType) || - this.hedSchemas.baseSchema.attributes.tagHasAttribute( - utils.HED.getParentTag(tag.formattedTag), - topLevelTagGroupType, - ) + tag.parentHasAttribute(topLevelTagGroupType) ) { let tagFound = false this.parsedString.topLevelTagGroups.forEach((tagGroup, index) => { diff --git a/validator/event/init.js b/validator/event/init.js index 677b99d0..fd790adc 100644 --- a/validator/event/init.js +++ b/validator/event/init.js @@ -1,6 +1,6 @@ const { parseHedString } = require('../stringParser') const { ParsedHedString } = require('../types/parsedHed') -const { buildSchemaAttributesObject } = require('../schema') +const { buildSchemaAttributesObject } = require('../schema/init') const { Schemas } = require('../../common/schema') const { HedValidator, Hed2Validator } = require('./validator') diff --git a/validator/event/validator.js b/validator/event/validator.js index d0d89a77..b9e56152 100644 --- a/validator/event/validator.js +++ b/validator/event/validator.js @@ -56,13 +56,11 @@ class HedValidator { * Validate the individual HED tags in a parsed HED string object. */ validateIndividualHedTags() { - let issues = [] let previousTag = new ParsedHedTag('', '', [0, 0], this.hedSchemas) for (const tag of this.parsedString.tags) { this.validateIndividualHedTag(tag, previousTag) previousTag = tag } - return issues } /** @@ -151,10 +149,7 @@ class HedValidator { for (const firstTag of tagList) { for (const secondTag of tagList) { - if ( - firstTag !== secondTag && - firstTag.formattedTag === secondTag.formattedTag - ) { + if (firstTag !== secondTag && firstTag.equivalent(secondTag)) { addIssue(firstTag) addIssue(secondTag) } @@ -162,13 +157,6 @@ class HedValidator { } } - _checkForTagAttribute(attribute, fn) { - const tags = this.hedSchemas.baseSchema.attributes.tagAttributes[attribute] - for (const tag of Object.keys(tags)) { - fn(tag) - } - } - /** * Check for multiple instances of a unique tag. */ @@ -202,6 +190,17 @@ class HedValidator { }) } + /** + * Validation check based on a tag attribute. + * + * @param {string} attribute The name of the attribute. + * @param {function (string): void} fn The actual validation code. + * @protected + * @abstract + */ + // eslint-disable-next-line no-unused-vars + _checkForTagAttribute(attribute, fn) {} + /** * Check if a tag is missing a required child. * @@ -218,69 +217,10 @@ class HedValidator { * Check that the unit is valid for the tag's unit class. * * @param {ParsedHedTag} tag A HED tag. + * @abstract */ - checkIfTagUnitClassUnitsAreValid(tag) { - if (tag.existsInSchema || !tag.hasUnitClass) { - return - } - const tagUnitClasses = tag.unitClasses - const originalTagUnitValue = tag.originalTagName - const formattedTagUnitValue = tag.formattedTagName - const tagUnitClassUnits = tag.validUnits - if ( - dateTimeUnitClass in this.hedSchemas.baseSchema.attributes.unitClasses && - tagUnitClasses.includes(dateTimeUnitClass) - ) { - if (!utils.string.isDateTime(formattedTagUnitValue)) { - this.pushIssue('invalidValue', { tag: tag.originalTag }) - } - return - } else if ( - clockTimeUnitClass in this.hedSchemas.baseSchema.attributes.unitClasses && - tagUnitClasses.includes(clockTimeUnitClass) - ) { - if (!utils.string.isClockFaceTime(formattedTagUnitValue)) { - this.pushIssue('invalidValue', { tag: tag.originalTag }) - } - return - } else if ( - timeUnitClass in this.hedSchemas.baseSchema.attributes.unitClasses && - tagUnitClasses.includes(timeUnitClass) && - tag.originalTag.includes(':') - ) { - if (!utils.string.isClockFaceTime(formattedTagUnitValue)) { - this.pushIssue('invalidValue', { tag: tag.originalTag }) - } - return - } - const [foundUnit, validUnit, value] = utils.HED.validateUnits( - originalTagUnitValue, - tagUnitClassUnits, - this.hedSchemas.baseSchema.attributes, - ) - const validValue = utils.HED.validateValue( - value, - this.hedSchemas.baseSchema.attributes.tagHasAttribute( - utils.HED.replaceTagNameWithPound(tag.formattedTag), - 'isNumeric', - ), - this.hedSchemas.isHed3, - ) - if (!foundUnit && this.options.checkForWarnings) { - const defaultUnit = tag.defaultUnit - this.pushIssue('unitClassDefaultUsed', { - tag: tag.originalTag, - defaultUnit: defaultUnit, - }) - } else if (!validUnit) { - this.pushIssue('unitClassInvalidUnit', { - tag: tag.originalTag, - unitClassUnits: tagUnitClassUnits.sort().join(','), - }) - } else if (!validValue) { - this.pushIssue('invalidValue', { tag: tag.originalTag }) - } - } + // eslint-disable-next-line no-unused-vars + checkIfTagUnitClassUnitsAreValid(tag) {} /** * Check the syntax of tag values. @@ -291,7 +231,7 @@ class HedValidator { if (tag.takesValue && !tag.hasUnitClass) { const isValidValue = utils.HED.validateValue( tag.formattedTagName, - this.hedSchemas.baseSchema.attributes.tagHasAttribute( + this.hedSchemas.baseSchema.tagHasAttribute( utils.HED.replaceTagNameWithPound(tag.formattedTag), 'isNumeric', ), @@ -334,7 +274,7 @@ class HedValidator { } else if (!isExtensionAllowedTag) { // This is not a valid tag. this.pushIssue('invalidTag', { tag: tag.originalTag }) - } else if (this.options.checkForWarnings) { + } else if (!this.options.isEventLevel && this.options.checkForWarnings) { // This is an allowed extension. this.pushIssue('extension', { tag: tag.originalTag }) } @@ -481,6 +421,95 @@ class Hed2Validator extends HedValidator { constructor(parsedString, hedSchemas, options) { super(parsedString, hedSchemas, options) } + + _checkForTagAttribute(attribute, fn) { + const tags = this.hedSchemas.baseSchema.attributes.tagAttributes[attribute] + for (const tag of Object.keys(tags)) { + fn(tag) + } + } + + /** + * Check that the unit is valid for the tag's unit class. + * + * @param {ParsedHedTag} tag A HED tag. + */ + checkIfTagUnitClassUnitsAreValid(tag) { + if (tag.existsInSchema || !tag.hasUnitClass) { + return + } + const tagUnitClasses = tag.unitClasses + const originalTagUnitValue = tag.originalTagName + const formattedTagUnitValue = tag.formattedTagName + const tagUnitClassUnits = tag.validUnits + if ( + dateTimeUnitClass in this.hedSchemas.baseSchema.attributes.unitClasses && + tagUnitClasses.includes(dateTimeUnitClass) + ) { + if (!utils.string.isDateTime(formattedTagUnitValue)) { + this.pushIssue('invalidValue', { tag: tag.originalTag }) + } + return + } else if ( + clockTimeUnitClass in this.hedSchemas.baseSchema.attributes.unitClasses && + tagUnitClasses.includes(clockTimeUnitClass) + ) { + if (!utils.string.isClockFaceTime(formattedTagUnitValue)) { + this.pushIssue('invalidValue', { tag: tag.originalTag }) + } + return + } else if ( + timeUnitClass in this.hedSchemas.baseSchema.attributes.unitClasses && + tagUnitClasses.includes(timeUnitClass) && + tag.originalTag.includes(':') + ) { + if (!utils.string.isClockFaceTime(formattedTagUnitValue)) { + this.pushIssue('invalidValue', { tag: tag.originalTag }) + } + return + } + const [foundUnit, validUnit, value] = utils.HED.validateUnits( + originalTagUnitValue, + tagUnitClassUnits, + this.hedSchemas.baseSchema.attributes, + ) + const validValue = utils.HED.validateValue( + value, + this.hedSchemas.baseSchema.tagHasAttribute( + utils.HED.replaceTagNameWithPound(tag.formattedTag), + 'isNumeric', + ), + this.hedSchemas.isHed3, + ) + if (!foundUnit && this.options.checkForWarnings) { + const defaultUnit = tag.defaultUnit + this.pushIssue('unitClassDefaultUsed', { + tag: tag.originalTag, + defaultUnit: defaultUnit, + }) + } else if (!validUnit) { + this.pushIssue('unitClassInvalidUnit', { + tag: tag.originalTag, + unitClassUnits: tagUnitClassUnits.sort().join(','), + }) + } else if (!validValue) { + this.pushIssue('invalidValue', { tag: tag.originalTag }) + } + } + + /** + * Determine if a stripped value is valid. + */ + validateValue(value, isNumeric) { + if (value === '#') { + return true + } + if (isNumeric) { + return utils.string.isNumber(value) + } + const hed2ValidValueCharacters = /^[-a-zA-Z0-9.$%^+_; :]+$/ + return hed2ValidValueCharacters.test(value) + } } module.exports = { diff --git a/validator/index.js b/validator/index.js index ab8527b6..a4fb1eb5 100644 --- a/validator/index.js +++ b/validator/index.js @@ -1,7 +1,7 @@ const BIDS = require('./bids') const dataset = require('./dataset') const event = require('./event') -const schema = require('./schema') +const schema = require('./schema/init') module.exports = { BidsDataset: BIDS.BidsDataset, diff --git a/validator/schema/hed2.js b/validator/schema/hed2.js new file mode 100644 index 00000000..d3b36981 --- /dev/null +++ b/validator/schema/hed2.js @@ -0,0 +1,213 @@ +const arrayUtils = require('../../utils/array') + +// TODO: Switch require once upstream bugs are fixed. +// const xpath = require('xml2js-xpath') +// Temporary +const xpath = require('../../utils/xpath') + +const { SchemaAttributes } = require('./types') + +const defaultUnitForTagAttribute = 'default' +const defaultUnitForUnitClassAttribute = 'defaultUnits' +const defaultUnitForOldUnitClassAttribute = 'default' +const extensionAllowedAttribute = 'extensionAllowed' +const tagDictionaryKeys = [ + 'default', + 'extensionAllowed', + 'isNumeric', + 'position', + 'predicateType', + 'recommended', + 'required', + 'requireChild', + 'tags', + 'takesValue', + 'unique', + 'unitClass', +] +const unitClassDictionaryKeys = ['SIUnit', 'unitSymbol'] +const unitModifierDictionaryKeys = ['SIUnitModifier', 'SIUnitSymbolModifier'] +const tagsDictionaryKey = 'tags' +const tagUnitClassAttribute = 'unitClass' +const unitClassElement = 'unitClass' +const unitClassUnitElement = 'unit' +const unitClassUnitsElement = 'units' +const unitModifierElement = 'unitModifier' + +const lc = (str) => str.toLowerCase() + +const { SchemaParser } = require('./parser') + +class Hed2SchemaParser extends SchemaParser { + parse() { + this.populateDictionaries() + return new SchemaAttributes(this) + } + + populateTagDictionaries() { + this.tagAttributes = {} + for (const dictionaryKey of tagDictionaryKeys) { + const [tags, tagElements] = this.getTagsByAttribute(dictionaryKey) + if (dictionaryKey === extensionAllowedAttribute) { + const tagDictionary = this.stringListToLowercaseTrueDictionary(tags) + const childTagElements = arrayUtils.flattenDeep( + tagElements.map((tagElement) => this.getAllChildTags(tagElement)), + ) + const childTags = childTagElements.map((tagElement) => { + return this.getTagPathFromTagElement(tagElement) + }) + const childDictionary = + this.stringListToLowercaseTrueDictionary(childTags) + this.tagAttributes[extensionAllowedAttribute] = Object.assign( + {}, + tagDictionary, + childDictionary, + ) + } else if (dictionaryKey === defaultUnitForTagAttribute) { + this.populateTagToAttributeDictionary(tags, tagElements, dictionaryKey) + } else if (dictionaryKey === tagUnitClassAttribute) { + this.populateTagUnitClassDictionary(tags, tagElements) + } else if (dictionaryKey === tagsDictionaryKey) { + const tags = this.getAllTags()[0] + this.tags = tags.map(lc) + } else { + this.tagAttributes[dictionaryKey] = + this.stringListToLowercaseTrueDictionary(tags) + } + } + } + + populateUnitClassDictionaries() { + const unitClassElements = this.getElementsByName(unitClassElement) + if (unitClassElements.length === 0) { + this.hasUnitClasses = false + return + } + this.hasUnitClasses = true + this.populateUnitClassUnitsDictionary(unitClassElements) + this.populateUnitClassDefaultUnitDictionary(unitClassElements) + } + + populateUnitClassUnitsDictionary(unitClassElements) { + this.unitClasses = {} + this.unitClassAttributes = {} + this.unitAttributes = {} + for (const unitClassKey of unitClassDictionaryKeys) { + this.unitAttributes[unitClassKey] = {} + } + for (const unitClassElement of unitClassElements) { + const unitClassName = this.getElementTagName(unitClassElement) + this.unitClassAttributes[unitClassName] = {} + const units = + unitClassElement[unitClassUnitsElement][0][unitClassUnitElement] + if (units === undefined) { + const elementUnits = this.getElementTagValue( + unitClassElement, + unitClassUnitsElement, + ) + const units = elementUnits.split(',') + this.unitClasses[unitClassName] = units.map(lc) + continue + } + this.unitClasses[unitClassName] = units.map((element) => element._) + for (const unit of units) { + if (unit.$) { + const unitName = unit._ + for (const unitClassKey of unitClassDictionaryKeys) { + this.unitAttributes[unitClassKey][unitName] = unit.$[unitClassKey] + } + } + } + } + } + + populateUnitClassDefaultUnitDictionary(unitClassElements) { + for (const unitClassElement of unitClassElements) { + const elementName = this.getElementTagName(unitClassElement) + const defaultUnit = unitClassElement.$[defaultUnitForUnitClassAttribute] + if (defaultUnit === undefined) { + this.unitClassAttributes[elementName][ + defaultUnitForUnitClassAttribute + ] = [unitClassElement.$[defaultUnitForOldUnitClassAttribute]] + } else { + this.unitClassAttributes[elementName][ + defaultUnitForUnitClassAttribute + ] = [defaultUnit] + } + } + } + + populateUnitModifierDictionaries() { + this.unitModifiers = {} + const unitModifierElements = this.getElementsByName(unitModifierElement) + if (unitModifierElements.length === 0) { + this.hasUnitModifiers = false + return + } + this.hasUnitModifiers = true + for (const unitModifierKey of unitModifierDictionaryKeys) { + this.unitModifiers[unitModifierKey] = {} + } + for (const unitModifierElement of unitModifierElements) { + const unitModifierName = this.getElementTagName(unitModifierElement) + if (unitModifierElement.$) { + for (const unitModifierKey of unitModifierDictionaryKeys) { + if (unitModifierElement.$[unitModifierKey] !== undefined) { + this.unitModifiers[unitModifierKey][unitModifierName] = + unitModifierElement.$[unitModifierKey] + } + } + } + } + } + + populateTagToAttributeDictionary(tagList, tagElementList, attributeName) { + this.tagAttributes[attributeName] = {} + for (let i = 0; i < tagList.length; i++) { + const tag = tagList[i] + this.tagAttributes[attributeName][tag.toLowerCase()] = + tagElementList[i].$[attributeName] + } + } + + populateTagUnitClassDictionary(tagList, tagElementList) { + this.tagUnitClasses = {} + for (let i = 0; i < tagList.length; i++) { + const tag = tagList[i] + const unitClassString = tagElementList[i].$[tagUnitClassAttribute] + if (unitClassString) { + this.tagUnitClasses[tag.toLowerCase()] = unitClassString.split(',') + } + } + } + + getTagsByAttribute(attributeName) { + const tags = [] + const tagElements = xpath.find( + this.rootElement, + '//node[@' + attributeName + ']', + ) + for (const attributeTagElement of tagElements) { + const tag = this.getTagPathFromTagElement(attributeTagElement) + tags.push(tag) + } + return [tags, tagElements] + } + + getAllTags(tagElementName = 'node', excludeTakeValueTags = true) { + const tags = [] + const tagElements = xpath.find(this.rootElement, '//' + tagElementName) + for (const tagElement of tagElements) { + if (excludeTakeValueTags && this.getElementTagName(tagElement) === '#') { + continue + } + const tag = this.getTagPathFromTagElement(tagElement) + tags.push(tag) + } + return [tags, tagElements] + } +} + +module.exports = { + Hed2SchemaParser: Hed2SchemaParser, +} diff --git a/validator/schema/hed3.js b/validator/schema/hed3.js new file mode 100644 index 00000000..7636a2b4 --- /dev/null +++ b/validator/schema/hed3.js @@ -0,0 +1,331 @@ +// TODO: Switch require once upstream bugs are fixed. +// const xpath = require('xml2js-xpath') +// Temporary +const xpath = require('../../utils/xpath') + +const { SchemaParser } = require('./parser') +const { + SchemaEntries, + SchemaEntryManager, + SchemaAttribute, + SchemaProperty, + SchemaTag, + SchemaUnit, + SchemaUnitClass, + SchemaUnitModifier, + SchemaValueClass, + nodeProperty, + attributeProperty, +} = require('./types') + +const lc = (str) => str.toLowerCase() + +class Hed3SchemaParser extends SchemaParser { + constructor(rootElement) { + super(rootElement) + this._versionDefinitions = {} + } + + parse() { + this.populateDictionaries() + return new SchemaEntries(this) + } + + populateDictionaries() { + this.parseProperties() + this.parseAttributes() + this.definitions = new Map() + this.parseUnitModifiers() + this.parseUnitClasses() + this.parseTags() + } + + static attributeFilter(propertyName) { + return (element) => { + const validProperty = propertyName + if (!element.property) { + return false + } + for (const property of element.property) { + if (property.name[0]._ === validProperty) { + return true + } + } + return false + } + } + + getAllTags(tagElementName = 'node') { + const tagElements = xpath.find(this.rootElement, '//' + tagElementName) + const tags = tagElements.map((element) => this.getTagPathFromTagElement(element)) + return [tags, tagElements] + } + + // Rewrite starts here. + + parseProperties() { + const propertyDefinitions = this.getElementsByName('propertyDefinition') + this.properties = new Map() + for (const definition of propertyDefinitions) { + const propertyName = this.getElementTagName(definition) + if ( + this._versionDefinitions.categoryProperties && + this._versionDefinitions.categoryProperties.has(propertyName) + ) { + this.properties.set( + propertyName, + new SchemaProperty(propertyName, SchemaProperty.CATEGORY_PROPERTY), + ) + } else if ( + this._versionDefinitions.typeProperties && + this._versionDefinitions.typeProperties.has(propertyName) + ) { + this.properties.set( + propertyName, + new SchemaProperty(propertyName, SchemaProperty.TYPE_PROPERTY), + ) + } + } + } + + parseAttributes() { + const attributeDefinitions = this.getElementsByName( + 'schemaAttributeDefinition', + ) + this.attributes = new Map() + for (const definition of attributeDefinitions) { + const attributeName = this.getElementTagName(definition) + const propertyElements = definition.property + let properties + if (propertyElements === undefined) { + properties = [] + } else { + properties = propertyElements.map((element) => + this.properties.get(element.name[0]._), + ) + } + this.attributes.set( + attributeName, + new SchemaAttribute(attributeName, properties), + ) + } + if (this._addAttributes) { + this._addAttributes() + } + } + + parseValueClasses() { + const valueClasses = new Map() + const [booleanAttributeDefinitions, valueAttributeDefinitions] = + this._parseDefinitions('valueClass') + for (const [name, valueAttributes] of valueAttributeDefinitions) { + const booleanAttributes = booleanAttributeDefinitions.get(name) + valueClasses.set( + name, + new SchemaValueClass(name, booleanAttributes, valueAttributes), + ) + } + this.definitions.set('valueClasses', new SchemaEntryManager(valueClasses)) + } + + parseUnitModifiers() { + const unitModifiers = new Map() + const [booleanAttributeDefinitions, valueAttributeDefinitions] = + this._parseDefinitions('unitModifier') + for (const [name, valueAttributes] of valueAttributeDefinitions) { + const booleanAttributes = booleanAttributeDefinitions.get(name) + unitModifiers.set( + name, + new SchemaUnitModifier(name, booleanAttributes, valueAttributes), + ) + } + this.definitions.set('unitModifiers', new SchemaEntryManager(unitModifiers)) + } + + parseUnitClasses() { + const unitClasses = new Map() + const [booleanAttributeDefinitions, valueAttributeDefinitions] = + this._parseDefinitions('unitClass') + const unitClassUnits = this.parseUnits() + + for (const [name, valueAttributes] of valueAttributeDefinitions) { + const booleanAttributes = booleanAttributeDefinitions.get(name) + unitClasses.set( + name, + new SchemaUnitClass( + name, + booleanAttributes, + valueAttributes, + unitClassUnits.get(name), + ), + ) + } + this.definitions.set('unitClasses', new SchemaEntryManager(unitClasses)) + } + + parseUnits() { + const unitClassUnits = new Map() + const unitClassElements = this.getElementsByName('unitClassDefinition') + const unitModifiers = this.definitions.get('unitModifiers') + for (const element of unitClassElements) { + const elementName = this.getElementTagName(element) + const units = new Map() + unitClassUnits.set(elementName, units) + if (element.unit === undefined) { + continue + } + const [unitBooleanAttributeDefinitions, unitValueAttributeDefinitions] = + this._parseAttributeElements(element.unit, this.getElementTagName) + for (const [name, valueAttributes] of unitValueAttributeDefinitions) { + const booleanAttributes = unitBooleanAttributeDefinitions.get(name) + units.set( + name, + new SchemaUnit( + name, + booleanAttributes, + valueAttributes, + unitModifiers, + ), + ) + } + } + return unitClassUnits + } + + parseTags() { + const [tags, tagElements] = this.getAllTags() + const lowercaseTags = tags.map(lc) + this.tags = new Set(lowercaseTags) + const [booleanAttributeDefinitions, valueAttributeDefinitions] = + this._parseAttributeElements(tagElements, (element) => + this.getTagPathFromTagElement(element), + ) + + const recursiveAttributes = Array.from(this.attributes.values()).filter( + (attribute) => attribute.hasAttributeName('recursive'), + ) + const unitClasses = this.definitions.get('unitClasses') + const tagUnitClassAttribute = this.attributes.get('unitClass') + + const tagUnitClassDefinitions = new Map() + const recursiveChildren = new Map() + tags.forEach((tagName, index) => { + const tagElement = tagElements[index] + const valueAttributes = valueAttributeDefinitions.get(tagName) + if (valueAttributes.has(tagUnitClassAttribute)) { + tagUnitClassDefinitions.set( + tagName, + valueAttributes.get(tagUnitClassAttribute).map((unitClassName) => { + return unitClasses.getEntry(unitClassName) + }), + ) + valueAttributes.delete(tagUnitClassAttribute) + } + for (const attribute of recursiveAttributes) { + const children = recursiveChildren.get(attribute) || [] + if (booleanAttributeDefinitions.get(tagName).has(attribute)) { + children.push(...this.getAllChildTags(tagElement)) + } + recursiveChildren.set(attribute, children) + } + }) + + for (const [attribute, childTagElements] of recursiveChildren) { + for (const tagElement of childTagElements) { + const tagName = this.getTagPathFromTagElement(tagElement) + booleanAttributeDefinitions.get(tagName).add(attribute) + } + } + + const tagEntries = new Map() + for (const [name, valueAttributes] of valueAttributeDefinitions) { + const booleanAttributes = booleanAttributeDefinitions.get(name) + const unitClasses = tagUnitClassDefinitions.get(name) + tagEntries.set( + lc(name), + new SchemaTag(name, booleanAttributes, valueAttributes, unitClasses), + ) + } + + for (const tagElement of tagElements) { + const tagName = this.getTagPathFromTagElement(tagElement) + const parentTagName = this.getParentTagName(tagElement) + if (parentTagName) { + tagEntries.get(lc(tagName))._parent = tagEntries.get(lc(parentTagName)) + } + } + + this.definitions.set('tags', new SchemaEntryManager(tagEntries)) + } + + _parseDefinitions(category) { + const categoryTagName = category + 'Definition' + const definitionElements = this.getElementsByName(categoryTagName) + + return this._parseAttributeElements( + definitionElements, + this.getElementTagName, + ) + } + + _parseAttributeElements(elements, namer) { + const booleanAttributeDefinitions = new Map() + const valueAttributeDefinitions = new Map() + + for (const element of elements) { + const elementName = namer(element) + const booleanAttributes = new Set() + const valueAttributes = new Map() + + booleanAttributeDefinitions.set(elementName, booleanAttributes) + valueAttributeDefinitions.set(elementName, valueAttributes) + + if (element.attribute === undefined) { + continue + } + + for (const tagAttribute of element.attribute) { + const attributeName = tagAttribute.name[0]._ + if (tagAttribute.value === undefined) { + booleanAttributes.add(this.attributes.get(attributeName)) + continue + } + const values = tagAttribute.value.map((value) => value._) + valueAttributes.set(this.attributes.get(attributeName), values) + } + } + + return [booleanAttributeDefinitions, valueAttributeDefinitions] + } +} + +class HedV8SchemaParser extends Hed3SchemaParser { + constructor(rootElement) { + super(rootElement) + this._versionDefinitions = { + typeProperties: new Set(['boolProperty']), + categoryProperties: new Set([ + 'unitProperty', + 'unitClassProperty', + 'unitModifierProperty', + 'valueClassProperty', + ]), + } + } + + _addAttributes() { + const recursiveAttribute = new SchemaAttribute('recursive', [ + this.properties.get('boolProperty'), + attributeProperty, + ]) + this.attributes.set('recursive', recursiveAttribute) + const extensionAllowedAttribute = this.attributes.get('extensionAllowed') + extensionAllowedAttribute._booleanAttributes.add(recursiveAttribute) + extensionAllowedAttribute._booleanAttributeNames.add('recursive') + } +} + +module.exports = { + Hed3SchemaParser: Hed3SchemaParser, + HedV8SchemaParser: HedV8SchemaParser, +} diff --git a/validator/schema/index.js b/validator/schema/index.js deleted file mode 100644 index 025c3a79..00000000 --- a/validator/schema/index.js +++ /dev/null @@ -1,709 +0,0 @@ -const semver = require('semver') - -const schemaUtils = require('../../common/schema') -const arrayUtils = require('../../utils/array') - -// TODO: Switch require once upstream bugs are fixed. -// const xpath = require('xml2js-xpath') -// Temporary -const xpath = require('../../utils/xpath') - -const { buildMappingObject } = require('../../converter/schema') -const { setParent } = require('../../utils/xml2js') - -const defaultUnitForTagAttribute = 'default' -const defaultUnitForUnitClassAttribute = 'defaultUnits' -const defaultUnitForOldUnitClassAttribute = 'default' -const extensionAllowedAttribute = 'extensionAllowed' -const tagDictionaryKeys = [ - 'default', - 'extensionAllowed', - 'isNumeric', - 'position', - 'predicateType', - 'recommended', - 'required', - 'requireChild', - 'tags', - 'takesValue', - 'unique', - 'unitClass', -] -const unitClassDictionaryKeys = ['SIUnit', 'unitSymbol'] -const unitModifierDictionaryKeys = ['SIUnitModifier', 'SIUnitSymbolModifier'] -const tagsDictionaryKey = 'tags' -const tagUnitClassAttribute = 'unitClass' -const unitClassElement = 'unitClass' -const unitClassUnitElement = 'unit' -const unitClassUnitsElement = 'units' -const unitsElement = 'units' -const unitModifierElement = 'unitModifier' -const schemaAttributeDefinitionElement = 'schemaAttributeDefinition' -const unitClassDefinitionElement = 'unitClassDefinition' -const unitModifierDefinitionElement = 'unitModifierDefinition' - -const lc = (str) => str.toLowerCase() - -const V2SchemaDictionaries = { - populateDictionaries: function () { - this.populateUnitClassDictionaries() - this.populateUnitModifierDictionaries() - this.populateTagDictionaries() - }, - - populateTagDictionaries: function () { - this.tagAttributes = {} - for (const dictionaryKey of tagDictionaryKeys) { - const [tags, tagElements] = this.getTagsByAttribute(dictionaryKey) - if (dictionaryKey === extensionAllowedAttribute) { - const tagDictionary = this.stringListToLowercaseTrueDictionary(tags) - const childTagElements = arrayUtils.flattenDeep( - tagElements.map((tagElement) => this.getAllChildTags(tagElement)), - ) - const childTags = childTagElements.map((tagElement) => { - return this.getTagPathFromTagElement(tagElement) - }) - const childDictionary = - this.stringListToLowercaseTrueDictionary(childTags) - this.tagAttributes[extensionAllowedAttribute] = Object.assign( - {}, - tagDictionary, - childDictionary, - ) - } else if (dictionaryKey === defaultUnitForTagAttribute) { - this.populateTagToAttributeDictionary(tags, tagElements, dictionaryKey) - } else if (dictionaryKey === tagUnitClassAttribute) { - this.populateTagUnitClassDictionary(tags, tagElements) - } else if (dictionaryKey === tagsDictionaryKey) { - const tags = this.getAllTags()[0] - this.tags = tags.map(lc) - } else { - this.tagAttributes[dictionaryKey] = - this.stringListToLowercaseTrueDictionary(tags) - } - } - }, - - populateUnitClassDictionaries: function () { - const unitClassElements = this.getElementsByName(unitClassElement) - if (unitClassElements.length === 0) { - this.hasUnitClasses = false - return - } - this.hasUnitClasses = true - this.populateUnitClassUnitsDictionary(unitClassElements) - this.populateUnitClassDefaultUnitDictionary(unitClassElements) - }, - - populateUnitClassUnitsDictionary: function (unitClassElements) { - this.unitClasses = {} - this.unitClassAttributes = {} - this.unitAttributes = {} - for (const unitClassKey of unitClassDictionaryKeys) { - this.unitAttributes[unitClassKey] = {} - } - for (const unitClassElement of unitClassElements) { - const unitClassName = this.getElementTagValue(unitClassElement) - this.unitClassAttributes[unitClassName] = {} - const units = - unitClassElement[unitClassUnitsElement][0][unitClassUnitElement] - if (units === undefined) { - const elementUnits = this.getElementTagValue( - unitClassElement, - unitClassUnitsElement, - ) - const units = elementUnits.split(',') - this.unitClasses[unitClassName] = units.map((unit) => - unit.toLowerCase(), - ) - continue - } - this.unitClasses[unitClassName] = units.map((element) => element._) - for (const unit of units) { - if (unit.$) { - const unitName = unit._ - for (const unitClassKey of unitClassDictionaryKeys) { - this.unitAttributes[unitClassKey][unitName] = unit.$[unitClassKey] - } - } - } - } - }, - - populateUnitClassDefaultUnitDictionary: function (unitClassElements) { - for (const unitClassElement of unitClassElements) { - const elementName = this.getElementTagValue(unitClassElement) - const defaultUnit = unitClassElement.$[defaultUnitForUnitClassAttribute] - if (defaultUnit === undefined) { - this.unitClassAttributes[elementName][ - defaultUnitForUnitClassAttribute - ] = [unitClassElement.$[defaultUnitForOldUnitClassAttribute]] - } else { - this.unitClassAttributes[elementName][ - defaultUnitForUnitClassAttribute - ] = [defaultUnit] - } - } - }, - - populateUnitModifierDictionaries: function () { - this.unitModifiers = {} - const unitModifierElements = this.getElementsByName(unitModifierElement) - if (unitModifierElements.length === 0) { - this.hasUnitModifiers = false - return - } - this.hasUnitModifiers = true - for (const unitModifierKey of unitModifierDictionaryKeys) { - this.unitModifiers[unitModifierKey] = {} - } - for (const unitModifierElement of unitModifierElements) { - const unitModifierName = this.getElementTagValue(unitModifierElement) - if (unitModifierElement.$) { - for (const unitModifierKey of unitModifierDictionaryKeys) { - if (unitModifierElement.$[unitModifierKey] !== undefined) { - this.unitModifiers[unitModifierKey][unitModifierName] = - unitModifierElement.$[unitModifierKey] - } - } - } - } - }, - - populateTagToAttributeDictionary: function ( - tagList, - tagElementList, - attributeName, - ) { - this.tagAttributes[attributeName] = {} - for (let i = 0; i < tagList.length; i++) { - const tag = tagList[i] - this.tagAttributes[attributeName][tag.toLowerCase()] = - tagElementList[i].$[attributeName] - } - }, - - populateTagUnitClassDictionary: function (tagList, tagElementList) { - this.tagUnitClasses = {} - for (let i = 0; i < tagList.length; i++) { - const tag = tagList[i] - const unitClassString = tagElementList[i].$[tagUnitClassAttribute] - if (unitClassString) { - this.tagUnitClasses[tag.toLowerCase()] = unitClassString.split(',') - } - } - }, - - stringListToLowercaseTrueDictionary: function (stringList) { - const lowercaseDictionary = {} - for (const stringElement of stringList) { - lowercaseDictionary[stringElement.toLowerCase()] = true - } - return lowercaseDictionary - }, - - getAncestorTagNames: function (tagElement) { - const ancestorTags = [] - let parentTagName = this.getParentTagName(tagElement) - let parentElement = tagElement.$parent - while (parentTagName) { - ancestorTags.push(parentTagName) - parentTagName = this.getParentTagName(parentElement) - parentElement = parentElement.$parent - } - return ancestorTags - }, - - getElementTagValue: function (element, tagName = 'name') { - return element[tagName][0]._ - }, - - getParentTagName: function (tagElement) { - const parentTagElement = tagElement.$parent - if (parentTagElement && parentTagElement.$parent) { - return parentTagElement.name[0]._ - } else { - return '' - } - }, - - getTagPathFromTagElement: function (tagElement) { - const ancestorTagNames = this.getAncestorTagNames(tagElement) - ancestorTagNames.unshift(this.getElementTagValue(tagElement)) - ancestorTagNames.reverse() - return ancestorTagNames.join('/') - }, - - getTagsByAttribute: function (attributeName) { - const tags = [] - const tagElements = xpath.find( - this.rootElement, - '//node[@' + attributeName + ']', - ) - for (const attributeTagElement of tagElements) { - const tag = this.getTagPathFromTagElement(attributeTagElement) - tags.push(tag) - } - return [tags, tagElements] - }, - - getAllTags: function (tagElementName = 'node', excludeTakeValueTags = true) { - const tags = [] - const tagElements = xpath.find(this.rootElement, '//' + tagElementName) - for (const tagElement of tagElements) { - if (excludeTakeValueTags && this.getElementTagValue(tagElement) === '#') { - continue - } - const tag = this.getTagPathFromTagElement(tagElement) - tags.push(tag) - } - return [tags, tagElements] - }, - - getElementsByName: function ( - elementName = 'node', - parentElement = undefined, - ) { - if (!parentElement) { - return xpath.find(this.rootElement, '//' + elementName) - } else { - return xpath.find(parentElement, '//' + elementName) - } - }, - - getAllChildTags: function ( - parentElement, - elementName = 'node', - excludeTakeValueTags = true, - ) { - if ( - excludeTakeValueTags && - this.getElementTagValue(parentElement) === '#' - ) { - return [] - } - const tagElementChildren = this.getElementsByName( - elementName, - parentElement, - ) - const childTags = arrayUtils.flattenDeep( - tagElementChildren.map((child) => - this.getAllChildTags(child, elementName, excludeTakeValueTags), - ), - ) - childTags.push(parentElement) - return childTags - }, -} - -const attributeFilter = function (propertyName) { - return (element) => { - const validProperty = propertyName - if (!element.property) { - return false - } - for (const property of element.property) { - if (property.name[0]._ === validProperty) { - return true - } - } - return false - } -} - -const V3SchemaDictionaries = { - populateDictionaries: function () { - this.populateUnitClassDictionaries() - this.populateUnitModifierDictionaries() - this.populateTagDictionaries() - }, - - populateTagDictionaries: function () { - this.tagAttributes = {} - this.tagUnitClasses = {} - const tagSchemaAttributes = this.getElementsByName( - schemaAttributeDefinitionElement, - ).filter((element) => { - const invalidProperties = [ - 'unitClassProperty', - 'unitModifierProperty', - 'unitProperty', - ] - if (!element.property) { - return true - } - for (const property of element.property) { - if (invalidProperties.includes(property.name[0]._)) { - return false - } - } - return true - }) - const tagAttributes = tagSchemaAttributes.map(this.getElementTagValue) - for (const attribute of tagAttributes) { - if (attribute === 'unitClass') { - continue - } - this.tagAttributes[attribute] = {} - } - const [tags, tagElements] = this.getAllTags() - const lowercaseTags = tags.map(lc) - this.tags = lowercaseTags - lowercaseTags.forEach((tag, index) => { - const tagElement = tagElements[index] - for (const attribute of tagAttributes) { - const elementAttributeValue = this.elementAttributeValue( - tagElement, - attribute, - ) - if (elementAttributeValue !== null) { - if (attribute === extensionAllowedAttribute) { - const tagDictionary = this.stringListToLowercaseTrueDictionary([ - tag, - ]) - const childTagElements = this.getAllChildTags(tagElement) - const childTags = childTagElements.map((element) => { - return this.getTagPathFromTagElement(element) - }) - const childDictionary = - this.stringListToLowercaseTrueDictionary(childTags) - Object.assign( - this.tagAttributes[extensionAllowedAttribute], - tagDictionary, - childDictionary, - ) - } else if (attribute === tagUnitClassAttribute) { - this.tagUnitClasses[tag] = elementAttributeValue - } else { - this.tagAttributes[attribute][tag] = elementAttributeValue - } - } - } - }) - }, - - populateUnitClassDictionaries: function () { - const unitClassElements = this.getElementsByName(unitClassDefinitionElement) - if (unitClassElements.length === 0) { - this.hasUnitClasses = false - return - } - this.hasUnitClasses = true - this.unitClasses = {} - this.unitClassAttributes = {} - this.unitAttributes = {} - - const unitClassSchemaAttributes = this.getElementsByName( - schemaAttributeDefinitionElement, - ).filter(attributeFilter('unitClassProperty')) - const unitSchemaAttributes = this.getElementsByName( - schemaAttributeDefinitionElement, - ).filter(attributeFilter('unitProperty')) - const unitClassAttributes = unitClassSchemaAttributes.map( - this.getElementTagValue, - ) - const unitAttributes = unitSchemaAttributes.map(this.getElementTagValue) - for (const attribute of unitAttributes) { - this.unitAttributes[attribute] = {} - } - - for (const unitClassElement of unitClassElements) { - const unitClassName = this.getElementTagValue(unitClassElement) - this.unitClassAttributes[unitClassName] = {} - let units = unitClassElement[unitClassUnitElement] - if (units === undefined) { - units = [] - } - for (const attribute of unitClassAttributes) { - const elementAttributeValue = this.elementAttributeValue( - unitClassElement, - attribute, - true, - ) - if (elementAttributeValue !== null) { - this.unitClassAttributes[unitClassName][attribute] = - elementAttributeValue - } - } - const unitNames = units.map(this.getElementTagValue) - this.unitClasses[unitClassName] = unitNames - units.forEach((unit, index) => { - const unitName = unitNames[index] - for (const attribute of unitAttributes) { - const elementAttributeValue = this.elementAttributeValue( - unit, - attribute, - ) - if (elementAttributeValue !== null) { - this.unitAttributes[attribute][unitName] = elementAttributeValue - } - } - }) - } - }, - - populateUnitModifierDictionaries: function () { - this.unitModifiers = {} - const unitModifierElements = this.getElementsByName( - unitModifierDefinitionElement, - ) - if (unitModifierElements.length === 0) { - this.hasUnitModifiers = false - return - } - this.hasUnitModifiers = true - - const unitModifierSchemaAttributes = this.getElementsByName( - schemaAttributeDefinitionElement, - ).filter(attributeFilter('unitModifierProperty')) - const unitModifierAttributes = unitModifierSchemaAttributes.map( - this.getElementTagValue, - ) - for (const attribute of unitModifierAttributes) { - this.unitModifiers[attribute] = {} - } - - for (const unitModifierElement of unitModifierElements) { - const unitModifierName = this.getElementTagValue(unitModifierElement) - for (const attribute of unitModifierAttributes) { - const elementAttributeValue = this.elementAttributeValue( - unitModifierElement, - attribute, - ) - if (elementAttributeValue !== null) { - this.unitModifiers[attribute][unitModifierName] = - elementAttributeValue - } - } - } - }, - - stringListToLowercaseTrueDictionary: function (stringList) { - const lowercaseDictionary = {} - for (const stringElement of stringList) { - lowercaseDictionary[stringElement.toLowerCase()] = true - } - return lowercaseDictionary - }, - - getAncestorTagNames: function (tagElement) { - const ancestorTags = [] - let parentTagName = this.getParentTagName(tagElement) - let parentElement = tagElement.$parent - while (parentTagName) { - ancestorTags.push(parentTagName) - parentTagName = this.getParentTagName(parentElement) - parentElement = parentElement.$parent - } - return ancestorTags - }, - - getElementTagValue: function (element) { - return element.name[0]._ - }, - - getParentTagName: function (tagElement) { - const parentTagElement = tagElement.$parent - if (parentTagElement && parentTagElement.$parent) { - return parentTagElement.name[0]._ - } else { - return '' - } - }, - - getTagPathFromTagElement: function (tagElement) { - const ancestorTagNames = this.getAncestorTagNames(tagElement) - ancestorTagNames.unshift(this.getElementTagValue(tagElement)) - ancestorTagNames.reverse() - return ancestorTagNames.join('/') - }, - - elementAttributeValue: function (tagElement, attributeName) { - if (!tagElement.attribute) { - return null - } - for (const tagAttribute of tagElement.attribute) { - if (tagAttribute.name[0]._ === attributeName) { - if (tagAttribute.value === undefined) { - return true - } - const values = [] - for (const value of tagAttribute.value) { - values.push(value._) - } - return values - } - } - return null - }, - - getAllTags: function (tagElementName = 'node') { - const tags = [] - const tagElements = xpath.find(this.rootElement, '//' + tagElementName) - for (const tagElement of tagElements) { - const tag = this.getTagPathFromTagElement(tagElement) - tags.push(tag) - } - return [tags, tagElements] - }, - - getElementsByName: function ( - elementName = 'node', - parentElement = undefined, - ) { - if (!parentElement) { - return xpath.find(this.rootElement, '//' + elementName) - } else { - return xpath.find(parentElement, '//' + elementName) - } - }, - - getAllChildTags: function ( - parentElement, - elementName = 'node', - excludeTakeValueTags = true, - ) { - if ( - excludeTakeValueTags && - this.getElementTagValue(parentElement) === '#' - ) { - return [] - } - const tagElementChildren = this.getElementsByName( - elementName, - parentElement, - ) - const childTags = arrayUtils.flattenDeep( - tagElementChildren.map((child) => - this.getAllChildTags(child, elementName, excludeTakeValueTags), - ), - ) - childTags.push(parentElement) - return childTags - }, -} - -/** - * Determine if a HED tag has a particular attribute in this schema. - * - * @param {string} tag The HED tag to check. - * @param {string} tagAttribute The attribute to check for. - * @return {boolean|null} Whether this tag has this attribute, or null if the attribute doesn't exist. - */ -const tagHasAttribute = function (tag, tagAttribute) { - if (!(tagAttribute in this.tagAttributes)) { - return null - } - return tag.toLowerCase() in this.tagAttributes[tagAttribute] -} - -/** - * A description of a HED schema's attributes. - */ -class SchemaAttributes { - /** - * Constructor. - * @param {V2SchemaDictionaries|V3SchemaDictionaries} schemaDictionaries A constructed schema dictionary collection. - */ - constructor(schemaDictionaries) { - /** - * The list of all (formatted) tags. - * @type {string[]} - */ - this.tags = schemaDictionaries.tags - /** - * The mapping from attributes to tags to values. - * @type {object>} - */ - this.tagAttributes = schemaDictionaries.tagAttributes - /** - * The mapping from tags to their unit classes. - * @type {object} - */ - this.tagUnitClasses = schemaDictionaries.tagUnitClasses - /** - * The mapping from unit classes to their units. - * @type {object} - */ - this.unitClasses = schemaDictionaries.unitClasses - /** - * The mapping from unit classes to their attributes. - * @type {object>} - */ - this.unitClassAttributes = schemaDictionaries.unitClassAttributes - /** - * The mapping from units to their attributes. - * @type {object>} - */ - this.unitAttributes = schemaDictionaries.unitAttributes - /** - * The mapping from unit modifier types to unit modifiers. - * @type {object} - */ - this.unitModifiers = schemaDictionaries.unitModifiers - /** - * Whether the schema has unit classes. - * @type {boolean} - */ - this.hasUnitClasses = schemaDictionaries.hasUnitClasses - /** - * Whether the schema has unit modifiers. - * @type {boolean} - */ - this.hasUnitModifiers = schemaDictionaries.hasUnitModifiers - /** - * Determine if a HED tag has a particular attribute in this schema. - * @param {string} tag The HED tag to check. - * @param {string} tagAttribute The attribute to check for. - * @return {boolean} Whether this tag has this attribute. - */ - this.tagHasAttribute = tagHasAttribute - } -} - -/** - * Build a schema attributes object from schema XML data. - * - * @param {object} xmlData The schema XML data. - * @return {SchemaAttributes} The schema attributes object. - */ -const buildSchemaAttributesObject = function (xmlData) { - const rootElement = xmlData.HED - setParent(rootElement, null) - let schemaDictionaries - if (semver.gte(rootElement.$.version, '8.0.0-alpha.3')) { - schemaDictionaries = Object.create(V3SchemaDictionaries) - } else { - schemaDictionaries = Object.create(V2SchemaDictionaries) - } - schemaDictionaries.rootElement = rootElement - schemaDictionaries.populateDictionaries() - - return new SchemaAttributes(schemaDictionaries) -} - -/** - * Build a schema container object from a base schema version or path description. - * - * @param {{path: string?, version: string?}} schemaDef The description of which base schema to use. - * @param {boolean} useFallback Whether to use a bundled fallback schema if the requested schema cannot be loaded. - * @return {Promise|Promise} The schema container object or an error. - */ -const buildSchema = function (schemaDef = {}, useFallback = true) { - return schemaUtils.loadSchema(schemaDef, useFallback).then((xmlData) => { - const schemaAttributes = buildSchemaAttributesObject(xmlData) - const mapping = buildMappingObject(xmlData) - const baseSchema = new schemaUtils.Schema( - xmlData, - schemaAttributes, - mapping, - ) - return new schemaUtils.Schemas(baseSchema) - }) -} - -module.exports = { - buildSchema: buildSchema, - buildSchemaAttributesObject: buildSchemaAttributesObject, - SchemaAttributes: SchemaAttributes, -} diff --git a/validator/schema/init.js b/validator/schema/init.js new file mode 100644 index 00000000..c1163905 --- /dev/null +++ b/validator/schema/init.js @@ -0,0 +1,53 @@ +const semver = require('semver') + +const loadSchema = require('../../common/schema/loader') +const { Schemas, Hed2Schema, Hed3Schema } = require('../../common/schema/types') + +const { buildMappingObject } = require('../../converter/schema') +const { setParent } = require('../../utils/xml2js') + +const { Hed2SchemaParser } = require('./hed2') +const { HedV8SchemaParser } = require('./hed3') + +/** + * Build a schema attributes object from schema XML data. + * + * @param {object} xmlData The schema XML data. + * @return {SchemaAttributes|SchemaEntries} The schema attributes object. + */ +const buildSchemaAttributesObject = function (xmlData) { + const rootElement = xmlData.HED + setParent(rootElement, null) + if (semver.gte(rootElement.$.version, '8.0.0-alpha.3')) { + return new HedV8SchemaParser(rootElement).parse() + } else { + return new Hed2SchemaParser(rootElement).parse() + } +} + +/** + * Build a schema container object from a base schema version or path description. + * + * @param {{path: string?, version: string?}} schemaDef The description of which base schema to use. + * @param {boolean} useFallback Whether to use a bundled fallback schema if the requested schema cannot be loaded. + * @return {Promise|Promise} The schema container object or an error. + */ +const buildSchema = function (schemaDef = {}, useFallback = true) { + return loadSchema(schemaDef, useFallback).then((xmlData) => { + const schemaAttributes = buildSchemaAttributesObject(xmlData) + const mapping = buildMappingObject(xmlData) + const rootElement = xmlData.HED + let baseSchema + if (semver.gte(rootElement.$.version, '8.0.0-alpha.3')) { + baseSchema = new Hed3Schema(xmlData, schemaAttributes, mapping) + } else { + baseSchema = new Hed2Schema(xmlData, schemaAttributes, mapping) + } + return new Schemas(baseSchema) + }) +} + +module.exports = { + buildSchema: buildSchema, + buildSchemaAttributesObject: buildSchemaAttributesObject, +} diff --git a/validator/schema/parser.js b/validator/schema/parser.js new file mode 100644 index 00000000..34035fc4 --- /dev/null +++ b/validator/schema/parser.js @@ -0,0 +1,96 @@ +const arrayUtils = require('../../utils/array') + +// TODO: Switch require once upstream bugs are fixed. +// const xpath = require('xml2js-xpath') +// Temporary +const xpath = require('../../utils/xpath') + +class SchemaParser { + constructor(rootElement) { + this.rootElement = rootElement + } + + populateDictionaries() { + this.populateUnitClassDictionaries() + this.populateUnitModifierDictionaries() + this.populateTagDictionaries() + } + + // Stubs to be overridden. + populateTagDictionaries() {} + populateUnitClassDictionaries() {} + populateUnitModifierDictionaries() {} + + getAllChildTags( + parentElement, + elementName = 'node', + excludeTakeValueTags = true, + ) { + if (excludeTakeValueTags && this.getElementTagName(parentElement) === '#') { + return [] + } + const tagElementChildren = this.getElementsByName( + elementName, + parentElement, + ) + const childTags = arrayUtils.flattenDeep( + tagElementChildren.map((child) => + this.getAllChildTags(child, elementName, excludeTakeValueTags), + ), + ) + childTags.push(parentElement) + return childTags + } + + getElementsByName(elementName = 'node', parentElement = this.rootElement) { + return xpath.find(parentElement, '//' + elementName) + } + + getTagPathFromTagElement(tagElement) { + const ancestorTagNames = this.getAncestorTagNames(tagElement) + ancestorTagNames.unshift(this.getElementTagName(tagElement)) + ancestorTagNames.reverse() + return ancestorTagNames.join('/') + } + + getAncestorTagNames(tagElement) { + const ancestorTags = [] + let parentTagName = this.getParentTagName(tagElement) + let parentElement = tagElement.$parent + while (parentTagName) { + ancestorTags.push(parentTagName) + parentTagName = this.getParentTagName(parentElement) + parentElement = parentElement.$parent + } + return ancestorTags + } + + getParentTagName(tagElement) { + const parentTagElement = tagElement.$parent + if (parentTagElement && parentTagElement.$parent) { + return this.getElementTagName(parentTagElement) + } else { + return '' + } + } + + getElementTagName(element) { + return element.name[0]._ + } + + getElementTagValue(element, tagName) { + return element[tagName][0]._ + } + + stringListToLowercaseTrueDictionary(stringList) { + const lowercaseDictionary = {} + for (const stringElement of stringList) { + lowercaseDictionary[stringElement.toLowerCase()] = true + } + return lowercaseDictionary + } +} + +module.exports = { + SchemaParser: SchemaParser, +} diff --git a/validator/schema/types.js b/validator/schema/types.js new file mode 100644 index 00000000..17bd3d2f --- /dev/null +++ b/validator/schema/types.js @@ -0,0 +1,490 @@ +const pluralize = require('pluralize') +pluralize.addUncountableRule('hertz') + +// Old-style types + +const { Memoizer } = require('../../utils/types') + +/** + * A description of a HED schema's attributes. + */ +class SchemaAttributes { + /** + * Constructor. + * @param {SchemaParser} schemaParser A constructed schema parser. + */ + constructor(schemaParser) { + /** + * The list of all (formatted) tags. + * @type {string[]} + */ + this.tags = schemaParser.tags + /** + * The mapping from attributes to tags to values. + * @type {object>} + */ + this.tagAttributes = schemaParser.tagAttributes + /** + * The mapping from tags to their unit classes. + * @type {object} + */ + this.tagUnitClasses = schemaParser.tagUnitClasses + /** + * The mapping from unit classes to their units. + * @type {object} + */ + this.unitClasses = schemaParser.unitClasses + /** + * The mapping from unit classes to their attributes. + * @type {object>} + */ + this.unitClassAttributes = schemaParser.unitClassAttributes + /** + * The mapping from units to their attributes. + * @type {object>} + */ + this.unitAttributes = schemaParser.unitAttributes + /** + * The mapping from unit modifier types to unit modifiers. + * @type {object} + */ + this.unitModifiers = schemaParser.unitModifiers + /** + * Whether the schema has unit classes. + * @type {boolean} + */ + this.hasUnitClasses = schemaParser.hasUnitClasses + /** + * Whether the schema has unit modifiers. + * @type {boolean} + */ + this.hasUnitModifiers = schemaParser.hasUnitModifiers + } + + /** + * Determine if a HED tag has a particular attribute in this schema. + * + * @param {string} tag The HED tag to check. + * @param {string} tagAttribute The attribute to check for. + * @return {boolean|null} Whether this tag has this attribute, or null if the attribute doesn't exist. + */ + tagHasAttribute(tag, tagAttribute) { + if (!(tagAttribute in this.tagAttributes)) { + return null + } + return tag.toLowerCase() in this.tagAttributes[tagAttribute] + } +} + +class SchemaEntries extends Memoizer { + constructor(schemaParser) { + super() + /** + * @type {SchemaEntryManager} + */ + this.properties = new SchemaEntryManager(schemaParser.properties) + /** + * @type {SchemaEntryManager} + */ + this.attributes = new SchemaEntryManager(schemaParser.attributes) + /** + * @type {Map} + */ + this.definitions = schemaParser.definitions + } + + /** + * Get the schema's unit classes. + * @return {Map} + */ + get unitClassMap() { + return this.definitions.get('unitClasses').definitions + } + + /** + * Get a map of all of this schema's units. + */ + get allUnits() { + return this._memoize('allUnits', () => { + const units = [] + for (const unitClass of this.unitClassMap.values()) { + const unitClassUnits = unitClass.units + units.push(...unitClassUnits) + } + return new Map(units) + }) + } + + /** + * Get the schema's SI unit modifiers. + * @return {Map} + */ + get SIUnitModifiers() { + const unitModifiers = this.definitions.get('unitModifiers') + return unitModifiers.getEntriesWithBooleanAttribute('SIUnitModifier') + } + + /** + * Get the schema's SI unit symbol modifiers. + * @return {Map} + */ + get SIUnitSymbolModifiers() { + const unitModifiers = this.definitions.get('unitModifiers') + return unitModifiers.getEntriesWithBooleanAttribute('SIUnitSymbolModifier') + } + + /** + * Determine if a HED tag has a particular attribute in this schema. + * + * @param {string} tag The HED tag to check. + * @param {string} tagAttribute The attribute to check for. + * @return {boolean} Whether this tag has this attribute. + */ + tagHasAttribute(tag, tagAttribute) { + if (!this.definitions.get('tags').hasEntry(tag)) { + return false + } + return this.definitions + .get('tags') + .getEntry(tag) + .hasAttributeName(tagAttribute) + } +} + +// New-style types + +class SchemaEntryManager extends Memoizer { + /** + * Constructor. + * + * @param {Map} definitions A map of schema entry definitions. + */ + constructor(definitions) { + super() + this.definitions = definitions + } + + [Symbol.iterator]() { + return this.definitions.entries() + } + + hasEntry(name) { + return this.definitions.has(name) + } + + getEntry(name) { + return this.definitions.get(name) + } + + getEntriesWithBooleanAttribute(booleanPropertyName) { + return this._memoize(booleanPropertyName, () => { + return this.filter(([_, v]) => { + return v.hasAttributeName(booleanPropertyName) + }) + }) + } + + filter(fn) { + const pairArray = Array.from(this.definitions.entries()) + return new Map(pairArray.filter((entry) => fn(entry))) + } +} + +class SchemaEntry { + constructor(name, booleanAttributes, valueAttributes) { + /** + * The name of this schema entry. + * @type {string} + * @private + */ + this._name = name + /** + * The set of boolean attributes this schema entry has. + * @type {Set} + * @private + */ + this._booleanAttributes = booleanAttributes + /** + * The collection of value attributes this schema entry has. + * @type {Map} + * @private + */ + this._valueAttributes = valueAttributes + + // String-mapped versions of the above objects. + this._booleanAttributeNames = new Set() + for (const attribute of booleanAttributes) { + this._booleanAttributeNames.add(attribute.name) + } + this._valueAttributeNames = new Map() + for (const [attributeName, value] of valueAttributes) { + this._valueAttributeNames.set(attributeName.name, value) + } + } + + /** + * The name of this schema entry. + * @return {string} + */ + get name() { + return this._name + } + + /** + * Whether this schema entry has this attribute. + * @param {SchemaAttribute} attribute The attribute to check for. + * @return {boolean} Whether this schema entry has this attribute. + */ + hasAttribute(attribute) { + return this._booleanAttributes.has(attribute) + } + + /** + * Retrieve the value of an attribute on this schema entry. + * @param {SchemaAttribute} attribute The attribute whose value should be returned. + * @param {boolean} alwaysReturnArray Whether to return a singleton array instead of a scalar value. + * @return {*} The value of the attribute. + */ + getAttributeValue(attribute, alwaysReturnArray = false) { + return SchemaEntry._getMapArrayValue( + this._valueAttributes, + attribute, + alwaysReturnArray, + ) + } + + /** + * Whether this schema entry has this attribute (by name). + * @param {string} attributeName The attribute to check for. + * @return {boolean} Whether this schema entry has this attribute. + */ + hasAttributeName(attributeName) { + return this._booleanAttributeNames.has(attributeName) + } + + /** + * Retrieve the value of an attribute (by name) on this schema entry. + * @param {string} attributeName The attribute whose value should be returned. + * @param {boolean} alwaysReturnArray Whether to return a singleton array instead of a scalar value. + * @return {*} The value of the attribute. + */ + getNamedAttributeValue(attributeName, alwaysReturnArray = false) { + return SchemaEntry._getMapArrayValue( + this._valueAttributeNames, + attributeName, + alwaysReturnArray, + ) + } + + /** + * Return a map value, with a scalar being returned in lieu of a singleton array if alwaysReturnArray is false. + * + * @template K,V + * @param {Map} map The map to search. + * @param {K} key A key in the map. + * @param {boolean} alwaysReturnArray Whether to return a singleton array instead of a scalar value. + * @return {V|V[]} The value for the key in the passed map. + * @private + */ + static _getMapArrayValue(map, key, alwaysReturnArray) { + const value = map.get(key) + if (!alwaysReturnArray && Array.isArray(value) && value.length === 1) { + return value[0] + } else { + return value + } + } +} + +class SchemaProperty extends SchemaEntry { + static CATEGORY_PROPERTY = 'categoryProperty' + static TYPE_PROPERTY = 'typeProperty' + + constructor(name, propertyType) { + super(name, new Set(), new Map()) + this._propertyType = propertyType + } + + /** + * Whether this property describes a schema category. + * @return {boolean} + */ + get isCategoryProperty() { + return this._propertyType === SchemaProperty.CATEGORY_PROPERTY + } + + /** + * Whether this property describes a data type. + * @return {boolean} + */ + get isTypeProperty() { + return this._propertyType === SchemaProperty.TYPE_PROPERTY + } +} + +// Pseudo-properties + +const nodeProperty = new SchemaProperty( + 'nodeProperty', + SchemaProperty.CATEGORY_PROPERTY, +) +const attributeProperty = new SchemaProperty( + 'attributeProperty', + SchemaProperty.CATEGORY_PROPERTY, +) +const stringProperty = new SchemaProperty( + 'stringProperty', + SchemaProperty.TYPE_PROPERTY, +) + +class SchemaAttribute extends SchemaEntry { + constructor(name, properties) { + super(name, new Set(), new Map()) + + // Parse properties + const categoryProperties = properties.filter( + (property) => property.isCategoryProperty, + ) + if (categoryProperties.length === 0) { + this._categoryProperty = nodeProperty + } else { + this._categoryProperty = categoryProperties[0] + } + const typeProperties = properties.filter( + (property) => property.isTypeProperty, + ) + if (typeProperties.length === 0) { + this._typeProperty = stringProperty + } else { + this._typeProperty = typeProperties[0] + } + } + + get categoryProperty() { + return this._categoryProperty + } + + get typeProperty() { + return this._typeProperty + } +} + +class SchemaUnit extends SchemaEntry { + constructor(name, booleanAttributes, valueAttributes, unitModifiers) { + super(name, booleanAttributes, valueAttributes) + + this._derivativeUnits = [name] + if (!this.isSIUnit) { + return + } + const matchingModifiers = unitModifiers.filter( + ([_, unitModifier]) => { + return this.isUnitSymbol === unitModifier.isSIUnitSymbolModifier + }, + ) + for (const modifierName of matchingModifiers.keys()) { + this._derivativeUnits.push(modifierName + name) + } + if (!this.isUnitSymbol) { + const pluralUnit = pluralize.plural(name) + this._derivativeUnits.push(pluralUnit) + const SIUnitModifiers = + unitModifiers.getEntriesWithBooleanAttribute('SIUnitModifier') + for (const modifierName of SIUnitModifiers.keys()) { + this._derivativeUnits.push(modifierName + pluralUnit) + } + } + } + + *derivativeUnits() { + for (const unit of this._derivativeUnits) { + yield unit + } + } + + get isPrefixUnit() { + return this.hasAttributeName('unitPrefix') + } + + get isSIUnit() { + return this.hasAttributeName('SIUnit') + } + + get isUnitSymbol() { + return this.hasAttributeName('unitSymbol') + } +} + +class SchemaUnitClass extends SchemaEntry { + /** + * Constructor. + * + * @param {string} name The name of this unit class. + * @param {Set} booleanAttributes The boolean attributes for this unit class. + * @param {Map} valueAttributes The value attributes for this unit class. + * @param {Map} units The units for this unit class. + * @constructor + */ + constructor(name, booleanAttributes, valueAttributes, units) { + super(name, booleanAttributes, valueAttributes) + this._units = units + } + + /** + * Get the units for this unit class. + * @return {Map} + */ + get units() { + return this._units + } +} + +class SchemaUnitModifier extends SchemaEntry { + constructor(name, booleanAttributes, valueAttributes) { + super(name, booleanAttributes, valueAttributes) + } + + get isSIUnitModifier() { + return this.hasAttributeName('SIUnitModifier') + } + + get isSIUnitSymbolModifier() { + return this.hasAttributeName('SIUnitSymbolModifier') + } +} + +class SchemaValueClass extends SchemaEntry { + constructor(name, booleanAttributes, valueAttributes) { + super(name, booleanAttributes, valueAttributes) + } +} + +class SchemaTag extends SchemaEntry { + constructor(name, booleanAttributes, valueAttributes, unitClasses) { + super(name, booleanAttributes, valueAttributes) + this._unitClasses = unitClasses || [] + } + + get unitClasses() { + return this._unitClasses + } + + get hasUnitClasses() { + return this._unitClasses.length !== 0 + } +} + +module.exports = { + nodeProperty: nodeProperty, + attributeProperty: attributeProperty, + SchemaAttributes: SchemaAttributes, + SchemaEntries: SchemaEntries, + SchemaEntryManager: SchemaEntryManager, + SchemaProperty: SchemaProperty, + SchemaAttribute: SchemaAttribute, + SchemaTag: SchemaTag, + SchemaUnit: SchemaUnit, + SchemaUnitClass: SchemaUnitClass, + SchemaUnitModifier: SchemaUnitModifier, + SchemaValueClass: SchemaValueClass, +} diff --git a/validator/stringParser.js b/validator/stringParser.js index c63ed90f..d3fbaf21 100644 --- a/validator/stringParser.js +++ b/validator/stringParser.js @@ -4,6 +4,8 @@ const { generateIssue } = require('../common/issues/issues') const { ParsedHedTag, + ParsedHed2Tag, + ParsedHed3Tag, ParsedHedGroup, ParsedHedString, } = require('./types/parsedHed') @@ -36,16 +38,25 @@ const splitHedString = function ( let startingIndex = 0 let resetStartingIndex = false + let ParsedHedTagClass + if (hedSchemas.isHed2) { + ParsedHedTagClass = ParsedHed2Tag + } else if (hedSchemas.isHed3) { + ParsedHedTagClass = ParsedHed3Tag + } else { + ParsedHedTagClass = ParsedHedTag + } + const pushTag = function (i) { if (!utils.string.stringIsEmpty(currentTag)) { - const parsedHedTag = new ParsedHedTag( + const parsedHedTag = new ParsedHedTagClass( currentTag.trim(), hedString, [groupStartingIndex + startingIndex, groupStartingIndex + i], hedSchemas, ) hedTags.push(parsedHedTag) - conversionIssues.push(parsedHedTag.conversionIssues) + conversionIssues.push(...parsedHedTag.conversionIssues) } resetStartingIndex = true currentTag = '' @@ -92,7 +103,7 @@ const splitHedString = function ( const issues = { syntax: syntaxIssues, - conversion: conversionIssues.flat(), + conversion: conversionIssues, } return [hedTags, issues] @@ -391,9 +402,6 @@ const parseHedStrings = function (hedStrings, hedSchemas) { } module.exports = { - ParsedHedTag: ParsedHedTag, - ParsedHedGroup: ParsedHedGroup, - ParsedHedString: ParsedHedString, splitHedString: splitHedString, parseHedString: parseHedString, parseHedStrings: parseHedStrings, diff --git a/validator/types/parsedHed.js b/validator/types/parsedHed.js index 130f8a67..53a75bf4 100644 --- a/validator/types/parsedHed.js +++ b/validator/types/parsedHed.js @@ -99,7 +99,11 @@ class ParsedHedTag extends ParsedHedSubstring { } hasAttribute(attribute) { - return this.schema.attributes.tagHasAttribute(this.formattedTag, attribute) + return this.schema.tagHasAttribute(this.formattedTag, attribute) + } + + parentHasAttribute(attribute) { + return this.schema.tagHasAttribute(this.parentFormattedTag, attribute) } /** @@ -179,15 +183,6 @@ class ParsedHedTag extends ParsedHedSubstring { return false } - /** - * Determine if this HED tag is in the schema. - */ - get existsInSchema() { - return this._memoize('existsInSchema', () => { - return this.schema.attributes.tags.includes(this.formattedTag) - }) - } - /** * Check if any level of this HED tag allows extensions. */ @@ -201,10 +196,7 @@ class ParsedHedTag extends ParsedHedSubstring { for (const tagSlashIndex of tagSlashIndices) { const tagSubstring = this.formattedTag.slice(0, tagSlashIndex) if ( - this.schema.attributes.tagHasAttribute( - tagSubstring, - extensionAllowedAttribute, - ) + this.schema.tagHasAttribute(tagSubstring, extensionAllowedAttribute) ) { return true } @@ -213,34 +205,31 @@ class ParsedHedTag extends ParsedHedSubstring { }) } + equivalent(other) { + return ( + other instanceof ParsedHedTag && this.formattedTag === other.formattedTag + ) + } +} + +class ParsedHed2Tag extends ParsedHedTag { + /** + * Determine if this HED tag is in the schema. + */ + get existsInSchema() { + return this._memoize('existsInSchema', () => { + return this.schema.attributes.tags.includes(this.formattedTag) + }) + } + /** * Checks if this HED tag has the 'takesValue' attribute. */ get takesValue() { return this._memoize('takesValue', () => { const takesValueType = 'takesValue' - if (this.schema.isHed3) { - for (const ancestor of ParsedHedTag.ancestorIterator( - this.formattedTag, - )) { - const takesValueTag = replaceTagNameWithPound(ancestor) - if ( - this.schema.attributes.tagHasAttribute( - takesValueTag, - takesValueType, - ) - ) { - return true - } - } - return false - } else { - const takesValueTag = replaceTagNameWithPound(this.formattedTag) - return this.schema.attributes.tagHasAttribute( - takesValueTag, - takesValueType, - ) - } + const takesValueTag = replaceTagNameWithPound(this.formattedTag) + return this.schema.tagHasAttribute(takesValueTag, takesValueType) }) } @@ -283,7 +272,7 @@ class ParsedHedTag extends ParsedHedSubstring { return '' } const unitClassTag = replaceTagNameWithPound(this.formattedTag) - let hasDefaultAttribute = this.schema.attributes.tagHasAttribute( + let hasDefaultAttribute = this.schema.tagHasAttribute( unitClassTag, defaultUnitForTagAttribute, ) @@ -293,7 +282,7 @@ class ParsedHedTag extends ParsedHedSubstring { unitClassTag ] } - hasDefaultAttribute = this.schema.attributes.tagHasAttribute( + hasDefaultAttribute = this.schema.tagHasAttribute( unitClassTag, defaultUnitsForUnitClassAttribute, ) @@ -312,6 +301,7 @@ class ParsedHedTag extends ParsedHedSubstring { /** * Get the legal units for a particular HED tag. + * @return {string[]} */ get validUnits() { return this._memoize('validUnits', () => { @@ -319,16 +309,119 @@ class ParsedHedTag extends ParsedHedSubstring { const units = [] for (const unitClass of tagUnitClasses) { const unitClassUnits = this.schema.attributes.unitClasses[unitClass] - Array.prototype.push.apply(units, unitClassUnits) + units.push(...unitClassUnits) } return units }) } +} - equivalent(other) { - return ( - other instanceof ParsedHedTag && this.formattedTag === other.formattedTag - ) +class ParsedHed3Tag extends ParsedHedTag { + /** + * Determine if this HED tag is in the schema. + */ + get existsInSchema() { + return this._memoize('existsInSchema', () => { + return this.schema.entries.definitions + .get('tags') + .hasEntry(this.formattedTag) + }) + } + + /** + * Checks if this HED tag has the 'takesValue' attribute. + */ + get takesValue() { + return this._memoize('takesValue', () => { + const takesValueType = 'takesValue' + for (const ancestor of ParsedHedTag.ancestorIterator(this.formattedTag)) { + const takesValueTag = replaceTagNameWithPound(ancestor) + if (this.schema.tagHasAttribute(takesValueTag, takesValueType)) { + return true + } + } + return false + }) + } + + /** + * Checks if this HED tag has the 'unitClass' attribute. + */ + get hasUnitClass() { + return this._memoize('hasUnitClass', () => { + if (!this.schema.entries.definitions.has('unitClasses')) { + return false + } + if (this.takesValueTag === undefined) { + return false + } + return this.takesValueTag.hasUnitClasses + }) + } + + /** + * Get the unit classes for this HED tag. + */ + get unitClasses() { + return this._memoize('unitClasses', () => { + if (this.hasUnitClass) { + return this.takesValueTag.unitClasses + } else { + return [] + } + }) + } + + /** + * Get the default unit for this HED tag. + */ + get defaultUnit() { + return this._memoize('defaultUnit', () => { + const defaultUnitsForUnitClassAttribute = 'defaultUnits' + if (!this.hasUnitClass) { + return '' + } + const tagDefaultUnit = this.takesValueTag.getNamedAttributeValue( + defaultUnitsForUnitClassAttribute, + ) + if (tagDefaultUnit) { + return tagDefaultUnit + } + const firstUnitClass = this.unitClasses[0] + return firstUnitClass.getNamedAttributeValue( + defaultUnitsForUnitClassAttribute, + ) + }) + } + + /** + * Get the legal units for a particular HED tag. + * @return {Set} + */ + get validUnits() { + return this._memoize('validUnits', () => { + const tagUnitClasses = this.unitClasses + const units = new Set() + for (const unitClass of tagUnitClasses) { + const unitClassUnits = this.schema.entries.unitClassMap.get( + unitClass.name, + ).units + for (const unit of unitClassUnits.values()) { + units.add(unit) + } + } + return units + }) + } + + /** + * Get the schema tag object for this tag's value-taking form. + * + * @return {SchemaTag} + */ + get takesValueTag() { + const unitClassTag = replaceTagNameWithPound(this.formattedTag) + return this.schema.entries.definitions.get('tags').getEntry(unitClassTag) } } @@ -374,7 +467,7 @@ const groupDefinitionTag = function (group, hedSchemas) { class ParsedHedGroup extends ParsedHedSubstring { /** * Constructor. - * @param {(ParsedHedSubstring)[]} parsedHedTags The parsed HED tags in the HED tag group. + * @param {(ParsedHedTag|ParsedHedGroup)[]} parsedHedTags The parsed HED tags in the HED tag group. * @param {string} originalTagGroup The original pre-parsed version of the HED tag group. * @param {int[]} originalBounds The bounds of the HED tag group in the original HED string. * @param {Schemas} hedSchemas The collection of HED schemas. @@ -383,7 +476,7 @@ class ParsedHedGroup extends ParsedHedSubstring { super(originalTagGroup, originalBounds) /** * The parsed HED tags in the HED tag group. - * @type {(ParsedHedSubstring)[]} + * @type {(ParsedHedTag|ParsedHedGroup)[]} */ this.tags = parsedHedTags const [definitionBase, definitionTag] = groupDefinitionTag(this, hedSchemas) @@ -464,6 +557,22 @@ class ParsedHedGroup extends ParsedHedSubstring { ) } + /** + * The deeply nested array of parsed tags. + * @returns {ParsedHedTag[]} + */ + nestedGroups() { + const currentGroup = [] + for (const innerTag of this.tags) { + if (innerTag instanceof ParsedHedTag) { + currentGroup.push(innerTag) + } else if (innerTag instanceof ParsedHedGroup) { + currentGroup.push(innerTag.nestedGroups()) + } + } + return currentGroup + } + /** * Iterator over the full HED groups and subgroups in this HED tag group. * @return {Generator<*, ParsedHedTag[], *>} @@ -550,6 +659,8 @@ class ParsedHedString { module.exports = { ParsedHedTag: ParsedHedTag, + ParsedHed2Tag: ParsedHed2Tag, + ParsedHed3Tag: ParsedHed3Tag, ParsedHedGroup: ParsedHedGroup, ParsedHedString: ParsedHedString, }