com.hp.hpl.jena.daml.common
Class DAMLSelector

java.lang.Object
  |
  +--com.hp.hpl.mesa.rdf.jena.common.SelectorImpl
        |
        +--com.hp.hpl.jena.daml.common.DAMLSelector
All Implemented Interfaces:
Selector

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.

Version:
CVS info: $Id: DAMLSelector.java,v 1.1 2001/09/24 17:02:43 ijd Exp $
Author:
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

DAMLSelector

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.
Parameters:
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

test

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.
Overrides:
test in class SelectorImpl
Parameters:
stmt - the statement to be tested
Returns:
true if the statement satisfies the subject, object and predicate constraints and the selects constraint.


Copyright 2001 Hewlett-Packard. All Rights Reserved.