-
Notifications
You must be signed in to change notification settings - Fork 4
Tag patterns
You use a Tag pattern to select one or more columns in a HXL dataset. The tag pattern looks a lot like a hashtag, except that it can include attributes beginning with "-" as well as "+":
#country +code -dest
As with regular attributes, internal whitespace is optional, so "#country+code-dest" and "#country +code -dest" have the same meaning. Order of attributes is not significant.
You can also use a wildcard character (*) for the tag portion to match any hashtag. The attribute rules still apply. Example:
#* +f -children
A tag pattern may optionally end in "!", in which case it is an absolute pattern. That means that exactly the attributes specified in the pattern must be present, but no other ones. For example
#affected +f +children!
will match "#affected +f +children" or "#affected +children +f" but not "#affected" or "#affected +f +children +refugees". Use absolute tag patterns with care—they may break things when you add new attributes to your dataset in the future (it's usually better to use exclusions).
- The hashtag portion of the pattern must always match the hashtag specification unless the pattern uses a wildcard ("#*").
- Any attribute beginning with "+" in the pattern must be present in the target hashtag specification (even if the hashtag portion is a wildcard).
- Any attribute beginning with "-" in the pattern must not be present in the target hashtag specification (even if the hashtag portion is a wildcard).
- Any attribute not included in the pattern may optionally be present in target hashtag specification, unless the pattern is absolute.
Pattern | Description | Matching hashtags | Non-matching hashtags |
---|---|---|---|
#country | The core hashtag must be #country, with any or no attributes | #country, #country +code | #adm1 |
#country +code | The core hashtag must be #country, and at least the +code attribute must be present | #country +code, #country +iso3 +code | #country, #country +iso3 |
#country -code | The core hashtag must be #country, and the +code attribute must not be present | #country, #country +name | #country +code, #country +iso3 +code |
#country -dest +code | The core hashtag must be #country, the +dest attribute must not be present, and the +code attribute must be present | #country +code, #country +source +code | #country +dest +name, #country +dest +code |
* | Match any data column | #country +code, #affected +f | |
* +code -source | Match any column that has the attribute +code and does not have the attribute +source, regardless of the main hashtag | #country+dest+code | #country+source+code |
#inneed+f+elderly! | The core hashtag must be #inneed, and the +f and +elderly attributes (and only those attributes) must be present | #inneed +f +elderly, #inneed +elderly +f | #inneed, #inneed +f +elderly +idps |
Learn more about the HXL standard at http://hxlstandard.org