org.mindswap.pellet.query
Interface Query

All Known Implementing Classes:
QueryImpl

public interface Query

Author:
Evren Sirin

Method Summary
 void addConstraint(aterm.ATermAppl lit, Datatype dt)
           
 void addDistVar(aterm.ATermAppl var)
          Add a distiguished variable to the query but not change the result variables.
 void addEdgePattern(aterm.ATermAppl s, aterm.ATermAppl p, aterm.ATermAppl o)
           
 void addPattern(QueryPattern pattern)
           
 void addResultVar(aterm.ATermAppl var)
          Add a result var to the query whihc makes this variable distinguished and appear in the results.
 void addTypePattern(aterm.ATermAppl ind, aterm.ATermAppl c)
           
 Query apply(QueryResultBinding binding)
          Replace the variables in the query with the values specified in the binding and return a new query instance.
 java.util.List findPatterns(aterm.ATermAppl subj, aterm.ATermAppl pred, aterm.ATermAppl obj)
          Find edges in the query graph that matches the pattern (where null matches anything)
 aterm.ATermList getClasses(aterm.ATermAppl objTerm)
           
 java.util.Set getConstants()
          Return all the (individual) constants used in this query.
 Datatype getDatatype(aterm.ATermAppl term)
           
 java.util.Set getDistLitVars()
          Return the distinguished literal variables.
 java.util.Set getDistObjVars()
          Return the distinguished object variables.
 java.util.Set getDistVars()
          Return all the distinguished variables, i.e. variables that will be bound to individuals (or data values).
 KnowledgeBase getKB()
          The KB that will be used to answer this query.
 java.util.Set getLitVars()
          Return all the literal variables, i.e. variables that will be replaced with data values.
 java.util.Set getObjVars()
          Return all the object variables, i.e. variables that will be replaced with individual names.
 java.util.List getQueryPatterns()
          Return all the query patterns in this query.
 java.util.List getResultVars()
          Return all the variables that will be in the results.
 java.util.Set getVars()
          Return all the variables used in this query.
 boolean isGround()
          Returns true if there are not variables in the query (only constants).
 void prepare()
           
 aterm.ATermAppl rollUpTo(aterm.ATermAppl term)
           
 

Method Detail

addResultVar

void addResultVar(aterm.ATermAppl var)
Add a result var to the query whihc makes this variable distinguished and appear in the results.

Parameters:
var -

addDistVar

void addDistVar(aterm.ATermAppl var)
Add a distiguished variable to the query but not change the result variables.

Parameters:
var -

getVars

java.util.Set getVars()
Return all the variables used in this query.

Returns:

getObjVars

java.util.Set getObjVars()
Return all the object variables, i.e. variables that will be replaced with individual names.

Returns:

getLitVars

java.util.Set getLitVars()
Return all the literal variables, i.e. variables that will be replaced with data values.

Returns:

getConstants

java.util.Set getConstants()
Return all the (individual) constants used in this query.

Returns:

getResultVars

java.util.List getResultVars()
Return all the variables that will be in the results. For RDQL, these are the variables in the SELECT clause.

Returns:

getDistVars

java.util.Set getDistVars()
Return all the distinguished variables, i.e. variables that will be bound to individuals (or data values). Normally, this is supposed to be equal to the result vars but sometimes variables not in the result may be forced to be distinguished. For example, in the query
 SELECT ?y WHERE (?x p ?y) AND (?y langEq "en") 
 
?x is not a result var but it is a distinguised variable because there is no other way for an individual to have a property value with a language tag if that value does not already exist in the ABox.

Returns:

getDistObjVars

java.util.Set getDistObjVars()
Return the distinguished object variables.

Returns:

getDistLitVars

java.util.Set getDistLitVars()
Return the distinguished literal variables.

Returns:

isGround

boolean isGround()
Returns true if there are not variables in the query (only constants).

Returns:

getQueryPatterns

java.util.List getQueryPatterns()
Return all the query patterns in this query.

Returns:

findPatterns

java.util.List findPatterns(aterm.ATermAppl subj,
                            aterm.ATermAppl pred,
                            aterm.ATermAppl obj)
Find edges in the query graph that matches the pattern (where null matches anything)

Parameters:
subj -
pred -
obj -
Returns:

addPattern

void addPattern(QueryPattern pattern)

addTypePattern

void addTypePattern(aterm.ATermAppl ind,
                    aterm.ATermAppl c)

addEdgePattern

void addEdgePattern(aterm.ATermAppl s,
                    aterm.ATermAppl p,
                    aterm.ATermAppl o)

addConstraint

void addConstraint(aterm.ATermAppl lit,
                   Datatype dt)

rollUpTo

aterm.ATermAppl rollUpTo(aterm.ATermAppl term)

getClasses

aterm.ATermList getClasses(aterm.ATermAppl objTerm)

getDatatype

Datatype getDatatype(aterm.ATermAppl term)

apply

Query apply(QueryResultBinding binding)
Replace the variables in the query with the values specified in the binding and return a new query instance.

Parameters:
binding -
Returns:

getKB

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

Returns:

prepare

void prepare()


Copyright © 2007-2009 Natalya Keberle. All Rights Reserved.