public class OraclePropertyGraphUtils extends OraclePropertyGraphUtilsBase
ERR_ARG_CANNOT_BE_NULL, ERR_CODE_NOT_IN_LIST, ERR_DOP_CONSTRAINT, ERR_E_AUTO_IDX_MUST_SOLR_OR_LUCENE, ERR_E_AUTO_IDX_NOT_EXIST, ERR_E_DS_MUSTBE_FILE_OR_IS, ERR_E_MAX_LINE_CONSTRAINT, ERR_EDGE_DIR_NOT_BOTH, ERR_EDGE_WORK_TBL_NOT_CLEAN, ERR_GRAPH_NAME_CANT_BENULL, ERR_HIT_EXCEPTION, ERR_HIT_INTERRUPT, ERR_HIT_IO, ERR_HIT_OPGE, ERR_HIT_PARSEE, ERR_ID_CANNOT_BE_NULL, ERR_IDX_KEY_CANNOT_BE_NULL, ERR_IDX_KEY_NOT_NULL, ERR_IDX_KEYS_NOT_NULL, ERR_IN_DS_EDGE_CANTBE_NULL, ERR_IN_DS_VERT_CANTBE_NULL, ERR_IN_E_FLAT_DOESNT_EXIST, ERR_IN_V_FLAT_DOESNT_EXIST, ERR_INPUT_LIST_NOT_NULL, ERR_INPUT_NOT_NULL, ERR_INVALID_CHANGE_ACTION, ERR_INVALID_NUM_FIELDS, ERR_INVALID_NUM_NOARG, ERR_INVALID_NUMBER, ERR_INVALID_VAL, ERR_KEY_CANNOT_BE_ID, ERR_KEY_CANNOT_BE_NULL, ERR_KEY_CANNOT_BE_NULL_EMPTY, ERR_KEY_NOT_SET_TO, ERR_NO_ELEM_TO_BE_CONSUMED, ERR_NO_OP_SUPPORTED, ERR_NOT_IMPLEMENTED_YET, ERR_NOT_ORACLE_V_E, ERR_NUM_PART_CONSTRAINT, ERR_OFFSET_CONSTRAINT, ERR_OFFSET_E_MUST_BE_POS, ERR_OFFSET_V_MUST_BE_POS, ERR_OPT_FLAG_EDGE_INVALID, ERR_OPT_FLAG_VERT_INVALID, ERR_ORA_TEXT_INVALID_KEY, ERR_ORA_TEXT_ONLY_AUTO, ERR_OUTPUT_LIST_NOT_NULL, ERR_PG_ALREADY_EXISTS, ERR_PG_NOT_EMPTY, ERR_PG_NOT_NULL, ERR_SIZE_MUST_BE_POS, ERR_TIMEOUT_TAB_CREATION, ERR_TXT_IDX_NOT_FOUND, ERR_TYPE_ID_NOT_RECO, ERR_UNSUPPORTED_VAL_TYP, ERR_USER_REQ_OP_CANCEL, ERR_V_AUTO_IDX_MUST_SOLR_OR_LUCENE, ERR_V_AUTO_IDX_NOT_EXIST, ERR_V_DS_MUSTBE_FILE_OR_IS, ERR_V_MAX_LINE_CONSTRAINT, ERR_VALUE_CANNOT_BE_NULL, INFO_EMP_K_NO_P_VAL, INFO_NUL_K_NO_P_VAL
Constructor and Description |
---|
OraclePropertyGraphUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkSnapshotExist(java.lang.String szGraphName, java.lang.String tableOwner, java.sql.Connection conn, long lSnapshotID)
This method returns TRUE if a particular snapshot exists for a given property graph
|
static boolean |
checkSnapshotTableExist(java.lang.String szGraphName, java.lang.String tableOwner, java.sql.Connection conn)
This method returns TRUE if a designated table for storing snapshots exists for a given property graph
|
static void |
clearPropertyGraph(Oracle oracle, java.lang.String szGraphName)
This method clears the contents from the underlying schema objects for the specified property graph.
|
static void |
cloneGraph(java.sql.Connection conn, java.lang.String szOrgGraphName, java.lang.String szNewGraphName, int iDOP, int iNumSubPtns, java.lang.String szTBS, java.lang.String szOptions)
This method makes a clone of a given graph.
|
static void |
copyGraph(Oracle oracle, java.lang.String graphName, java.lang.String newGraphName)
Copy the property graph (including its associated tables) to the specified graph name (if it is not empty).
|
static void |
copyGraph(Oracle oracle, java.lang.String graphName, java.lang.String newGraphName, int dop)
Copy the property graph (including its associated tables) to the specified graph name (if it is not empty).
|
static void |
createSnapshotTable(java.lang.String szGraphName, java.lang.String tableOwner, java.sql.Connection conn, int dop, java.lang.String options, java.lang.String tablespace, boolean nologging)
This method creates the snapshot table for storing in-memory graphs
|
static void |
dropPropertyGraph(Oracle oracle, java.lang.String szGraphName)
Drops the specified property graph (including its associated tables).
|
static void |
dropPropertyGraphTables(Oracle oracle, java.lang.String szGraphName)
Drops the underlying tables of specified property graph (including its associated tables).
|
static void |
dropTable(java.sql.Connection conn, java.lang.String tableName)
Drop the specified table
|
static void |
dropTable(java.sql.Connection conn, java.lang.String owner, java.lang.String tableName)
Drop the specified table
|
static boolean |
existsGraph(Oracle conn, java.lang.String graphName)
Checks if the specified property graph already exists in the database
|
static void |
exportFlatFiles(OraclePropertyGraph pg, java.io.OutputStream osVertex, java.io.OutputStream osEdge, int dop, boolean append)
This function exports a given property graph into two flat files: one for vertices and the other for edges.
|
static void |
exportFlatFiles(OraclePropertyGraph pg, java.io.OutputStream osVertex, java.io.OutputStream osEdge, int dop, boolean append, boolean closeStreams)
This function exports a given property graph into two flat files: one for vertices and the other for edges.
|
static void |
exportFlatFiles(java.lang.String jdbcUrl, java.lang.String user, java.lang.String password, java.lang.String propertyGraphName, java.lang.String vertexFileName, java.lang.String edgeFileName)
This function exports a given property graph into two flat files: one for vertices and the other for edges.
|
static javax.sql.DataSource |
getDataSource(java.lang.String dsName)
Gets a DataSource object from the given data source name
|
static java.util.List<java.lang.String> |
getGraphNames(Oracle oracle)
List all the names of the property graphs stored in the given database
|
static boolean |
hasTable(java.sql.Connection conn, java.lang.String tableName, java.lang.String tableOwner)
Verifies if the specified table exists in the given Oracle Database
|
static PropertyType |
idTypeAsPropertyType(IdType type)
Converts a
IdType object into a PropertyType object |
static void |
quietlyCloseConnections(Oracle[] oracleArray, java.sql.Connection[] connections)
Quietly close an array of
Oracle objects handling connections to an Oracle Database. |
static void |
readBinaryInMemGraphSnapshot(java.lang.String szGraphName, java.lang.String tableOwner, java.sql.Connection conn, java.io.OutputStream[] os, long lSnapshotID, int dop)
Reads an In-Memory Graph Snapshot (binary file) from the snapshot SS$ table and writes it into the given outputstream.
|
static void |
renameGraph(Oracle oracle, java.lang.String graphName, java.lang.String newGraphName)
Renames the property graph (including its associated tables) to the specified graph name (if it does not exists or is not empty).
|
static void |
renameGraph(Oracle oracle, java.lang.String graphName, java.lang.String newGraphName, boolean nologging, java.lang.String szOptions)
Renames the property graph (including its associated tables) to the specified graph name (if it does not exists or is not empty).
|
static void |
storeBinaryInMemGraphSnapshot(java.lang.String szGraphName, java.lang.String tableOwner, java.sql.Connection conn, java.io.InputStream is, long lSnapshotID, int dop)
Stores an In-Memory Graph Snapshot (binary file) into the snapshot SS$ table.
|
static void |
storeBinaryInMemGraphSnapshot(java.lang.String szGraphName, java.lang.String tableOwner, java.sql.Connection conn, java.io.InputStream is, long lSnapshotID, long lTimestamp, int dop)
Stores an In-Memory Graph Snapshot (binary file) into the snapshot SS$ table.
|
static void |
validateEdgeFlatFileSyntax(java.io.InputStream is, boolean continueOnError, java.io.PrintStream psOutput)
This method validates the syntax of given PG edge file
|
static void |
validatePGFlatFiles(java.lang.String vertexFile, java.lang.String edgeFile, boolean continueOnError)
This method validates the syntax of given PG vertex and edge file
|
static void |
validateVertexFlatFileSyntax(java.io.InputStream is, boolean continueOnError, java.io.PrintStream psOutput)
This method validates the syntax of given PG vertex file
|
castAsOracleConnection, compareFiles, compareValueObjects, exportEdgeFlatFile, exportEdges, exportFlatFiles, exportFlatFiles, exportFlatFiles, exportFlatFiles, exportVertexFlatFile, exportVertices, getDatatypeAsPropertyType, getPropertiesFromFile, getPropertyType, getPropertyValueAsStr, handleGZipInputStream, isDateValue, isNumericValue, listify, outputEdgeRecord, outputVertexRecord, outputVertexRecord, prepareConfigEdgePropertiesFromOPVFile, prepareConfigVertexPropertiesFromOPVFile, quietlyClose, quietlyClose, quietlyClose, quietlyClose, quietlyClose, quietlyCloseResultSet, quietlyCloseResultSetAndStmt, quietlyCloseResultSetAndStmt, quietlyCloseStmt, quietlyShutdown, saveInputStreamIntoFile, size, size, unescape, validateSources
convertCSV2OPE, convertCSV2OPE, convertCSV2OPE, convertCSV2OPE, convertCSV2OPE, convertCSV2OPE, convertCSV2OPE, convertCSV2OPV, convertCSV2OPV, convertCSV2OPV, convertCSV2OPV, convertCSV2OPV, convertRDBMSTable2OPE, convertRDBMSTable2OPE, convertRDBMSTable2OPE, convertRDBMSTable2OPE, convertRDBMSTable2OPE, convertRDBMSTable2OPE, convertRDBMSTable2OPE, convertRDBMSTable2OPE, convertRDBMSTable2OPV, convertRDBMSTable2OPV, convertRDBMSTable2OPV, convertRDBMSTable2OPV
public static boolean checkSnapshotExist(java.lang.String szGraphName, java.lang.String tableOwner, java.sql.Connection conn, long lSnapshotID) throws java.sql.SQLException
szGraphName
- the graph name where to get the snapshottableOwner
- the owner of the snapshot tableconn
- an Oracle
connectionlSnapshotID
- the ID of the snapshot to writejava.sql.SQLException
public static boolean checkSnapshotTableExist(java.lang.String szGraphName, java.lang.String tableOwner, java.sql.Connection conn) throws java.sql.SQLException
szGraphName
- the graph name where to get the snapshottableOwner
- the owner of the snapshot tableconn
- an Oracle
connectionjava.sql.SQLException
public static void clearPropertyGraph(Oracle oracle, java.lang.String szGraphName) throws java.sql.SQLException
java.sql.SQLException
public static void cloneGraph(java.sql.Connection conn, java.lang.String szOrgGraphName, java.lang.String szNewGraphName, int iDOP, int iNumSubPtns, java.lang.String szTBS, java.lang.String szOptions) throws java.sql.SQLException
conn
- a JDBC connection to Oracle DatabaseszOrgGraphName
- name of the original graphszNewGraphName
- name of the new graphiDOP
- degree of parallelismiNumSubPtns
- number of sub partitions to be used for the new graph. Has to be a positive integer (and a power of 2)szTBS
- name of the tablespace to be used for the new graphszOptions
- options to be passed on to the underlying PL/SQL API.java.sql.SQLException
public static void copyGraph(Oracle oracle, java.lang.String graphName, java.lang.String newGraphName) throws java.io.IOException, java.lang.Exception
oracle
- an Oracle
connection to the database where the property graph is stored.graphName
- the name of the property graph to be copiednewGraphName
- the new name of the graphjava.io.IOException
java.lang.Exception
public static void copyGraph(Oracle oracle, java.lang.String graphName, java.lang.String newGraphName, int dop) throws java.io.IOException, java.lang.Exception
oracle
- an Oracle
connection to the database where the property graph is stored.graphName
- the name of the property graph to be copiednewGraphName
- the new name of the graphdop
- the degree of parallelism to use when copying the data from one graph to the otherjava.io.IOException
java.lang.Exception
public static void createSnapshotTable(java.lang.String szGraphName, java.lang.String tableOwner, java.sql.Connection conn, int dop, java.lang.String options, java.lang.String tablespace, boolean nologging) throws java.sql.SQLException
java.sql.SQLException
public static void dropPropertyGraph(Oracle oracle, java.lang.String szGraphName) throws java.sql.SQLException
oracle
- an Oracle
connection to the database where the property graph is stored.szGraphName
- the name of the graph to drop.java.sql.SQLException
public static void dropPropertyGraphTables(Oracle oracle, java.lang.String szGraphName) throws java.sql.SQLException
oracle
- an Oracle
connection to the database where the property graph is stored.szGraphName
- the name of the graph to drop.java.sql.SQLException
public static void dropTable(java.sql.Connection conn, java.lang.String tableName) throws java.sql.SQLException
conn
- a Connection
to Oracle DatabasetableName
- the name of the tablejava.sql.SQLException
public static void dropTable(java.sql.Connection conn, java.lang.String owner, java.lang.String tableName) throws java.sql.SQLException
conn
- a Connection
to Oracle DatabasetableName
- the name of the tablejava.sql.SQLException
public static boolean existsGraph(Oracle conn, java.lang.String graphName)
conn
- a Oracle
connection to the databasegraphName
- the name of the property graphjava.io.IOException
public static final void exportFlatFiles(OraclePropertyGraph pg, java.io.OutputStream osVertex, java.io.OutputStream osEdge, int dop, boolean append) throws java.io.IOException, java.io.FileNotFoundException
pg
- the property graph that will be exported into flat filesosVertex
- an OutputStream
object for the vertex flat fileosEdge
- an OutputStream
object for the edge flat filedop
- the degree of parallelism used when writing the data into the flat files. This will use multiple threads to optimize writing performance.append
- if false, overwrite the existing flat files removing all existing data.java.io.IOException
java.io.FileNotFoundException
public static void exportFlatFiles(OraclePropertyGraph pg, java.io.OutputStream osVertex, java.io.OutputStream osEdge, int dop, boolean append, boolean closeStreams) throws java.io.IOException, java.io.FileNotFoundException
pg
- the property graph that will be exported into flat filesosVertex
- an OutputStream
object for the vertex flat fileosEdge
- an OutputStream
object for the edge flat filedop
- the degree of parallelism used when writing the data into the flat files. This will use multiple threads to optimize writing performance.append
- if false, overwrite the existing flat files removing all existing data.closeStreams
- whether to close the OutputStreams or notjava.io.IOException
java.io.FileNotFoundException
public static void exportFlatFiles(java.lang.String jdbcUrl, java.lang.String user, java.lang.String password, java.lang.String propertyGraphName, java.lang.String vertexFileName, java.lang.String edgeFileName) throws java.sql.SQLException, java.io.IOException, java.io.FileNotFoundException
jdbcUrl
- JDBC URL that identifies an Oracle databaseuser
- username of a database schemapassword
- password to authenticatepropertyGraphName
- the name of the property graph to exportvertexFileName
- the name of the vertex flat file e.g. graph.opvedgeFileName
- the name of the edge flat file e.g. graph.opejava.sql.SQLException
java.io.IOException
java.io.FileNotFoundException
public static javax.sql.DataSource getDataSource(java.lang.String dsName) throws java.sql.SQLException, javax.naming.NamingException
dsName
- the data source namejava.sql.SQLException
javax.naming.NamingException
public static java.util.List<java.lang.String> getGraphNames(Oracle oracle)
oracle
- an Oracle
connection to the database where the property graph is stored.public static boolean hasTable(java.sql.Connection conn, java.lang.String tableName, java.lang.String tableOwner)
conn
- a Connection
to Oracle DatabasetableName
- the name of the tabletableOwner
- the owner of the tablepublic static PropertyType idTypeAsPropertyType(IdType type)
IdType
object into a PropertyType
objectpublic static void quietlyCloseConnections(Oracle[] oracleArray, java.sql.Connection[] connections)
Oracle
objects handling connections to an Oracle Database.oracleArray
- the array of Oracle
connections to be closed.connections
- the array of Connection
objects obtained from the Oracle objects.public static void readBinaryInMemGraphSnapshot(java.lang.String szGraphName, java.lang.String tableOwner, java.sql.Connection conn, java.io.OutputStream[] os, long lSnapshotID, int dop) throws OraclePropertyGraphException, java.sql.SQLException
szGraphName
- the graph name where to get the snapshottableOwner
- the owner of the snapshot tableconn
- an Oracle
connectionos
- an array of OutputStream
objects where the in-memory graph binary files will be written.lSnapshotID
- the ID of the snapshot to readdop
- the degree of parallelism to use when reading the snapshotOraclePropertyGraphException
java.sql.SQLException
OraclePropertyGraphException
public static void renameGraph(Oracle oracle, java.lang.String graphName, java.lang.String newGraphName) throws java.io.IOException, java.lang.Exception
oracle
- an Oracle
connection to the database where the property graph is stored.graphName
- the name of the property graph to be renamednewGraphName
- the new name of the property graph.java.io.IOException
java.lang.Exception
public static void renameGraph(Oracle oracle, java.lang.String graphName, java.lang.String newGraphName, boolean nologging, java.lang.String szOptions) throws java.io.IOException, java.lang.Exception
oracle
- an Oracle
connection to the database where the property graph is stored.graphName
- the name of the property graph to be renamednewGraphName
- the new name of the property graph.nologging
- if logging is enabled on the underlying PL/SQL API.szOptions
- options to be passed on to the underlying PL/SQL API.java.io.IOException
java.lang.Exception
public static void storeBinaryInMemGraphSnapshot(java.lang.String szGraphName, java.lang.String tableOwner, java.sql.Connection conn, java.io.InputStream is, long lSnapshotID, int dop) throws OraclePropertyGraphException
szGraphName
- the graph name where to get the snapshottableOwner
- the owner of the snapshot tableconn
- an Oracle
connectionis
- an InputStream
objects where the in-memory graph binary files will be read.lSnapshotID
- the ID of the snapshot to writedop
- the degree of parallelism to use when writing the snapshotOraclePropertyGraphException
java.sql.SQLException
OraclePropertyGraphException
public static void storeBinaryInMemGraphSnapshot(java.lang.String szGraphName, java.lang.String tableOwner, java.sql.Connection conn, java.io.InputStream is, long lSnapshotID, long lTimestamp, int dop) throws OraclePropertyGraphException
szGraphName
- the graph name where to get the snapshottableOwner
- the owner of the snapshot tableconn
- an Oracle
connectionis
- an InputStream
objects where the in-memory graph binary files will be read.lSnapshotID
- the ID of the snapshot to writedop
- the degree of parallelism to use when writing the snapshotOraclePropertyGraphException
java.sql.SQLException
OraclePropertyGraphException
public static void validateEdgeFlatFileSyntax(java.io.InputStream is, boolean continueOnError, java.io.PrintStream psOutput)
public static void validatePGFlatFiles(java.lang.String vertexFile, java.lang.String edgeFile, boolean continueOnError)
public static void validateVertexFlatFileSyntax(java.io.InputStream is, boolean continueOnError, java.io.PrintStream psOutput)