org.nsdl.mptstore.query.lang.spo
Class SPOQueryCompiler

java.lang.Object
  extended by org.nsdl.mptstore.query.lang.spo.SPOQueryCompiler
All Implemented Interfaces:
QueryCompiler

public class SPOQueryCompiler
extends java.lang.Object
implements QueryCompiler

Compiler for SPO queries.

SPO is a simple query language that returns triples (subject, predicate, object) given a single triple pattern where an asterisk in any position acts as a wildcard.

The grammar for SPO queries is the same as the N-Triples "triple" production, except it allows an asterisk in any node position and is not terminated with a dot.

Author:
cwilper@cs.cornell.edu
See Also:
N-Triples "triple" syntax specification

Field Summary
static java.util.List<java.lang.String> SPO_TARGETS
          The targets are always "s", "p", "o".
 
Constructor Summary
SPOQueryCompiler(TableManager tableManager, boolean backslashIsEscape)
          Instantiate an SPOQueryCompiler.
 
Method Summary
 SQLProvider compile(java.lang.String query)
          Compile the given query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPO_TARGETS

public static final java.util.List<java.lang.String> SPO_TARGETS
The targets are always "s", "p", "o".

Constructor Detail

SPOQueryCompiler

public SPOQueryCompiler(TableManager tableManager,
                        boolean backslashIsEscape)
Instantiate an SPOQueryCompiler.

Parameters:
tableManager - The table manager to be used to look up table names for predicates.
backslashIsEscape - Whether the backslash character should be escaped in the output SQL.
Method Detail

compile

public SQLProvider compile(java.lang.String query)
                    throws QueryException
Compile the given query.

Specified by:
compile in interface QueryCompiler
Parameters:
query - the RDF query.
Returns:
SQLProvider provides the SQL and result column names.
Throws:
QueryException - if there's an error querying.