Dear Wiki user, You have subscribed to a wiki page or wiki category on "Devicemap Wiki" for change notification.
The "Patterns2" page has been changed by rezan: https://wiki.apache.org/devicemap/Patterns2?action=diff&rev1=7&rev2=8 <<TableOfContents(2)>> = Data Specification 2.0 = - Draft 1, 2014-01-09 + Draft 1, 2014-01-10 This is the DeviceMap data specification for patterns and attributes. @@ -118, +118 @@ for being returned. Candidates are ranked against each other using the pattern ranking and the highest ranking pattern is returned. - All the pattern types are prefixed with 'Simple'. This means that each pattern token is matched + All the pattern types in 2.0 are prefixed with 'Simple'. This means that each pattern token is matched - using a plain UTF8 string comparison. No regex or other syntax is allowed in Simple patterns. + using a plain byte string comparison. No regex or other syntax is allowed in Simple patterns. - This allows the algorithm to use simple string hashing for matching. This gives maximum performance and scaling complexity equal to a hashtable implementation. A Simple``Hash``Count attribute can be optionally defined which hints the classifier as to how many unique hashes it would need to generate to support the pattern set. + This allows the algorithm to use simple byte or string hashing for matching. This gives maximum performance and scaling complexity equal to a hashtable implementation. A Simple``Hash``Count attribute can be optionally defined which hints the classifier as to how many unique hashes it would need to generate to support the pattern set. Pattern attributes: @@ -144, +144 @@ :: Type: list of pattern token strings :: Required. + Pattern set attributes: + - Default:: + DefaultId:: - :: Type: boolean + :: Type: string - :: Optional. Default: false. + :: Optional. Default: none - :: Only 1 pattern can have a true value. + + SimpleHashCount:: + :: Type: integer + :: Optional. Default: none == PatternType == @@ -169, +174 @@ The following rank types are defined: Strong:: + :: Strong patterns are ranked higher than Weak and None. The Rank``Value is ignored and they are ranked by their position in the pattern stream. + Specifically, the last pattern token position making the pattern successful. - :: Strong patterns are ranked higher than Weak and None. The Rank``Value is ignored and they are ranked by their position in the pattern stream. The lower the position, the higher the rank. When a Strong pattern is found, the pattern matching step can stop and this pattern can be returned without analyzing the rest of the stream. This is because its impossible for another pattern to rank higher. + The lower the position, the higher the rank. When a Strong pattern is found, the pattern matching step can stop and this pattern can be returned without analyzing the rest of the stream. This is because its impossible for another pattern to rank higher. Weak:: :: Weak patterns are ranked below Strong but above None. A Weak pattern can only be returned in the absence of a Strong pattern. Weak patterns always rank higher than None patterns, regardless of their Rank``Value. The Rank``Value is used to rank between successfully matched Weak patterns. @@ -179, +186 @@ In the case where 2 or more patterns have the same Rank``Type and Rank``Value resulting in a tie, the pattern with the longest concatenated matched pattern length is used. If that results in - another tie, the pattern found first is returned. + another tie, the pattern with the first pattern token found is returned. - If no pattern is successfully matched, the default pattern is returned. If no + If no pattern is successfully matched, the Default``Id is returned. If no - default pattern is defined, a null pattern is returned. + Default``Id is defined, a null pattern is returned. === Notes === If 2 or more patterns share the same Pattern``Id, then only 1 of their Pattern``Types need to match. There is an implied OR between multiple Pattern``Types with equal Pattern``Id. - If more than 1 default is defined, the 1st one found in the Pattern file is used. - - 2 or more patterns cannot have identical Rank``Type, Rank``Value, and matched tokens. Since they will be + 2 or more patterns cannot have identical Rank``Type, Rank``Value, and matched tokens. This is undefined behavior since they will be - found at the same time, the pattern the classifier chooses is undefined. + found at the same time. The pattern the classifier chooses can be random. === Examples ===
