de.derivo.sparqldlapi
Class Query

java.lang.Object
  extended by de.derivo.sparqldlapi.Query

public abstract class Query
extends java.lang.Object

The Query class represents a SPARQL-DL query and mainly contains query atoms.

Author:
Mario Volke

Constructor Summary
Query()
           
 
Method Summary
static Query create(java.lang.String query)
          A factory method to create a query from string.
abstract  java.util.List<QueryAtomGroup> getAtomGroups()
          Get an unodifiable list of all query atom groups.
abstract  java.util.Set<QueryArgument> getResultVars()
          Get an unodifiable set of all result variables.
abstract  QueryType getType()
          Get the type of the query.
abstract  boolean isAsk()
          Check whether the query is of type ASK
abstract  boolean isEmpty()
          Check whether there are any atoms in the query.
abstract  boolean isResultVar(QueryArgument arg)
          Check whether the given query argument is a result variable.
abstract  boolean isSelect()
          Check whether the query is of type SELECT.
abstract  boolean isSelectDistinct()
          Check whether the query is of type SELECT DISTINCT.
abstract  int numResultVars()
          Get the number of result variables.
abstract  java.lang.String toString()
          Print the SPARQL-DL query as string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Query

public Query()
Method Detail

isEmpty

public abstract boolean isEmpty()
Check whether there are any atoms in the query.

Returns:
True if there are no atoms at all.

getType

public abstract QueryType getType()
Get the type of the query.

Returns:

isResultVar

public abstract boolean isResultVar(QueryArgument arg)
Check whether the given query argument is a result variable.

Returns:
True if the query argument is a result variable, false otherwise.

numResultVars

public abstract int numResultVars()
Get the number of result variables.

Returns:

getResultVars

public abstract java.util.Set<QueryArgument> getResultVars()
Get an unodifiable set of all result variables.

Returns:

getAtomGroups

public abstract java.util.List<QueryAtomGroup> getAtomGroups()
Get an unodifiable list of all query atom groups.

Returns:

isAsk

public abstract boolean isAsk()
Check whether the query is of type ASK

Returns:

isSelect

public abstract boolean isSelect()
Check whether the query is of type SELECT.

Returns:

isSelectDistinct

public abstract boolean isSelectDistinct()
Check whether the query is of type SELECT DISTINCT.

Returns:

toString

public abstract java.lang.String toString()
Print the SPARQL-DL query as string.

Overrides:
toString in class java.lang.Object
Returns:
String containing valid SPARQL-DL query.

create

public static Query create(java.lang.String query)
                    throws QueryParserException
A factory method to create a query from string.

Parameters:
query -
Returns:
Throws:
QueryParserException