public abstract class OraclePropertyGraphUtilsBase extends OracleConvertersUtilsBase implements oracle.pg.common.messages.MesgConsts
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 |
---|
OraclePropertyGraphUtilsBase() |
Modifier and Type | Method and Description |
---|---|
static oracle.jdbc.OracleConnection |
castAsOracleConnection(java.sql.Connection connection)
Cast a java.sql.Connection object into an OracleConnection object
|
static boolean |
compareFiles(java.lang.String szSrcFile, java.lang.String szDstFile)
Compare the content of two files contents against each other.
|
static boolean |
compareValueObjects(java.lang.Object obj, java.lang.Object obj1)
Compares two value objects
|
static void |
exportEdgeFlatFile(OraclePropertyGraphBase 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 |
exportEdges(java.util.Iterator<org.apache.tinkerpop.gremlin.structure.Edge>[] itEdgeArray, java.io.OutputStream osEdge)
This function exports a given edges into the output stream using Oracle flat-file format.
|
static void |
exportFlatFiles(OraclePropertyGraphBase 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(OraclePropertyGraphBase 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(OraclePropertyGraphBase 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(OraclePropertyGraphBase 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 |
exportGraphML(OraclePropertyGraphBase opg, java.io.OutputStream os, java.io.PrintStream psOut)
Exports all vertices/edges from the specified property graph into the output stream in GraphGML format.
|
static void |
exportGraphML(OraclePropertyGraphBase opg, java.lang.String graphMLFileName, java.io.PrintStream psOut)
Exports all vertices/edges from the specified property graph into the specified file in GraphGML format.
|
static void |
exportGraphSON(OraclePropertyGraphBase opg, java.io.OutputStream os, java.io.PrintStream psOut)
Exports all vertices/edges from the specified property graph into the output stream in GraphSON format.
|
static void |
exportGraphSON(OraclePropertyGraphBase opg, java.lang.String graphSonFileName, java.io.PrintStream psOut)
Exports all vertices/edges from the specified property graph into the specified file in GraphSON format.
|
static void |
exportVertexFlatFile(OraclePropertyGraphBase 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 void |
exportVertices(java.util.Iterator<org.apache.tinkerpop.gremlin.structure.Vertex>[] itVertexArray, java.io.OutputStream osVertex)
This function exports a given vertices into the output stream using Oracle flat-file format.
|
static PropertyType |
getDatatypeAsPropertyType(java.lang.Class dtClass)
Gets the
PropertyType object based on the given datatype class. |
static java.util.Map<java.lang.String,java.lang.Class> |
getPropertiesFromFile(int dop, oracle.pg.common.loader.OracleFlatFileSplitterConfig config, java.lang.Object[] sources, boolean bVertex) |
static int |
getPropertyType(java.lang.Object objVa1) |
static java.lang.String |
getPropertyValueAsStr(java.lang.Object value) |
static java.io.InputStream |
handleGZipInputStream(java.io.InputStream in)
Handles a GZIP InputStream.
|
static void |
importGraphML(OraclePropertyGraphBase opg, java.io.InputStream is, java.io.PrintStream psOut)
Imports all vertices/edges from the input stream in GraphGML format into the specified property graph.
|
static void |
importGraphML(OraclePropertyGraphBase opg, java.lang.String graphMLFileName, java.io.PrintStream psOut)
Imports all vertices/edges from the specified file in GraphGML format into the specified property graph.
|
static void |
importGraphSON(OraclePropertyGraphBase opg, java.io.InputStream is, java.io.PrintStream psOut)
Imports all vertices/edges from the input stream in GraphSON format into the specified property graph.
|
static void |
importGraphSON(OraclePropertyGraphBase opg, java.lang.String graphSonFileName, java.io.PrintStream psOut)
Imports all vertices/edges from the specified file in GraphSON format into the specified property graph.
|
static boolean |
isDateValue(int propertyType) |
static boolean |
isNumericValue(int propertyType) |
static <E> java.util.List<E> |
listify(java.lang.Iterable<E> it)
Converts a given Iterable instance to a List object.
|
static void |
outputEdgeRecord(java.io.OutputStream os, java.lang.Long eid, java.lang.Long svid, java.lang.Long dvid, java.lang.String label, java.lang.String szPropertyKey, java.lang.Object value)
This method outputs a property (K/V) of an edge, identified by an integer ID, into the given output stream.
|
static void |
outputVertexRecord(java.io.OutputStream os, java.lang.Long vid, java.lang.String szPropertyKey, java.lang.Object value)
This method outputs a property (K/V) of a vertex, identified by an integer ID, into the given output stream.
|
static void |
outputVertexRecord(java.io.OutputStream os, java.lang.Long vid, java.lang.String szLabel, java.lang.String szPropertyKey, java.lang.Object value)
This method outputs a property (K/V) of a vertex, identified by an integer ID, into the given output stream.
|
static void |
prepareConfigEdgePropertiesFromOPVFile(java.lang.Object[] oaEdgeSources, AbstractPgGraphConfigBuilder config, int dop, oracle.pg.common.loader.OracleFlatFileSplitterConfig ofsconfig)
Updates an existing
AbstractPgGraphConfigBuilder with all the vertex properties obtained from the given set of OPV flat files. |
static void |
prepareConfigVertexPropertiesFromOPVFile(java.lang.Object[] oaVertexSources, AbstractPgGraphConfigBuilder config, int dop, oracle.pg.common.loader.OracleFlatFileSplitterConfig ofsconfig)
Updates an existing
AbstractPgGraphConfigBuilder with all the vertex properties obtained from the given set of OPV flat files. |
static void |
quietlyClose(java.io.BufferedReader br)
Quietly closes the specified BufferedReader.
|
static void |
quietlyClose(java.io.InputStream is)
Quietly closes the specified
InputStream . |
static void |
quietlyClose(java.io.InputStream[] isa)
Quietly closes the specified array of
InputStream . |
static void |
quietlyClose(java.io.OutputStream os)
Quietly closes the specified
OutputStream . |
static void |
quietlyClose(java.io.OutputStream[] osa)
Quietly closes the specified array of
OutputStream . |
static void |
quietlyCloseResultSet(java.sql.ResultSet rs)
Closes (in a best effort fashion) the provided result set.
|
static void |
quietlyCloseResultSetAndStmt(java.sql.ResultSet rs)
Closes (in a best effort fashion) the provided result set and its corresponding statement.
|
static void |
quietlyCloseResultSetAndStmt(java.sql.ResultSet rs, java.sql.Statement stmt)
Closes (in a best effort fashion) the provided result set and its corresponding statement.
|
static void |
quietlyCloseStmt(java.sql.Statement stmt)
Closes (in a best effort fashion) the provided statement.
|
static void |
quietlyShutdown(OraclePropertyGraphBase opg)
Quietly shutdown a property graph.
|
static void |
saveInputStreamIntoFile(java.io.InputStream is, java.lang.String fileName)
Saves the content of the given input stream into a temporary file
|
static <E> long |
size(java.lang.Iterable<E> it)
Returns the number of elements in the given Iterable object.
|
static <E> long |
size(java.util.Iterator<E> it)
Returns the number of elements in the given Iterable object.
|
static java.lang.String |
unescape(java.lang.String s)
Unescapes a string from Oracle flat file format into a regular string.
|
static void |
validateSources(java.lang.Object[] oaSources, java.lang.String element) |
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 oracle.jdbc.OracleConnection castAsOracleConnection(java.sql.Connection connection) throws java.sql.SQLException
java.sql.SQLException
public static final boolean compareFiles(java.lang.String szSrcFile, java.lang.String szDstFile) throws java.io.IOException
szSrcFile
- the name of the first file to compareszDstFile
- the name of the second file to comparejava.io.IOException
public static boolean compareValueObjects(java.lang.Object obj, java.lang.Object obj1)
public static void exportEdgeFlatFile(OraclePropertyGraphBase pg, java.io.OutputStream osEdge, int dop, boolean append, boolean closeStream) throws java.io.IOException, java.io.FileNotFoundException
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
public static void exportEdges(java.util.Iterator<org.apache.tinkerpop.gremlin.structure.Edge>[] itEdgeArray, java.io.OutputStream osEdge) throws java.io.IOException, java.io.FileNotFoundException
itEdgeArray
- an array of edges iteratorsosEdge
- an OutputStream
object for the edge flat filejava.io.IOException
java.io.FileNotFoundException
public static final void exportFlatFiles(OraclePropertyGraphBase 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(OraclePropertyGraphBase 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 final void exportFlatFiles(OraclePropertyGraphBase pg, java.lang.String vertexFileName, java.lang.String edgeFileName, boolean append) throws java.io.IOException, java.io.FileNotFoundException
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.io.IOException
java.io.FileNotFoundException
public static final void exportFlatFiles(OraclePropertyGraphBase pg, java.lang.String vertexFileName, java.lang.String edgeFileName, int dop, boolean append) throws java.io.IOException, java.io.FileNotFoundException
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.io.IOException
java.io.FileNotFoundException
public static final void exportGraphML(OraclePropertyGraphBase opg, java.io.OutputStream os, java.io.PrintStream psOut) throws java.io.IOException
opg
- the property graph to be exported.os
- the OutputStream
where the property graph data will be exportedpsOut
- the PrintStream used to show the progress of the processjava.io.IOException
public static final void exportGraphML(OraclePropertyGraphBase opg, java.lang.String graphMLFileName, java.io.PrintStream psOut) throws java.io.IOException
opg
- the property graph to be exported.graphMLFileName
- the name of the file where the data should be writtenpsOut
- the PrintStream used to show the progress of the processjava.io.IOException
public static final void exportGraphSON(OraclePropertyGraphBase opg, java.io.OutputStream os, java.io.PrintStream psOut) throws java.io.IOException
opg
- the property graph to be exported.os
- the OutputStream
where the property graph data will be exportedpsOut
- the PrintStream used to show the progress of the processjava.io.IOException
public static final void exportGraphSON(OraclePropertyGraphBase opg, java.lang.String graphSonFileName, java.io.PrintStream psOut) throws java.io.IOException
opg
- the property graph to be exported.graphSonFileName
- the name of the file where the data should be writtenpsOut
- the PrintStream used to show the progress of the processjava.io.IOException
public static void exportVertexFlatFile(OraclePropertyGraphBase pg, java.io.OutputStream osVertex, int dop, boolean append, boolean closeStream) 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 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
public static void exportVertices(java.util.Iterator<org.apache.tinkerpop.gremlin.structure.Vertex>[] itVertexArray, java.io.OutputStream osVertex) throws java.io.IOException, java.io.FileNotFoundException
itVertexArray
- an array of vertices iteratorsosVertex
- an OutputStream
object for the vertex flat filejava.io.IOException
java.io.FileNotFoundException
public static PropertyType getDatatypeAsPropertyType(java.lang.Class dtClass)
PropertyType
object based on the given datatype class. For unsupported Property Graph data types in PGX such as Serializable, SimpleRdfDataWrapper, SimpleSpatialDataWrapper, SimpleJsonDataWrapper a String Property Type will be used.dtClass
- the class of the datatypePropertyType
object.public static java.util.Map<java.lang.String,java.lang.Class> getPropertiesFromFile(int dop, oracle.pg.common.loader.OracleFlatFileSplitterConfig config, java.lang.Object[] sources, boolean bVertex) throws java.util.concurrent.ExecutionException, java.io.IOException, java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.io.IOException
java.lang.InterruptedException
public static int getPropertyType(java.lang.Object objVa1)
public static java.lang.String getPropertyValueAsStr(java.lang.Object value) throws java.io.IOException
java.io.IOException
public static final java.io.InputStream handleGZipInputStream(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public static final void importGraphML(OraclePropertyGraphBase opg, java.io.InputStream is, java.io.PrintStream psOut) throws java.io.IOException
opg
- the property graph to be imported.is
- the InputStream
where the property graph data will be importedpsOut
- the PrintStream used to show the progress of the processjava.io.IOException
public static final void importGraphML(OraclePropertyGraphBase opg, java.lang.String graphMLFileName, java.io.PrintStream psOut) throws java.io.IOException
opg
- the property graph to be imported.graphMLFileName
- the file name where the property graph data will be importedpsOut
- the PrintStream used to show the progress of the processjava.io.IOException
public static final void importGraphSON(OraclePropertyGraphBase opg, java.io.InputStream is, java.io.PrintStream psOut) throws java.io.IOException
opg
- the property graph to be imported.is
- the InputStream
where the property graph data will be importedpsOut
- the PrintStream used to show the progress of the processjava.io.IOException
public static final void importGraphSON(OraclePropertyGraphBase opg, java.lang.String graphSonFileName, java.io.PrintStream psOut) throws java.io.IOException
opg
- the property graph to be imported.graphSonFileName
- the file name where the property graph data will be importedpsOut
- the PrintStream used to show the progress of the processjava.io.IOException
public static boolean isDateValue(int propertyType)
public static boolean isNumericValue(int propertyType)
public static final <E> java.util.List<E> listify(java.lang.Iterable<E> it)
it
- an Iterable instance. It can be NULL.public static void outputEdgeRecord(java.io.OutputStream os, java.lang.Long eid, java.lang.Long svid, java.lang.Long dvid, java.lang.String label, java.lang.String szPropertyKey, java.lang.Object value) throws java.io.IOException
os
- output streameid
- long integer ID of an edgesvid
- source vertex IDdvid
- destination vertex IDlabel
- edge labelszPropertyKey
- key of a propertyvalue
- value of a propertyjava.io.IOException
public static void outputVertexRecord(java.io.OutputStream os, java.lang.Long vid, java.lang.String szPropertyKey, java.lang.Object value) throws java.io.IOException
os
- output streamvid
- long integer ID of a vertexszPropertyKey
- key of a propertyvalue
- value of a propertyjava.io.IOException
public static void outputVertexRecord(java.io.OutputStream os, java.lang.Long vid, java.lang.String szLabel, java.lang.String szPropertyKey, java.lang.Object value) throws java.io.IOException
os
- output streamvid
- long integer ID of a vertexszPropertyKey
- key of a propertyvalue
- value of a propertyjava.io.IOException
public static void prepareConfigEdgePropertiesFromOPVFile(java.lang.Object[] oaEdgeSources, AbstractPgGraphConfigBuilder config, int dop, oracle.pg.common.loader.OracleFlatFileSplitterConfig ofsconfig)
AbstractPgGraphConfigBuilder
with all the vertex properties obtained from the given set of OPV flat files.public static void prepareConfigVertexPropertiesFromOPVFile(java.lang.Object[] oaVertexSources, AbstractPgGraphConfigBuilder config, int dop, oracle.pg.common.loader.OracleFlatFileSplitterConfig ofsconfig)
AbstractPgGraphConfigBuilder
with all the vertex properties obtained from the given set of OPV flat files.public static void quietlyClose(java.io.BufferedReader br)
br
- the BufferedReader to close.public static final void quietlyClose(java.io.InputStream is)
InputStream
.is
- the InputStream
to close.public static final void quietlyClose(java.io.InputStream[] isa)
InputStream
.isa
- the array of InputStream
to close.public static final void quietlyClose(java.io.OutputStream os)
OutputStream
.os
- the OutputStream
to close.public static final void quietlyClose(java.io.OutputStream[] osa)
OutputStream
.osa
- the array of OutputStream
to close.public static void quietlyCloseResultSet(java.sql.ResultSet rs)
public static void quietlyCloseResultSetAndStmt(java.sql.ResultSet rs)
public static void quietlyCloseResultSetAndStmt(java.sql.ResultSet rs, java.sql.Statement stmt)
public static void quietlyCloseStmt(java.sql.Statement stmt)
public static final void quietlyShutdown(OraclePropertyGraphBase opg)
opg
- the property graph to be shutdown.public static final void saveInputStreamIntoFile(java.io.InputStream is, java.lang.String fileName) throws java.io.IOException
is
- an InputStream
objectfileName
- the file name where the input stream will be savedjava.io.IOException
public static final <E> long size(java.lang.Iterable<E> it)
public static final <E> long size(java.util.Iterator<E> it)
public static final java.lang.String unescape(java.lang.String s)
s
- the string to be unescaped.public static void validateSources(java.lang.Object[] oaSources, java.lang.String element)