com.hp.hpl.jena.reasoner.dig
Class DIGQueryTranslator

java.lang.Object
  extended by com.hp.hpl.jena.reasoner.dig.DIGQueryTranslator
Direct Known Subclasses:
DIGIteratedQueryTranslator, DIGQueryAllConceptsTranslator, DIGQueryAllIndividualsTranslator, DIGQueryAllRolesTranslator, DIGQueryAncestorsTranslator, DIGQueryDifferentFromTranslator, DIGQueryDisjointTranslator, DIGQueryEquivalentsTranslator, DIGQueryInstancesTranslator, DIGQueryInstanceTranslator, DIGQueryIsConceptTranslator, DIGQueryIsEquivalentTranslator, DIGQueryIsIndividualTranslator, DIGQueryIsRoleTranslator, DIGQueryRoleAncestorsTranslator, DIGQueryRoleFillersTranslator, DIGQueryRoleFillerTranslator, DIGQuerySubsumesTranslator, DIGQueryTypesTranslator

public abstract class DIGQueryTranslator
extends Object

Base class for translators that map incoming RDF find patterns to DIG queries.

Version:
Release @release@ ($Id: DIGQueryTranslator.java,v 1.14 2004/12/07 09:56:36 andy_seaborne Exp $)
Author:
Ian Dickinson, HP Labs (email)

Field Summary
static String ALL
           
 
Constructor Summary
DIGQueryTranslator(String subject, String predicate, String object)
          Construct an abstract translator, given the URI's of nodes to match against or null to represent
 
Method Summary
 boolean checkObject(Node object, DIGAdapter da, Model premises)
          Additional test on the object of the incoming find pattern.
 boolean checkPredicate(Node pred, DIGAdapter da, Model premises)
          Additional test on the predicate of the incoming find pattern.
 boolean checkSubject(Node subject, DIGAdapter da, Model premises)
          Additional test on the subject of the incoming find pattern.
 boolean checkTriple(TriplePattern pattern, DIGAdapter da, Model premises)
          An optional post-trigger check on the consituents of the triple pattern.
 ExtendedIterator find(TriplePattern pattern, DIGAdapter da)
          Translate the given pattern to a DIG query, and pass it on to the DIG adapter as a query.
 ExtendedIterator find(TriplePattern pattern, DIGAdapter da, Model premises)
          Translate the given pattern (with given premises) to a DIG query, and pass it on to the DIG adapter as a query.
abstract  Document translatePattern(TriplePattern query, DIGAdapter da)
          Answer an XML document that presents the translation of the query into DIG query language.
abstract  Document translatePattern(TriplePattern pattern, DIGAdapter da, Model premises)
          Answer an XML document that presents the translation of the query into DIG query language, given that either the subject or object may be expressions defined by the statements in the premises model.
abstract  ExtendedIterator translateResponse(Document Response, TriplePattern query, DIGAdapter da)
          Answer an extended iterator over the triples that result from translatig the given DIG response to RDF.
 boolean trigger(TriplePattern pattern, DIGAdapter da, Model premises)
          Answer true if this translator applies to the given triple pattern.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL

public static final String ALL
See Also:
Constant Field Values
Constructor Detail

DIGQueryTranslator

public DIGQueryTranslator(String subject,
                          String predicate,
                          String object)

Construct an abstract translator, given the URI's of nodes to match against or null to represent

Method Detail

find

public ExtendedIterator find(TriplePattern pattern,
                             DIGAdapter da)

Translate the given pattern to a DIG query, and pass it on to the DIG adapter as a query. Translate the results of the query back to a triple stream via an extended iterator. Assumes this method is called contingent on a successful trigger(com.hp.hpl.jena.reasoner.TriplePattern, com.hp.hpl.jena.reasoner.dig.DIGAdapter, com.hp.hpl.jena.rdf.model.Model).

Parameters:
pattern - The pattern to translate to a DIG query
da - The DIG adapter through which we communicate with a DIG reasoner

find

public ExtendedIterator find(TriplePattern pattern,
                             DIGAdapter da,
                             Model premises)

Translate the given pattern (with given premises) to a DIG query, and pass it on to the DIG adapter as a query. Translate the results of the query back to a triple stream via an extended iterator.

Parameters:
pattern - The pattern to translate to a DIG query
da - The DIG adapter through which we communicate with a DIG reasoner
premises - Model conveying additional information about the resources in the subject or object

trigger

public boolean trigger(TriplePattern pattern,
                       DIGAdapter da,
                       Model premises)

Answer true if this translator applies to the given triple pattern.

Parameters:
pattern - An incoming patter to match against
da - The current dig adapter
premises - An optional Model that is used to convey the statements in the additional premises to the query
Returns:
True if this translator applies to the pattern.

checkTriple

public boolean checkTriple(TriplePattern pattern,
                           DIGAdapter da,
                           Model premises)

An optional post-trigger check on the consituents of the triple pattern. By default, delegates to a check on each of the subjec, object and predicate. However, this method may be overridden by sub-classes to provide a more context-sensitive test.

Parameters:
pattern - The triple pattern
da - The current dig adapter
premises - Model denoting premises to the query, or null
Returns:
True if the pattern conforms to the prerequisites for a given translation step

checkSubject

public boolean checkSubject(Node subject,
                            DIGAdapter da,
                            Model premises)

Additional test on the subject of the incoming find pattern. Default is to always match

Parameters:
subject - The subject resource from the incoming pattern
da - The current dig adapter
premises - A model that conveys additional information about the premises of the query, which might assist the check to suceed or fail. By default it is ignored.
Returns:
True if this subject matches the trigger condition expressed by this translator instance

checkObject

public boolean checkObject(Node object,
                           DIGAdapter da,
                           Model premises)

Additional test on the object of the incoming find pattern. Default is to always match

Parameters:
object - The object resource from the incoming pattern
da - The current dig adapter
premises - A model that conveys additional information about the premises of the query, which might assist the check to suceed or fail. By default it is ignored.
Returns:
True if this object matches the trigger condition expressed by this translator instance

checkPredicate

public boolean checkPredicate(Node pred,
                              DIGAdapter da,
                              Model premises)

Additional test on the predicate of the incoming find pattern. Default is to always match

Parameters:
pred - The predicate resource from the incoming pattern
da - The current dig adapter
premises - A model that conveys additional information about the premises of the query, which might assist the check to suceed or fail. By default it is ignored.
Returns:
True if this predicate matches the trigger condition expressed by this translator instance

translatePattern

public abstract Document translatePattern(TriplePattern query,
                                          DIGAdapter da)

Answer an XML document that presents the translation of the query into DIG query language.


translatePattern

public abstract Document translatePattern(TriplePattern pattern,
                                          DIGAdapter da,
                                          Model premises)

Answer an XML document that presents the translation of the query into DIG query language, given that either the subject or object may be expressions defined by the statements in the premises model.


translateResponse

public abstract ExtendedIterator translateResponse(Document Response,
                                                   TriplePattern query,
                                                   DIGAdapter da)

Answer an extended iterator over the triples that result from translatig the given DIG response to RDF.



Copyright © 2000, 2001, 2002, 2003, 2004 Hewlett-Packard Development Company, LP