com.clarkparsia.pellet.sparqldl.model
Interface Query

All Known Implementing Classes:
QueryImpl

public interface Query

Title: Query Interface

Description:

Copyright: Copyright (c) 2007

Company: Clark & Parsia, LLC.

Author:
Petr Kremen

Nested Class Summary
static class Query.VarType
           
 
Method Summary
 void add(QueryAtom atom)
          Adds an query atom to the query.
 void addDistVar(aterm.ATermAppl a, Query.VarType type)
          Adds a distinguished variable to the query with its type - there can be more variable types to support punning.
 void addResultVar(aterm.ATermAppl a)
          Adds a distinguished variable that appears in the result projection to the query;
 Query apply(ResultBinding binding)
          Replace the variables in the query with the values specified in the binding and return a new query instance (without modifying this query).
 java.util.List<QueryAtom> findAtoms(QueryPredicate predicate, aterm.ATermAppl... arguments)
          Searches for given atom pattern.
 java.util.List<QueryAtom> getAtoms()
          Get all the atoms in the query.
 java.util.Set<aterm.ATermAppl> getConstants()
          Return individuals and literals used in this query.
 java.util.Set<aterm.ATermAppl> getDistVars()
          Return all the distinguished variables.
 java.util.Set<aterm.ATermAppl> getDistVarsForType(Query.VarType queryType)
          Returns variables that occur in the subquery specified by the given type.
 Filter getFilter()
          Sets the filter for this query.
 KnowledgeBase getKB()
          The KB that will be used to answer this query.
 aterm.ATermAppl getName()
          Return the name of this query
 QueryParameters getQueryParameters()
          Get the query parameterization values
 java.util.List<aterm.ATermAppl> getResultVars()
          Return all the variables that will be in the results.
 java.util.Set<aterm.ATermAppl> getUndistVars()
          Return all undistinguished variables used in this query.
 java.util.Set<aterm.ATermAppl> getVars()
          Return all the variables used in this query.
 boolean isDistinct()
          Returns true if distinct results are required.
 boolean isGround()
          Checks whether the query is ground.
 void remove(QueryAtom atom)
           
 Query reorder(int[] atoms)
          Creates a subquery from the given query.
 aterm.ATermAppl rollUpTo(aterm.ATermAppl distVar, java.util.Collection<aterm.ATermAppl> avoidList, boolean stopOnConstants)
          Rolls up the query to the given variable.
 void setFilter(Filter filter)
          Sets the filter for this query.
 void setKB(KnowledgeBase kb)
          Sets the KB that will be used to answer this query.
 void setName(aterm.ATermAppl name)
          Sets the name of this query
 void setQueryParameters(QueryParameters parameters)
          Set the query parameterization
 

Method Detail

setFilter

void setFilter(Filter filter)
Sets the filter for this query.


getFilter

Filter getFilter()
Sets the filter for this query.

Returns:

isDistinct

boolean isDistinct()
Returns true if distinct results are required.

Returns:

getDistVarsForType

java.util.Set<aterm.ATermAppl> getDistVarsForType(Query.VarType queryType)
Returns variables that occur in the subquery specified by the given type.

Returns:

add

void add(QueryAtom atom)
Adds an query atom to the query.

Parameters:
atom -

addDistVar

void addDistVar(aterm.ATermAppl a,
                Query.VarType type)
Adds a distinguished variable to the query with its type - there can be more variable types to support punning.

Parameters:
atom -

addResultVar

void addResultVar(aterm.ATermAppl a)
Adds a distinguished variable that appears in the result projection to the query;

Parameters:
atom -

getVars

java.util.Set<aterm.ATermAppl> getVars()
Return all the variables used in this query.

Returns:
Set of variables

getUndistVars

java.util.Set<aterm.ATermAppl> getUndistVars()
Return all undistinguished variables used in this query.

Returns:
Set of variables

getConstants

java.util.Set<aterm.ATermAppl> getConstants()
Return individuals and literals used in this query.

Returns:

getResultVars

java.util.List<aterm.ATermAppl> getResultVars()
Return all the variables that will be in the results. For SPARQL, these are the variables in the SELECT clause.

Returns:
Set of variables

getDistVars

java.util.Set<aterm.ATermAppl> getDistVars()
Return all the distinguished variables. These are variables that will be bound to individuals (or data values) existing in the KB.

Returns:
Set of variables

getAtoms

java.util.List<QueryAtom> getAtoms()
Get all the atoms in the query.

Returns:

getKB

KnowledgeBase getKB()
The KB that will be used to answer this query.

Returns:

setKB

void setKB(KnowledgeBase kb)
Sets the KB that will be used to answer this query.

Parameters:
kb - KB that will be used to answer this query

isGround

boolean isGround()
Checks whether the query is ground.

Returns:
true iff the query is ground

apply

Query apply(ResultBinding binding)
Replace the variables in the query with the values specified in the binding and return a new query instance (without modifying this query).

Parameters:
binding -
Returns:

rollUpTo

aterm.ATermAppl rollUpTo(aterm.ATermAppl distVar,
                         java.util.Collection<aterm.ATermAppl> avoidList,
                         boolean stopOnConstants)
Rolls up the query to the given variable.

Parameters:
distVar -
Returns:

reorder

Query reorder(int[] atoms)
Creates a subquery from the given query. Atoms are listed according to the 'atoms' parameter.

Parameters:
atoms - selected atom indices
Returns:
subquery

remove

void remove(QueryAtom atom)

findAtoms

java.util.List<QueryAtom> findAtoms(QueryPredicate predicate,
                                    aterm.ATermAppl... arguments)
Searches for given atom pattern. This also might be used for different types of rolling-up, involving various sets of allowed atom types.

Returns:
query atoms in the order as they appear in the query

setQueryParameters

void setQueryParameters(QueryParameters parameters)
Set the query parameterization


getQueryParameters

QueryParameters getQueryParameters()
Get the query parameterization values

Returns:
QueryParameters

getName

aterm.ATermAppl getName()
Return the name of this query

Returns:
name of the query

setName

void setName(aterm.ATermAppl name)
Sets the name of this query

Parameters:
name - name of the query


Copyright © 2004 Evren Sirin. All Rights Reserved.