PREVIOUS   NEXT   CONTENTS   HOME 

5.5 Custom Queries

The Faceted Query Engine can be extended with custom queries. The query engine is implemented in the Java programming language; to define a new query one needs to add a simple Java class with only a few lines of code. Custom queries are typically implemented by an administrative user. The only requirement for such a user is that he has basic knowledge of Java.

Consider for example a dataset that contains information regarding the precise locations of finds at the excavation site. We can use this information and relate entity sets in a new way: based on whether they are at most a given distance away from each other. To do this, we define a query translation that takes as input a desired maximum distance, and is implemented in a manner similar to this (with a bit of additional bookkeeping). Here, FROM_X, FROM_Y, and FROM_Z are coordinates of the first object, and TO_X, TO_Y, and TO_Z -- coordinates of the second object. The class TranslationProperties and several example sub-classes are provided in our software distribution.

public class DistanceTranslation extends TranslationProperties {

    /* initialization details omitted */
    
    public boolean translate(float max_distance) {

      float distance = power(FROM_X.value - TO_X.value, 2) + 
             	       power(FROM_Y.value - TO_Y.value, 2) + 

                       power(FROM_Z.value - TO_Z.value, 2);

      return (distance < power(max_distance, 2.0));
    }
}

 PREVIOUS   NEXT   CONTENTS   HOME 

© Internet Archaeology URL: http://intarch.ac.uk/journal/issue21/3/custom.html
Last updated: Mon April 30 2007