typo on an important point:

This will give the patterns much more flexibility and power and allow * us * to 
better deal with pattern ambiguity.



________________________________
 From: Reza <[email protected]>
To: Apache Device Map DEV <[email protected]> 
Sent: Sunday, June 23, 2013 3:40 PM
Subject: device map pattern builders
 

So Im going to go ahead and jump the gun a bit and propose some new builders 
for the device map project.

OpenDDR introduced several builders to help guide the pattern matching. The 
problem I saw was that in figuring out which builder to use, you probably also 
know the device by then. So I would like to create some new higher level, 
generic, and more powerful builders.

So lets say we have the following pattern:

 <device id="id1234">
   <list>
     <value>pat1</value>
     <value>pat2</value>

     <value>pat3</value>

   </list>
 </device>

Here are some builders which will define how the pattern gets resolved:


* org.apache.devicemap.builder.strong_and

 This builder must find all the patterns in the group to be valid. When all 
patterns are found, classification stops immediately and the device is 
returned. The reason for having strong patterns is performance. In the user 
agent domain, unique patterns are usually found in the beginning of the string 
and when they are found, we really don't care what else is in there. This could 
deliver several multiples of performance gain. Example: iphone, ipad.


* org.apache.devicemap.builder.strong_or


 Same as stong_and except only 1 pattern in the group needs to be found. Hence 
the 'or'.


* org.apache.devicemap.builder.strong


 Same as strong_or.


* org.apache.devicemap.builder.weak_and_[RANK]


 All patterns need to be found and when they are, this device is saved with the 
specified rank. At the end of classification, the highest ranking weak pattern 
is returned. If there is a tie, the first and longest ranked weak pattern is 
returned. This will be useful for defining patterns which are likely to be a 
device in the absence of other 'stronger' patterns.


* org.apache.devicemap.builder.weak_or_[RANK]


 Same as weak_or_[RANK] exception only 1 pattern in the group needs to be 
found. Highest ranked pattern competes with weak_and_[RANK] patterns at the end 
of classification.


* org.apache.devicemap.builder.weak_and


 Same as weak_and_[RANK] except there is no rank. So this has an implied rank 
of 0.


* org.apache.devicemap.builder.weak_or


 Same as weak_or_[RANK] except there is an implied rank of 0.


* org.apache.devicemap.builder.weak


 Same as weak_or.


* org.apache.devicemap.builder.simple


 This is the lowest type of pattern which can be found. This is only returned 
when no other strong or weak pattern is found. The first and longest pattern is 
found. This pattern will be useful for fallback patterns like: android, 
blackberry, desktop browsers, etc. Basically, we didn't any identifiable 
patterns, but we did find something which tells us something general about the 
device.


Regex is not going to be supported. Supporting regex will seriously ratchet up 
the complexity of doing the pattern matching and I dont think its really 
needed... right?

Let me know your thoughts on this. From an algorithm perspective, it only takes 
a few lines of code to implement all these new builders (using my java client 
algorithm as the base). This will give the patterns much more flexibility and 
power and allow use to better deal with pattern ambiguity.

I don't expect to implement any of this in the short term since there are 
higher priorities at the moment. But once we get some momentum, we should 
consider making some enhancements.

Reza

Reply via email to