Class DAMLSelector

All Implemented Interfaces:

public class DAMLSelector
extends SelectorImpl

An extension to the standard Jena selector for querying models, which respects the equivalence that DAML can assert between values. That is, for example, this selector will match a statement:

 myns:ian isCalled "ian".
with a selector:
 new DAMLSelector( resIan, model.getProperty( myns + "sAppel" );
if it is known that myns:ian daml:samePropertyAs myns:sAppel.

Equivalences between classes, properties, instances (individuals) and arbitrary values (using daml:equivalentTo) are respected. This does inevitably add a significant overhead to accessing the values from the model, but is necessary for correctly processing DAML models.

Note that the current release of Jena does not permit us to correctly process equivalence among resources efficiently. Therefore, as a performance hack, DAMLModel.setUseEquivalence(boolean) has been added to the model to allow this behaviour to be turned off under user control. By default, equivalence will be tested.

CVS info: $Id:,v 1.1 2001/09/24 17:02:43 ijd Exp $
Ian Dickinson, HP Labs (email)

Constructor Summary
DAMLSelector(Resource subject, Property predicate, RDFNode object)
          Create a DAML selector.
Method Summary
 boolean test(Statement stmt)
          Answer true if a statement should be included in a selection.
Methods inherited from class com.hp.hpl.mesa.rdf.jena.common.SelectorImpl
getObject, getPredicate, getSubject, selects
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public DAMLSelector(Resource subject,
                    Property predicate,
                    RDFNode object)
Create a DAML selector. Note due to problems with the underlying store.listProperties() implementation, this selector iterates over all statements in the model, by setting the normal selector subject, predicate and object to null. This is ridiculously inefficient, but necessary. TODO: fix this, once Jena has been fixed.
subject - The subject of the statement, or null.
predicate - The predicate of the statement, or null.
object - The object of the statement, or null.
Method Detail


public boolean test(Statement stmt)
Answer true if a statement should be included in a selection. This method tests whether the supplied statement satisfies the subject, predicate and object constraints of the selector, including testing whether other members of known equivalence classes of the subject, predicate or object will satisfy the constraints.
test in class SelectorImpl
stmt - the statement to be tested
true if the statement satisfies the subject, object and predicate constraints and the selects constraint.

Copyright 2001 Hewlett-Packard. All Rights Reserved.