|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openanzo.server.repository.query.ServerBGPQuery
public class ServerBGPQuery
ServerBGPQuery creates SQL queries against the Anzo relational schema from conjoined triple patterns. The entire context of a single ServerBGPQuery instance can be constrained with a GRAPH clause (with either an IRI reference or a variable.) It does not handle OPTIONAL patterns, UNION patterns, or FILTERs. The algorithms in this class are based on research in: http://www.cs.wayne.edu/~artem/main/research/TR-DB-052006-CLJF.pdf#search=%22sparql%20sql%20optional%20wayne%22 adjusted to the particulars of the Anzo relational schema. Other deviations from Chebotko et al.'s work are documented below.
| Constructor Summary | |
|---|---|
ServerBGPQuery(RepositoryConnection connection,
QueryInformation qi)
Create a new ServerBGPQuery |
|
| Method Summary | |
|---|---|
void |
addExtraTriplePattern(TriplePatternComponent s,
TriplePatternComponent p,
TriplePatternComponent o)
Add an extra triple patter to this query. |
void |
addLikeMatch(Variable variable,
java.lang.String matchText)
Add an pattern for the special textLike predicate |
void |
addOptionalPattern(TriplePattern tp)
Add an optional triple pattern to this query. |
void |
addOptionalPatterns(java.util.List<TriplePattern> tps)
Add an optional triple patterns to this query. |
void |
addTriplePattern(TriplePattern tp)
Add a regular triple pattern to this query |
java.lang.String |
getExtraSQL(java.lang.String tempTable,
java.util.ArrayList<Bindable> bindableColumns,
java.util.ArrayList<Bindable> resultColumns,
java.lang.Long lastTransactionTime)
Get the SQL string for this query for the extra triple patterns. |
java.lang.String |
getOuterJoinString(java.lang.String leftSideSql,
java.util.ArrayList<Bindable> leftSelectedColumns,
java.util.List<org.openanzo.server.repository.query.ServerBGPQuery.TripleInstance> rightSideTriples,
java.util.ArrayList<Bindable> resultColumns,
boolean useDefaultDataset,
int depth,
java.lang.Long lastTransactionTime)
This returns a new sql string, which does an outer join between a provided sql select statement, and a set of optional triple patterns |
java.lang.String |
getSQL(boolean extras,
java.lang.String tableName,
java.util.ArrayList<Bindable> bindableColumns,
java.lang.Long lastTransactionTime)
Get the SQL string for this query. |
void |
setGraphVariable(Variable variable)
Set the graph variable for the current node |
void |
setNamedGraph(IRIReference iri)
Set the graph URI for the current node |
void |
setThisNode(TreeNode node)
Set the TreeNode that this query is processing |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ServerBGPQuery(RepositoryConnection connection,
QueryInformation qi)
connection - connection to databaseqi - query| Method Detail |
|---|
public void setThisNode(TreeNode node)
node - the TreeNode that this query is processingpublic void setGraphVariable(Variable variable)
variable - the graph variable for the current node
public void setNamedGraph(IRIReference iri)
throws NoSolutionsException
iri - the graph URI for the current node
NoSolutionsException - if the provided named graph URI does not exist in the systempublic void addTriplePattern(TriplePattern tp)
tp - triple pattern to add
public void addExtraTriplePattern(TriplePatternComponent s,
TriplePatternComponent p,
TriplePatternComponent o)
s - Subject value or variablep - Property value or variableo - Object value or variablepublic void addOptionalPattern(TriplePattern tp)
tp - triple pattern to addpublic void addOptionalPatterns(java.util.List<TriplePattern> tps)
tps - triple patterns to add
public void addLikeMatch(Variable variable,
java.lang.String matchText)
variable - variable for subject of patternmatchText - string to match in like query
public java.lang.String getSQL(boolean extras,
java.lang.String tableName,
java.util.ArrayList<Bindable> bindableColumns,
java.lang.Long lastTransactionTime)
throws NoSolutionsException
extras - true if there are "Extra" triple patterns besides the regular patterns.tableName - temporary table to place results in, if extra is truebindableColumns - names of the columns/bindings for the resultslastTransactionTime - timestamp of last transaction to include in queries
NoSolutionsException
public java.lang.String getExtraSQL(java.lang.String tempTable,
java.util.ArrayList<Bindable> bindableColumns,
java.util.ArrayList<Bindable> resultColumns,
java.lang.Long lastTransactionTime)
throws NoSolutionsException
tempTable - temporary table that holds results from getSQL callbindableColumns - names of the columns/bindings that can are available due to the initial getSQL stepresultColumns - names of the columns/bindings for the resultslastTransactionTime - timestamp of last transaction to include in queries
NoSolutionsException
public java.lang.String getOuterJoinString(java.lang.String leftSideSql,
java.util.ArrayList<Bindable> leftSelectedColumns,
java.util.List<org.openanzo.server.repository.query.ServerBGPQuery.TripleInstance> rightSideTriples,
java.util.ArrayList<Bindable> resultColumns,
boolean useDefaultDataset,
int depth,
java.lang.Long lastTransactionTime)
throws NoSolutionsException
leftSideSql - sql select statement text which makes up left side of join,leftSelectedColumns - columns that are to be returned from the left side of the joinrightSideTriples - triple patterns that make up the optionalresultColumns - columns that are to be returned from the right side of the joinuseDefaultDataset - does this query go against the defaultDatasetdepth - how many nested outerJoins are we currently atlastTransactionTime - timestamp of last transaction to include in queries
NoSolutionsException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||