|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openanzo.common.rdb.sql.GraphSQL
public class GraphSQL
GraphSQL provides wrappers around SQL queries and transforms ResultSets into java objects
| Nested Class Summary | |
|---|---|
static class |
GraphSQL.BatchClear
Batch operation for adding parameters to the Clear prepared statement |
static class |
GraphSQL.BatchDeleteStatement
Batch operation for adding parameters to the DeleteStatement prepared statement |
static class |
GraphSQL.BatchInsertStatement
Batch operation for adding parameters to the InsertStatement prepared statement |
static interface |
GraphSQL.DeleteStatementParams
Interface for managing the parameters to the deleteStatement prepared statement. |
static class |
GraphSQL.DeleteStatementParamsImpl
Default implementation of DeleteStatementParams |
static interface |
GraphSQL.InsertStatementParams
Interface for managing the parameters to the insertStatement prepared statement. |
static class |
GraphSQL.InsertStatementParamsImpl
Default implementation of InsertStatementParams |
static interface |
GraphSQL.ResolveStatementsResult
Interface for holding the results of the resolveStatements prepared statement. |
static class |
GraphSQL.ResolveStatementsResultImpl
Default implementation of ResolveStatementsResult |
static interface |
GraphSQL.StatementExistsParams
Interface for managing the parameters to the statementExists prepared statement. |
static class |
GraphSQL.StatementExistsParamsImpl
Default implementation of StatementExistsParams |
| Field Summary | |
|---|---|
static java.lang.String |
clear
Constant "clear" used to reference prepared statement graph.clear
DELETE FROM ${a} WHERE NAMEDGRAPHID=?
|
static java.lang.String |
commitInsertStatements
Constant "commitInsertStatements" used to reference prepared statement graph.commitInsertStatements
INSERT INTO ${b} (METADATA,NAMEDGRAPHID,SUBJ,PROP,OBJ) SELECT ST.METADATA, ST.NAMEDGRAPHID, ST.SUBJ, ST.PROP, ST.OBJ FROM ${a} ST
|
static java.lang.String |
commitInsertStatementsNew
Constant "commitInsertStatementsNew" used to reference prepared statement graph.commitInsertStatementsNew
MERGE INTO ${b} USING ${a} ON ${b}.NAMEDGRAPHID = ${a}.NAMEDGRAPHID AND ${b}.SUBJ = ${a}.SUBJ AND ${b}.PROP = ${a}.PROP AND ${b}.OBJ = ${a}.OBJ WHEN NOT MATCHED THEN INSERT (NAMEDGRAPHID,SUBJ,PROP,OBJ) VALUES(${a}.NAMEDGRAPHID,${a}.SUBJ,${a}.PROP,${a}.OBJ) ELSE IGNORE
|
static java.lang.String |
deleteStatement
Constant "deleteStatement" used to reference prepared statement graph.deleteStatement
DELETE FROM ${a} WHERE NAMEDGRAPHID=? AND SUBJ = ? AND PROP = ? AND OBJ = ?
|
static java.lang.String |
insertStatement
Constant "insertStatement" used to reference prepared statement graph.insertStatement
INSERT INTO ${a} (METADATA,NAMEDGRAPHID,SUBJ, PROP, OBJ) VALUES(?,?, ?, ?, ?)
|
static java.lang.String |
purge
Constant "purge" used to reference prepared statement graph.purge
DELETE FROM ${a}
|
static java.lang.String |
purgeInsertStatements
Constant "purgeInsertStatements" used to reference prepared statement graph.purgeInsertStatements
DELETE FROM ${a} ST WHERE EXISTS (SELECT S.NAMEDGRAPHID FROM ${c} S WHERE ST.METADATA=S.METADATA AND S.NAMEDGRAPHID=ST.NAMEDGRAPHID AND S.SUBJ=ST.SUBJ AND S.PROP=ST.PROP AND S.OBJ=ST.OBJ)
|
static java.lang.String |
resolveStatements
Constant "resolveStatements" used to reference prepared statement graph.resolveStatements
SELECT A.METADATA,A.NAMEDGRAPHID,A.SUBJ, A.PROP, A.OBJ FROM ${a} AS A WHERE EXISTS(SELECT B.NAMEDGRAPHID FROM ${b} AS B WHERE A.METADATA=B.METADATA AND A.NAMEDGRAPHID=B.NAMEDGRAPHID AND A.SUBJ = B.SUBJ AND A.PROP = B.PROP AND A.OBJ = B.OBJ )
|
static java.lang.String |
size
Constant "size" used to reference prepared statement graph.size
SELECT COUNT(NAMEDGRAPHID) FROM ${a} WHERE NAMEDGRAPHID=?
|
static java.lang.String |
statementExists
Constant "statementExists" used to reference prepared statement graph.statementExists
SELECT COUNT(*) FROM ${a} WHERE NAMEDGRAPHID=? AND SUBJ = ? AND PROP = ? AND OBJ = ?
|
| Constructor Summary | |
|---|---|
GraphSQL()
|
|
| Method Summary | |
|---|---|
static void |
clear(PreparedStatementCache sqlCache,
long namedgraphId,
java.lang.String graphTableName)
Runs the clear prepared statement. |
static int |
commitInsertStatements(PreparedStatementCache sqlCache,
java.lang.String bulkResolutionTableName,
java.lang.String statementTableName)
Runs the commitInsertStatements prepared statement. |
static int |
commitInsertStatementsNew(PreparedStatementCache sqlCache,
java.lang.String bulkResolutionTableName,
java.lang.String statementTableName)
Runs the commitInsertStatementsNew prepared statement. |
static void |
deleteStatement(PreparedStatementCache sqlCache,
GraphSQL.DeleteStatementParams params,
java.lang.String graphTableName)
Runs the deleteStatement prepared statement. |
static void |
deleteStatement(PreparedStatementCache sqlCache,
long namedgraphId,
long subj,
long prop,
long obj,
java.lang.String graphTableName)
Runs the deleteStatement prepared statement. |
static void |
insertStatement(PreparedStatementCache sqlCache,
GraphSQL.InsertStatementParams params,
java.lang.String graphTableName)
Runs the insertStatement prepared statement. |
static void |
insertStatement(PreparedStatementCache sqlCache,
int metadata,
long namedgraphId,
long subj,
long prop,
long obj,
java.lang.String graphTableName)
Runs the insertStatement prepared statement. |
static void |
prepareClear(java.sql.PreparedStatement ps,
long namedgraphId)
Sets the input parameters for the clear prepared statement. |
static void |
prepareCommitInsertStatements(java.sql.PreparedStatement ps)
Sets the input parameters for the commitInsertStatements prepared statement. |
static void |
prepareCommitInsertStatementsNew(java.sql.PreparedStatement ps)
Sets the input parameters for the commitInsertStatementsNew prepared statement. |
static void |
prepareDeleteStatement(java.sql.PreparedStatement ps,
long namedgraphId,
long subj,
long prop,
long obj)
Sets the input parameters for the deleteStatement prepared statement. |
static void |
prepareInsertStatement(java.sql.PreparedStatement ps,
int metadata,
long namedgraphId,
long subj,
long prop,
long obj)
Sets the input parameters for the insertStatement prepared statement. |
static void |
preparePurge(java.sql.PreparedStatement ps)
Sets the input parameters for the purge prepared statement. |
static void |
preparePurgeInsertStatements(java.sql.PreparedStatement ps)
Sets the input parameters for the purgeInsertStatements prepared statement. |
static void |
prepareResolveStatements(java.sql.PreparedStatement ps)
Sets the input parameters for the resolveStatements prepared statement. |
static void |
prepareSize(java.sql.PreparedStatement ps,
long namedgraphId)
Sets the input parameters for the size prepared statement. |
static void |
prepareStatementExists(java.sql.PreparedStatement ps,
long namedgraphId,
long subj,
long prop,
long obj)
Sets the input parameters for the statementExists prepared statement. |
static int |
purge(PreparedStatementCache sqlCache,
java.lang.String graphTableName)
Runs the purge prepared statement. |
static int |
purgeInsertStatements(PreparedStatementCache sqlCache,
java.lang.String bulkResolutionTableName,
java.lang.String bulkResolutionTableName2,
java.lang.String statementTableName)
Runs the purgeInsertStatements prepared statement. |
static ClosableIterator<GraphSQL.ResolveStatementsResult> |
resolveStatements(PreparedStatementCache sqlCache,
java.lang.String bulkResolutionTableName,
java.lang.String statementTableName)
Runs the resolveStatements prepared statement with the default transformer. |
static ClosableIterator<GraphSQL.ResolveStatementsResult> |
resolveStatements(PreparedStatementCache sqlCache,
java.lang.String bulkResolutionTableName,
java.lang.String statementTableName,
Transformer<GraphSQL.ResolveStatementsResult> transform)
Runs the resolveStatements prepared statement. |
static java.lang.Integer |
size(PreparedStatementCache sqlCache,
long namedgraphId,
java.lang.String graphTableName)
Runs the size prepared statement. |
static java.lang.Integer |
statementExists(PreparedStatementCache sqlCache,
GraphSQL.StatementExistsParams params,
java.lang.String graphTableName)
Runs the statementExists prepared statement. |
static java.lang.Integer |
statementExists(PreparedStatementCache sqlCache,
long namedgraphId,
long subj,
long prop,
long obj,
java.lang.String graphTableName)
Runs the statementExists prepared statement. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String insertStatement
INSERT INTO ${a} (METADATA,NAMEDGRAPHID,SUBJ, PROP, OBJ) VALUES(?,?, ?, ?, ?)
public static final java.lang.String statementExists
SELECT COUNT(*) FROM ${a} WHERE NAMEDGRAPHID=? AND SUBJ = ? AND PROP = ? AND OBJ = ?
public static final java.lang.String size
SELECT COUNT(NAMEDGRAPHID) FROM ${a} WHERE NAMEDGRAPHID=?
public static final java.lang.String deleteStatement
DELETE FROM ${a} WHERE NAMEDGRAPHID=? AND SUBJ = ? AND PROP = ? AND OBJ = ?
public static final java.lang.String resolveStatements
SELECT A.METADATA,A.NAMEDGRAPHID,A.SUBJ, A.PROP, A.OBJ FROM ${a} AS A WHERE EXISTS(SELECT B.NAMEDGRAPHID FROM ${b} AS B WHERE A.METADATA=B.METADATA AND A.NAMEDGRAPHID=B.NAMEDGRAPHID AND A.SUBJ = B.SUBJ AND A.PROP = B.PROP AND A.OBJ = B.OBJ )
public static final java.lang.String purgeInsertStatements
DELETE FROM ${a} ST WHERE EXISTS (SELECT S.NAMEDGRAPHID FROM ${c} S WHERE ST.METADATA=S.METADATA AND S.NAMEDGRAPHID=ST.NAMEDGRAPHID AND S.SUBJ=ST.SUBJ AND S.PROP=ST.PROP AND S.OBJ=ST.OBJ)
public static final java.lang.String commitInsertStatements
INSERT INTO ${b} (METADATA,NAMEDGRAPHID,SUBJ,PROP,OBJ) SELECT ST.METADATA, ST.NAMEDGRAPHID, ST.SUBJ, ST.PROP, ST.OBJ FROM ${a} ST
public static final java.lang.String commitInsertStatementsNew
MERGE INTO ${b} USING ${a} ON ${b}.NAMEDGRAPHID = ${a}.NAMEDGRAPHID AND ${b}.SUBJ = ${a}.SUBJ AND ${b}.PROP = ${a}.PROP AND ${b}.OBJ = ${a}.OBJ WHEN NOT MATCHED THEN INSERT (NAMEDGRAPHID,SUBJ,PROP,OBJ) VALUES(${a}.NAMEDGRAPHID,${a}.SUBJ,${a}.PROP,${a}.OBJ) ELSE IGNORE
public static final java.lang.String clear
DELETE FROM ${a} WHERE NAMEDGRAPHID=?
public static final java.lang.String purge
DELETE FROM ${a}
| Constructor Detail |
|---|
public GraphSQL()
| Method Detail |
|---|
public static void insertStatement(PreparedStatementCache sqlCache,
GraphSQL.InsertStatementParams params,
java.lang.String graphTableName)
throws RdbException
INSERT INTO ${a} (METADATA,NAMEDGRAPHID,SUBJ, PROP, OBJ) VALUES(?,?, ?, ?, ?)
sqlCache - factory and cache of PreparedStatmentsparams - InsertStatementParams input InterfacegraphTableName - template parameter
RdbException
public static void insertStatement(PreparedStatementCache sqlCache,
int metadata,
long namedgraphId,
long subj,
long prop,
long obj,
java.lang.String graphTableName)
throws RdbException
INSERT INTO ${a} (METADATA,NAMEDGRAPHID,SUBJ, PROP, OBJ) VALUES(?,?, ?, ?, ?)
sqlCache - factory and cache of PreparedStatmentsmetadata - template parameternamedgraphId - template parametersubj - template parameterprop - template parameterobj - template parametergraphTableName - template parameter
RdbException
public static void prepareInsertStatement(java.sql.PreparedStatement ps,
int metadata,
long namedgraphId,
long subj,
long prop,
long obj)
throws java.sql.SQLException
ps - PreparedStatement to whose parameters are setmetadata - template parameternamedgraphId - template parametersubj - template parameterprop - template parameterobj - template parameter
java.sql.SQLException
public static java.lang.Integer statementExists(PreparedStatementCache sqlCache,
GraphSQL.StatementExistsParams params,
java.lang.String graphTableName)
throws RdbException
SELECT COUNT(*) FROM ${a} WHERE NAMEDGRAPHID=? AND SUBJ = ? AND PROP = ? AND OBJ = ?
sqlCache - factory and cache of PreparedStatmentsparams - StatementExistsParams input InterfacegraphTableName - template parameter
RdbException
public static java.lang.Integer statementExists(PreparedStatementCache sqlCache,
long namedgraphId,
long subj,
long prop,
long obj,
java.lang.String graphTableName)
throws RdbException
SELECT COUNT(*) FROM ${a} WHERE NAMEDGRAPHID=? AND SUBJ = ? AND PROP = ? AND OBJ = ?
sqlCache - factory and cache of PreparedStatmentsnamedgraphId - template parametersubj - template parameterprop - template parameterobj - template parametergraphTableName - template parameter
RdbException
public static void prepareStatementExists(java.sql.PreparedStatement ps,
long namedgraphId,
long subj,
long prop,
long obj)
throws java.sql.SQLException
ps - PreparedStatement to whose parameters are setnamedgraphId - template parametersubj - template parameterprop - template parameterobj - template parameter
java.sql.SQLException
public static java.lang.Integer size(PreparedStatementCache sqlCache,
long namedgraphId,
java.lang.String graphTableName)
throws RdbException
SELECT COUNT(NAMEDGRAPHID) FROM ${a} WHERE NAMEDGRAPHID=?
sqlCache - factory and cache of PreparedStatmentsnamedgraphId - template parametergraphTableName - template parameter
RdbException
public static void prepareSize(java.sql.PreparedStatement ps,
long namedgraphId)
throws java.sql.SQLException
ps - PreparedStatement to whose parameters are setnamedgraphId - template parameter
java.sql.SQLException
public static void deleteStatement(PreparedStatementCache sqlCache,
GraphSQL.DeleteStatementParams params,
java.lang.String graphTableName)
throws RdbException
DELETE FROM ${a} WHERE NAMEDGRAPHID=? AND SUBJ = ? AND PROP = ? AND OBJ = ?
sqlCache - factory and cache of PreparedStatmentsparams - DeleteStatementParams input InterfacegraphTableName - template parameter
RdbException
public static void deleteStatement(PreparedStatementCache sqlCache,
long namedgraphId,
long subj,
long prop,
long obj,
java.lang.String graphTableName)
throws RdbException
DELETE FROM ${a} WHERE NAMEDGRAPHID=? AND SUBJ = ? AND PROP = ? AND OBJ = ?
sqlCache - factory and cache of PreparedStatmentsnamedgraphId - template parametersubj - template parameterprop - template parameterobj - template parametergraphTableName - template parameter
RdbException
public static void prepareDeleteStatement(java.sql.PreparedStatement ps,
long namedgraphId,
long subj,
long prop,
long obj)
throws java.sql.SQLException
ps - PreparedStatement to whose parameters are setnamedgraphId - template parametersubj - template parameterprop - template parameterobj - template parameter
java.sql.SQLException
public static ClosableIterator<GraphSQL.ResolveStatementsResult> resolveStatements(PreparedStatementCache sqlCache,
java.lang.String bulkResolutionTableName,
java.lang.String statementTableName)
throws RdbException
SELECT A.METADATA,A.NAMEDGRAPHID,A.SUBJ, A.PROP, A.OBJ FROM ${a} AS A WHERE EXISTS(SELECT B.NAMEDGRAPHID FROM ${b} AS B WHERE A.METADATA=B.METADATA AND A.NAMEDGRAPHID=B.NAMEDGRAPHID AND A.SUBJ = B.SUBJ AND A.PROP = B.PROP AND A.OBJ = B.OBJ )
sqlCache - factory and cache of PreparedStatmentsbulkResolutionTableName - template parameterstatementTableName - template parameter
RdbException
public static ClosableIterator<GraphSQL.ResolveStatementsResult> resolveStatements(PreparedStatementCache sqlCache,
java.lang.String bulkResolutionTableName,
java.lang.String statementTableName,
Transformer<GraphSQL.ResolveStatementsResult> transform)
throws RdbException
SELECT A.METADATA,A.NAMEDGRAPHID,A.SUBJ, A.PROP, A.OBJ FROM ${a} AS A WHERE EXISTS(SELECT B.NAMEDGRAPHID FROM ${b} AS B WHERE A.METADATA=B.METADATA AND A.NAMEDGRAPHID=B.NAMEDGRAPHID AND A.SUBJ = B.SUBJ AND A.PROP = B.PROP AND A.OBJ = B.OBJ )
sqlCache - factory and cache of PreparedStatmentsbulkResolutionTableName - template parameterstatementTableName - template parametertransform - org.openanzo.jdbc.utils.TransformerRdbException
public static void prepareResolveStatements(java.sql.PreparedStatement ps)
throws java.sql.SQLException
ps - PreparedStatement to whose parameters are set
java.sql.SQLException
public static int purgeInsertStatements(PreparedStatementCache sqlCache,
java.lang.String bulkResolutionTableName,
java.lang.String bulkResolutionTableName2,
java.lang.String statementTableName)
throws RdbException
DELETE FROM ${a} ST WHERE EXISTS (SELECT S.NAMEDGRAPHID FROM ${c} S WHERE ST.METADATA=S.METADATA AND S.NAMEDGRAPHID=ST.NAMEDGRAPHID AND S.SUBJ=ST.SUBJ AND S.PROP=ST.PROP AND S.OBJ=ST.OBJ)
sqlCache - factory and cache of PreparedStatmentsbulkResolutionTableName - template parameterbulkResolutionTableName2 - template parameterstatementTableName - template parameter
RdbException
public static void preparePurgeInsertStatements(java.sql.PreparedStatement ps)
throws java.sql.SQLException
ps - PreparedStatement to whose parameters are set
java.sql.SQLException
public static int commitInsertStatements(PreparedStatementCache sqlCache,
java.lang.String bulkResolutionTableName,
java.lang.String statementTableName)
throws RdbException
INSERT INTO ${b} (METADATA,NAMEDGRAPHID,SUBJ,PROP,OBJ) SELECT ST.METADATA, ST.NAMEDGRAPHID, ST.SUBJ, ST.PROP, ST.OBJ FROM ${a} ST
sqlCache - factory and cache of PreparedStatmentsbulkResolutionTableName - template parameterstatementTableName - template parameter
RdbException
public static void prepareCommitInsertStatements(java.sql.PreparedStatement ps)
throws java.sql.SQLException
ps - PreparedStatement to whose parameters are set
java.sql.SQLException
public static int commitInsertStatementsNew(PreparedStatementCache sqlCache,
java.lang.String bulkResolutionTableName,
java.lang.String statementTableName)
throws RdbException
MERGE INTO ${b} USING ${a} ON ${b}.NAMEDGRAPHID = ${a}.NAMEDGRAPHID AND ${b}.SUBJ = ${a}.SUBJ AND ${b}.PROP = ${a}.PROP AND ${b}.OBJ = ${a}.OBJ WHEN NOT MATCHED THEN INSERT (NAMEDGRAPHID,SUBJ,PROP,OBJ) VALUES(${a}.NAMEDGRAPHID,${a}.SUBJ,${a}.PROP,${a}.OBJ) ELSE IGNORE
sqlCache - factory and cache of PreparedStatmentsbulkResolutionTableName - template parameterstatementTableName - template parameter
RdbException
public static void prepareCommitInsertStatementsNew(java.sql.PreparedStatement ps)
throws java.sql.SQLException
ps - PreparedStatement to whose parameters are set
java.sql.SQLException
public static void clear(PreparedStatementCache sqlCache,
long namedgraphId,
java.lang.String graphTableName)
throws RdbException
DELETE FROM ${a} WHERE NAMEDGRAPHID=?
sqlCache - factory and cache of PreparedStatmentsnamedgraphId - template parametergraphTableName - template parameter
RdbException
public static void prepareClear(java.sql.PreparedStatement ps,
long namedgraphId)
throws java.sql.SQLException
ps - PreparedStatement to whose parameters are setnamedgraphId - template parameter
java.sql.SQLException
public static int purge(PreparedStatementCache sqlCache,
java.lang.String graphTableName)
throws RdbException
DELETE FROM ${a}
sqlCache - factory and cache of PreparedStatmentsgraphTableName - template parameter
RdbException
public static void preparePurge(java.sql.PreparedStatement ps)
throws java.sql.SQLException
ps - PreparedStatement to whose parameters are set
java.sql.SQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||