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 byte[] |
bigIntegerToByteArray(java.math.BigInteger key)
Parse a bigInteger into a byte array of length 16.
|
static java.lang.String |
byteArrayToStr(java.lang.String marker, byte[] ba)
Returns a string representation of the specified byte array
|
static java.lang.String |
bytesToHex(byte[] bytes)
Parse a byte array into a Hex-based string.
|
static void |
copyGraph(org.apache.hadoop.conf.Configuration conf, 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 |
dropPropertyGraph(org.apache.hadoop.conf.Configuration conf, java.lang.String szGraphName)
Drops the specified property graph (including its associated tables).
|
static void |
dropTable(org.apache.hadoop.hbase.client.Admin admin, java.lang.String tableName)
Drops the specified table This operation cannot be undone.
|
static boolean |
existsGraph(org.apache.hadoop.conf.Configuration conf, java.lang.String graphName)
Checks if the specified property graph already exists in the database
|
static boolean |
existsTable(org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.TableName tableName)
Checks if the specified property graph already exists in the database
|
static void |
exportEdgeFlatFile(OraclePropertyGraph pg, java.io.OutputStream osEdge, int dop, boolean append, boolean closeStream)
This function exports the edges of a given property graph into OPE flat file
|
static void |
exportFlatFiles(OraclePropertyGraph pg, java.io.OutputStream osVertex, java.io.OutputStream osEdge, boolean append, int dop)
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(OraclePropertyGraph pg, java.lang.String vertexFileName, java.lang.String edgeFileName, 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.lang.String vertexFileName, java.lang.String edgeFileName, 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 |
exportVertexFlatFile(OraclePropertyGraph pg, java.io.OutputStream osVertex, int dop, boolean append, boolean closeStream)
This function exports the vertices of a given property graph into OPV flat file
|
static java.util.List<java.lang.String> |
getGraphNames(org.apache.hadoop.conf.Configuration conf)
List all the names of the property graphs stored in the given database
|
static byte[][] |
getHexSplitsWithEndpoints(java.lang.String startKey, java.lang.String endKey, int numRegions)
Generates an array with the splits (including the end points) for the specified start and end keys.
|
static void |
printByteArray(java.lang.String marker, byte[] ba, java.io.PrintStream ps)
Prints a string representation of the byte array to the specified PrintStream
|
static void |
quietlyCloseConnection(org.apache.hadoop.hbase.client.Connection connection)
Quietly close an
Connection object handling a connection to an Apache HBase Database |
static void |
quietlyCloseConnections(org.apache.hadoop.hbase.client.Connection[] connections)
Quietly close an array of
Connection objects handling connections to an Apache HBase Database. |
static void |
renameGraph(org.apache.hadoop.conf.Configuration conf, 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 boolean |
sameSubArray(byte[] ba1, byte[] ba2, int iStart, int iLen)
Verifies if two byte arrays are equals from the specified start and length.
|
castAsOracleConnection, compareFiles, compareValueObjects, exportEdgeFlatFile, exportEdges, exportFlatFiles, exportFlatFiles, exportFlatFiles, exportFlatFiles, exportGraphML, exportGraphML, exportGraphSON, exportGraphSON, exportVertexFlatFile, exportVertices, getDatatypeAsPropertyType, getPropertiesFromFile, getPropertyType, getPropertyValueAsStr, handleGZipInputStream, importGraphML, importGraphML, importGraphSON, importGraphSON, 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 byte[] bigIntegerToByteArray(java.math.BigInteger key)
key
- the big integer to be parsedpublic static java.lang.String byteArrayToStr(java.lang.String marker, byte[] ba)
marker
- an additional marker to be printed with the byte arrayba
- the byte array to be printedpublic static java.lang.String bytesToHex(byte[] bytes)
bytes
- the byte array to be parsed.public static void copyGraph(org.apache.hadoop.conf.Configuration conf, java.lang.String graphName, java.lang.String newGraphName) throws java.io.IOException, java.lang.Exception
conf
- the Configuration object with all the HBase connection information.graphName
- the name of the property graph to be copiednewGraphName
- the new name of the graphjava.io.IOException
java.lang.Exception
public static void dropPropertyGraph(org.apache.hadoop.conf.Configuration conf, java.lang.String szGraphName) throws java.io.IOException, java.lang.Exception
conf
- the Configuration object with all the HBase connection information.szGraphName
- the name of the graph to drop.java.io.IOException
java.lang.Exception
public static void dropTable(org.apache.hadoop.hbase.client.Admin admin, java.lang.String tableName) throws java.io.IOException
admin
- the Admin
object with all the HBase connection information.tableName
- the name of the table to drop.java.io.IOException
java.lang.Exception
public static boolean existsGraph(org.apache.hadoop.conf.Configuration conf, java.lang.String graphName) throws java.io.IOException
conf
- the Configuration object with all the HBase connection information.graphName
- the name of the property graphjava.io.IOException
public static boolean existsTable(org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.TableName tableName) throws java.io.IOException
admin
- the Admin
object with all the HBase connection information.tableName
- the name of the property graphjava.io.IOException
public static void exportEdgeFlatFile(OraclePropertyGraph pg, java.io.OutputStream osEdge, int dop, boolean append, boolean closeStream) throws java.io.IOException, java.io.FileNotFoundException, java.lang.InterruptedException
pg
- the property graph that will be exported into flat filesosEdge
- an OutputStream
object for the edge flat filedop
- the degree of parallelism used when writing the data into the flat file. This will use multiple threads to optimize writing performance.append
- if false, overwrite the existing flat file removing all existing data.closeStream
- whether to close the OutputStream or notjava.io.IOException
java.io.FileNotFoundException
java.lang.InterruptedException
public static void exportFlatFiles(OraclePropertyGraph pg, java.io.OutputStream osVertex, java.io.OutputStream osEdge, boolean append, int dop) throws java.io.IOException, java.io.FileNotFoundException, java.lang.InterruptedException
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
java.lang.InterruptedException
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, java.lang.InterruptedException
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
java.lang.InterruptedException
public static final void exportFlatFiles(OraclePropertyGraph pg, java.lang.String vertexFileName, java.lang.String edgeFileName, boolean append) throws java.io.IOException, java.io.FileNotFoundException, java.lang.InterruptedException
pg
- the property graph that will be exported into flat filesvertexFileName
- the name of the vertex flat file e.g. graph.opvedgeFileName
- the name of the edge flat file e.g. graph.opeappend
- if false, overwrite the existing flat files removing all existing data.java.lang.InterruptedException
java.io.IOException
java.io.FileNotFoundException
public static final void exportFlatFiles(OraclePropertyGraph pg, java.lang.String vertexFileName, java.lang.String edgeFileName, int dop, boolean append) throws java.io.IOException, java.io.FileNotFoundException, java.lang.InterruptedException
pg
- the property graph that will be exported into flat filesvertexFileName
- the name of the vertex flat file e.g. graph.opvedgeFileName
- the name of the edge flat file e.g. graph.opedop
- 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.lang.InterruptedException
java.io.IOException
java.io.FileNotFoundException
public static void exportVertexFlatFile(OraclePropertyGraph pg, java.io.OutputStream osVertex, int dop, boolean append, boolean closeStream) throws java.io.IOException, java.io.FileNotFoundException, java.lang.InterruptedException
pg
- the property graph that will be exported into flat filesosVertex
- an OutputStream
object for the vertex flat filedop
- the degree of parallelism used when writing the data into the flat file. This will use multiple threads to optimize writing performance.append
- if false, overwrite the existing flat file removing all existing data.closeStream
- whether to close the OutputStream or notjava.io.IOException
java.io.FileNotFoundException
java.lang.InterruptedException
public static java.util.List<java.lang.String> getGraphNames(org.apache.hadoop.conf.Configuration conf)
conf
- the Configuration object with all the HBase connection information.public static byte[][] getHexSplitsWithEndpoints(java.lang.String startKey, java.lang.String endKey, int numRegions)
startKey
- the start key of the splits as a byte array.endKey
- the end key of the splits as a byte array.numRegions
- the number of splits to define.public static void printByteArray(java.lang.String marker, byte[] ba, java.io.PrintStream ps)
marker
- an additional marker to be printed with the byte arrayba
- the byte array to be printedps
- a PrintStream
object where the byte array will be printedpublic static void quietlyCloseConnection(org.apache.hadoop.hbase.client.Connection connection)
Connection
object handling a connection to an Apache HBase Databaseconnection
- the Connection
to be closed.public static void quietlyCloseConnections(org.apache.hadoop.hbase.client.Connection[] connections)
Connection
objects handling connections to an Apache HBase Database.connections
- the array of Connection
to be closed.public static void renameGraph(org.apache.hadoop.conf.Configuration conf, java.lang.String graphName, java.lang.String newGraphName) throws java.io.IOException, java.lang.Exception
conf
- the Configuration object with all the HBase connection information.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 boolean sameSubArray(byte[] ba1, byte[] ba2, int iStart, int iLen)
ba1
- the first byte array to compareba2
- the second byte array to compareiStart
- the start of the sub-array to compareiLen
- the length of the sub-array to compare