Categories
Random observations

2003-11-20 09:14:50

Today I modified my query testing application so that it doesn’t require access to the Internet and uploaded it onto my phone via a data cable. The demo is not very spectacular. It reads in a query in the form of an XML file and an advertisement in the form of another XML file, and sees how closely they match. It reports back the total number of components in the query, the total number of components in the advertisement, and the number of query components that match the advertisement. An exact match occurs if the number of matching components is equal to the number of components in the query. The query can have arbitrarily complex expressions, and the expression language has some built-in functions. Here’s an example:

 <?xml version="1.0" ?>
 <component name="printer">
   <component name="resolution">
     <component name="dpi">
       100     </component>   </component>
   <component name="location">
     <component name="latitude">
       <exp>
         <![CDATA[(that < 44.5) && (that > 31.1235) && (that != 33.3)]]>
       </exp>     </component>
     <component name="building">
       <exp>
         ![CDATA[that.startsWith("GP")]]>
       </exp>
       <component name="level" value="6">
         <component name="room">
           <exp>
             <![CDATA[that == 633]]>
           </exp>
         </component>
       </component>
     </component>
   </component>
 </component>

I hope that shows up as it is supposed to. By the way, this is a completely made up example. The component names and values aren’t actually supposed to mean anything. This example has three expression components if I can count properly. These are the CDATA things that are surrounded by an <exp> tag. The expression language is dynamically typed (i.e. it figures out whether it’s dealing with a string, integer, float or boolean as it goes), and the operators take on different meanings depending upon what the types of the operands are. For example "<&quot behaves differently depending upon whether the operands are strings or numbers. The keyword that stands for the value in the advertisement. Therefore the expression that == 633 is equivalent to using the value attribute. So in the example above we could have simply specified <component name="room" value="633"> instead of using an <exp> element. An application would either have some predefined queries or would build these queries from some simple user input. So don’t go thinking that the user has to type in all this gobbledygook.

The best news of all is that the example actually runs several seconds faster on my phone as compared to the emulator for the phone. Class loading is what takes the longest.

I also worked a bit on the journal paper today. I think it’s ready to be shown to Ted and Jaga.

By ricky

Husband, dad, R&D manager and resident Lean Startup evangelist. I work at NICTA.

Leave a Reply

Your email address will not be published. Required fields are marked *