15.12.10 PgxFrame-PgqlResultSet Conversions

You can perform conversions between PgxFrames and PgqlResultSets.

PgxFrame to PgqlResultSet

You can convert a PgxFrame to PgqlResultSet as follows:

Converting PgxFrame to PgqlResultSet Using JShell
opg4j> var resultSet = exampleFrame.toPgqlResultSet();
Converting PgxFrame to PgqlResultSet Using Java
PgqlResultSet resultSet = exampleFrame.toPgqlResultSet();
Converting PgxFrame to PgqlResultSet Using Python
result_set = example_frame.to_pgql_result_set()

You can view the content of the result set through the usual PgqlResultSet APIs.The output appears as follows:

+-------------------------------------------------------------------------------+
| name     | age | salary      | married | tax_rate | random    | date_of_birth |
+-------------------------------------------------------------------------------+
| John     | 27  | 4133300.0   | true    | 11.0     | 123456782 | 1985-10-18    |
| Albert   | 23  | 5813000.5   | false   | 12.0     | 124343142 | 2000-01-14    |
| Heather  | 28  | 1.0130302E7 | true    | 10.5     | 827520917 | 1985-10-18    |
| Emily    | 24  | 9380080.5   | false   | 13.0     | 128973221 | 1910-07-30    |
| "D'Juan" | 27  | 1582093.0   | true    | 11.0     | 92384     | 1955-12-01    |
+-------------------------------------------------------------------------------+

PgqlResultSet to PgxFrame

You can convert a PgqlResultSet to a PgxFrameas follows:

Converting a PgqlResultSet to a PgxFrameUsing JShell
opg4j> var query = ...;
opg4j> var graph = ...;
opg4j> var resultSet = graph.queryPgql(query);
opg4j> resultSet.toFrame();
Converting a PgqlResultSet to a PgxFrame Using Java
String query = ...;
PgxGraph graph = ...;
PgqlResultSet resultSet = graph.queryPgql(query);
resultSet.toFrame();