14.2.2.1 Loading Datetime Data
You must first load a graph to work with datetime data. See Loading a Graph Into the Graph Server (PGX) for more information on graph loading.
The following example shows how to load a graph that has three vertices representing persons and zero edges.
Example 14-1 Loading Datetime Data
-
Create an
EDGE_LIST
filepersons.edge_list
as shown:1*Judy,1989-01-15,1989-01-15 10:15-08:00 2*Klara,2001-01-29,2001-01-29 21:30-08:00 3*Pete,1995-08-01,1995-08-01 03:00-08:00
-
Create a corresponding graph configuration file
persons.edge_list.json
as shown:{ "format":"edge_list", "uri":"persons.edge_list", "vertex_id_type":"long", "vertex_props":[ { "name":"name", "type":"string" }, { "name":"date_of_birth", "type":"local_date" }, { "name":"timestamp_of_birth", "type":"timestamp_with_timezone", "format":["yyyy-MM-dd H[H]:m[m][:s[s]][XXX]"] } ], "edge_props":[ ], "separator":"," }
-
You can now load the data as shown in the following code:
opg4j> var graph = session.readGraphWithProperties("persons.edge_list.json", "people_graph")
import oracle.pgx.api.*;
...
PgxGraph graph = session.readGraphWithProperties("persons.edge_list.json","people_graph");
graph = session.read_graph_with_properties("persons.edge_list.json",graph_name="people_graph")
Parent topic: Using Datetime Data Types