diff --git a/docs/source/HedSearchGuide.md b/docs/source/HedSearchGuide.md index 4be0dd7..c4dde7d 100644 --- a/docs/source/HedSearchGuide.md +++ b/docs/source/HedSearchGuide.md @@ -202,32 +202,37 @@ which is notably faster than object-based search and still has the key features ### Text-based search syntax HED text-based syntax is summarized in the following table: -| Query type | Example | Matches | Does not match | -|-------------------------------------------------------------------------------------------|---------------|-------------------------------------------------|---------------------------------------| -| **Anywhere-term**
Prefix the term with *@*
to match in line. | *@A* | *A* in string | No *A* in string | -| **Negation-term**
Prefix the term with *~*
to match line with no term. | *~A* | No *A* in string | *A* in string | -| **Nested-term**
Elements in parentheses
match tags at same level. | *"(A), (B)"* | *(A), (B, C)
((A), (B, C))* | *(A, B)
(A, C, B)
(A, (C, B))* | -| **Wildcard-term**
Use * to match remaining word
(except comma or parenthesis). | *Long** | *Long*
Parent/LongX
Parent/LongY | *Parent/Other* | + +| Query type | Example |Matches | Does not match | +|----------------------------------------------------------------------------------------------------------------------------------------------|---------------|-------------------------------------------------|----------------------------------------| +| **Anywhere-term**
Prefix the term with *@*
to match in line. | *@A* | *A* in string | No *A* in string | +| **Negation-term**
Prefix the term with *~*
to match line with no term. | *~A* | No *A* in string | *A* in string | +| **Nested-term**
Elements in searches with parentheses
match tags at the relative level. | *(A), (B)* | *(A), (B, C)
((A), (B, C))* | *(A, B)
(A, C, B)
(A, (C, B))* | +| **Wildcard-term**
Use * to match remaining terms
(except comma or parenthesis).
Can be used in combination with @ or ~. | *Long** | *Long*
LongX
LongY | *TagDoesNotStartWithLong* | The simplest type of query is to search for the presence or absence of a single tag. Searches can be combined, but all searches are trying to match all terms. The HED text-based searches do not use the HED schema, so searches can handle invalid HED annotations. + ```{warning} -- Specific words only care about their level relative to other specific words, not overall. -- If there are no grouping or anywhere words in the search, it assumes all terms are anywhere words. -- The format of the series should match the format of the search string, whether it's in short or long form. -- To retrieve children of a parent tag, ensure that both the series and search string are in long form. +- Note will only find exact tags unless you add *, to find descendants. +- Nested terms only care about their level relative to other nested terms, not overall. +- If there are no grouping or anywhere terms in the search, it assumes all terms are anywhere terms. +- The format of the query should match the format of the string, whether it's in short or long form. +- To find children of a parent tag, ensure that both the query and search string are in long form. ``` ### Example text-based queries The following table shows some example queries and types of matches: -| Query type | Example query | Matches | Does not match | -|---------------------------------------------|---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------| -| **Tag sharing group
with another tag** | *(Face, Item-interval/1)*
*Face* in group with
exact tag *Item-interval/1* | *(Face, Item-interval/1)*
*Face, Item-interval/1* | *(Face, Item-interval/12)*
*Face, Item-interval/1A*
*(Face, Item-interval)*
*(Item-interval/1)*| -| **Tag sharing group
with wildcard tag** | (Face, Item-interval/1*)
*Face* in group with
tag starting with
*Item-interval/1* | *(Face, Item-interval/1)*
*Face, Item-interval/12*
*(Face, Item-interval/1A)* | *(Face, Item-interval)*
*(Item-interval/1)* | -| **Tag sharing group
with subgroup** | *(Face, (Item-interval/1))*
*Face* in group with
subgroup containing
*Item-interval/1* | *(Face, (Item-interval/1))*
*Face, (Item-interval/1)*
*(Item-interval/1), Event, Face* | *(Face, Item-interval/1)*
*(Item-interval/1)* | +| Query type | Example query | Matches | Does not match | +|---------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------| +| **Tag sharing group
with another tag** | *(Head-part, Item-interval/1)*
*Head-part* in group with
exact tag *Item-interval/1* | *(Head-part, Item-interval/1)*
*Head-part, Item-interval/1* | *(Head-part, Item-interval/12)*
*Head-part, Item-interval/1A*
*(Head-part, Item-interval)*
*(Item-interval/1)* | +| **Tag sharing group
with wildcard tag** | *(Head-part, Item-interval/1*)
*Head-part* in group with
tag starting with
*Item-interval/1* | *(Head-part, Item-interval/1)*
*Head-part, Item-interval/12*
*(Head-part, Item-interval/1A)* | *(Head-part, Item-interval)*
*(Item-interval/1)* | +| **Tag sharing group
with subgroup** | *(Head-part, (Item-interval/1))*
*Head-part* in group with
subgroup containing
*Item-interval/1* | *(Head-part, (Item-interval/1))*
*Head-part, (Item-interval/1)*
*(Item-interval/1), Event, Head-part* | *(Head-part, Item-interval/1)*
*(Item-interval/1)* | +| **Anywhere terms mixed with nested** | *@Event, Head-part, Item-interval/1*
*Event* anywhere with
*Head-part* and *Item-interval/1*
in the same group as each other | *Item-interval/1, Event, Head-part*
*Event, (Item-interval/1, Head-part)*
| *Item-interval/1, Event, (Head-part)*
| +| **If converted to long form first**
Will match parent tags | *@Event, Head-part*, Item-interval/1*
*Event* anywhere with
*Head-part*(or a descendant) and *Item-interval/1*
in the same group as each other | *Item-interval/1, Event, Head-part*
*Event, (Item-interval/1, Cheek)*
| *Item-interval/1, Event, (Head-part)*
| ## Where can HED search be used?