NebulaGraph Java Client
release-3.8
|
The Session is an object that operates with nebula-graph. More...
Classes | |
interface | Setter |
Public Member Functions | |
Session (SyncConnection connection, AuthResult authResult, NebulaPool connPool, Boolean retryConnect) | |
Constructor. More... | |
synchronized ResultSet | execute (String stmt) throws IOErrorException |
Execute the nGql sentence. More... | |
synchronized ResultSet | executeWithParameter (String stmt, Map< String, Object > parameterMap) throws IOErrorException |
Execute the nGql sentence. More... | |
synchronized String | executeJson (String stmt) throws IOErrorException |
Execute the nGql sentence. More... | |
synchronized String | executeJsonWithParameter (String stmt, Map< String, Object > parameterMap) throws IOErrorException |
Execute the nGql sentence. More... | |
synchronized boolean | ping () |
Check current connection is ok. More... | |
synchronized boolean | pingSession () |
check current session is ok | |
synchronized void | release () |
Notifies the server that the session is no longer needed and returns the connection to the pool, and the connection will be reuse. More... | |
synchronized HostAddress | getGraphHost () |
Gets the service address of the current connection. More... | |
long | getSessionID () |
get SessionID | |
synchronized void | close () |
Static Public Member Functions | |
static Value | value2Nvalue (Object value) throws UnsupportedOperationException |
convert java value type to nebula thrift value type More... | |
Static Public Attributes | |
static Map< Class<?>, Setter > | LEAF_TYPE_AND_SETTER |
some value setter for java type (basic or nebula special type) that need convert to NValue More... | |
static Map< Class<?>, Setter > | COMPLEX_TYPE_AND_SETTER |
some value setter for java type (complex java type include collections or date) that need convert to NValue | |
The Session is an object that operates with nebula-graph.
It provides an interface execute
to send any NGQL. The returned data result ResultSet
include wrapped string encoding and time zone calculations and Node and Relationship and PathWrapper and DateWrapper and TimeWrapper and DateTimeWrapper. The data type obtained by the user is ValueWrapper
, which is the wrapper of the original data structure Value returned by the server. The user can directly read the data using the interface of ValueWrapper.
Definition at line 53 of file Session.java.
Session | ( | SyncConnection | connection, |
AuthResult | authResult, | ||
NebulaPool | connPool, | ||
Boolean | retryConnect | ||
) |
Constructor.
connection | the connection from the pool |
authResult | the auth result from graph service |
connPool | the connection pool |
retryConnect | whether to retry after the connection is disconnected |
Definition at line 73 of file Session.java.
synchronized ResultSet execute | ( | String | stmt | ) | throws IOErrorException |
Execute the nGql sentence.
stmt | The nGql sentence. such as insert ngql INSERT VERTEX person(name) VALUES "Tom":("Tom"); |
Definition at line 91 of file Session.java.
synchronized String executeJson | ( | String | stmt | ) | throws IOErrorException |
Execute the nGql sentence.
Date and Datetime will be returned in UTC JSON struct: { "results":[ { "columns":[], "data":[ { "row":row-data, "meta":metadata } ], "latencyInUs":0, "spaceName":"", "planDesc ":{ "planNodeDescs":[ { "name":"", "id":0, "outputVar":"", "description":{ "key":"" }, "profiles":[ { "rows":1, "execDurationInUs":0, "totalDurationInUs":0, "otherStats":{} } ], "branchInfo":{ "isDoBranch":false, "conditionNodeId":-1 }, "dependencies":[] } ], "nodeIndexMap":{}, "format":"", "optimize_time_in_us":0 }, "comment ":"", } ], "errors":[ { "code": 0, "message": "" } ] }
stmt | The nGql sentence. such as insert ngql INSERT VERTEX person(name) VALUES "Tom":("Tom"); parameterMap The nGql parameters |
Definition at line 211 of file Session.java.
synchronized String executeJsonWithParameter | ( | String | stmt, |
Map< String, Object > | parameterMap | ||
) | throws IOErrorException |
Execute the nGql sentence.
Date and Datetime will be returned in UTC JSON struct: { "results":[ { "columns":[], "data":[ { "row":row-data, "meta":metadata } ], "latencyInUs":0, "spaceName":"", "planDesc ":{ "planNodeDescs":[ { "name":"", "id":0, "outputVar":"", "description":{ "key":"" }, "profiles":[ { "rows":1, "execDurationInUs":0, "totalDurationInUs":0, "otherStats":{} } ], "branchInfo":{ "isDoBranch":false, "conditionNodeId":-1 }, "dependencies":[] } ], "nodeIndexMap":{}, "format":"", "optimize_time_in_us":0 }, "comment ":"", } ], "errors":[ { "code": 0, "message": "" } ] }
stmt | The nGql sentence. such as insert ngql INSERT VERTEX person(name) VALUES "Tom":("Tom"); parameterMap The nGql parameters |
Definition at line 276 of file Session.java.
synchronized ResultSet executeWithParameter | ( | String | stmt, |
Map< String, Object > | parameterMap | ||
) | throws IOErrorException |
Execute the nGql sentence.
stmt | The nGql sentence. such as insert ngql INSERT VERTEX person(name) VALUES "Tom":("Tom"); |
parameterMap | The nGql parameter map |
Definition at line 105 of file Session.java.
synchronized HostAddress getGraphHost | ( | ) |
Gets the service address of the current connection.
Definition at line 364 of file Session.java.
synchronized boolean ping | ( | ) |
synchronized void release | ( | ) |
Notifies the server that the session is no longer needed and returns the connection to the pool, and the connection will be reuse.
This function is called if the user is no longer using the session.
Definition at line 346 of file Session.java.
|
static |
convert java value type to nebula thrift value type
value | java obj |
Definition at line 434 of file Session.java.
|
static |
some value setter for java type (basic or nebula special type) that need convert to NValue
Definition at line 467 of file Session.java.