gStore provides API services to users through http and Socket services, and its components are gRPC, ghttp and gServer.
We now provide C++, Java, Python, PHP, and Node.js APIs for gRPC and ghttp. Please refer to the examples in api/http/cpp
, api/http/java
, api/http/python
, api/http/php
and api/http/nodejs
. To use these examples, make sure you have generated the executable files of gRPC or ghttp. Next, please use the bin/grpc
or bin/ghttp
command to start the service. If you know of a running gRPC or ghttp server that's available for connection, you can also directly connect to it. Then, for the C++ and Java code, you need to compile the sample code in the directory api/http/cpp/example
orapi/http/java/example
.
The gStore HTTP API is placed in the API/HTTP directory of the gStore root directory and contains the following:
- gStore/api/http/
- cpp/ (the C++ API)
- example/ (Example program using the C++ API)
- Benchmark.cpp
- GET-example.cpp
- POST-example.cpp
- Transaction-example.cpp
- Makefile (for compiling the sample code)
- src/
- GstoreConnector.cpp (C++ API's source code)
- GstoreConnector.h
- Makefile (for compiling the lib)
- example/ (Example program using the C++ API)
- java/ (the Java API)
- example/ (Example program using the Java API)
- Benckmark.java
- GETexample.java
- POSTexample.java
- Makefile
- src/
- jgsc/
- GstoreConnector.java (Java API's source code)
- Makefile
- jgsc/
- example/ (Example program using the Java API)
- python/ (the Python API)
- example/ (Example program using the Python API)
- Benchmark.py
- GET-example.py
- POST-example.py
- src/
- GstoreConnector.py
- example/ (Example program using the Python API)
- nodejs/ (the Node.js API)
- example/ (Example program using the Node.js API)
- POST-example.js
- GET-example.js
- src
- GstoreConnector.js (Node.js API's source code)
- LICENSE
- package.json
- example/ (Example program using the Node.js API)
- php/ (the PHP API)
- example/ (Example program using the PHP API)
- Benchmark.php
- POST-example.php
- GET-example.php
- src/
- GstoreConnector.php (the PHP API's source code)
- example/ (Example program using the PHP API)
- cpp/ (the C++ API)
For details on how to start and shut down gRPC or ghttp, please see [development documentation] - [Quick Start] - [HTTP API service].
After the API service is started, the gRPC access address is as follows:
http://serverip:port/grpc/
The ghttp access address is as follows:
http://serverip:port/
ServerIP
is the IP address of the gStore server, and port
is the port on which gRPC or ghttp is started.
We now provide C++ (Java, Python, PHP, and Node.js will be supported in future versions) API for gServer, the socket API service. Please see api/socket/cpp for the example code. To use these examples, make sure you have generated an executable file for gServer. Next, use the bin/gserver -s
command to start the gserver service. If you know of a running gServer that's available for connection, you can also directly connect to it. Then, for the C++ code, you need to compile the sample code in the directory api/socket/cpp/example
.
For details on how to start and shut down gServer, please see [development documentation] - [Quick Start] - [Socket API service].
After the Socket API is started, you can connect through the Socket. The default port of gServer is 9000.
gStore的Socket API放在gStore根目录的API/Socket目录中,其内容如下: The gStore Socket API is placed in the API/Socket directory of the gStore root directory and contains the following:
-
gStore/api/socket/
-
cpp/ (the C++ API)
- example/ (Example program using the C++ API)
- CppAPIExample.cpp
- Makefile ((for compiling the sample code)
- src/
- Client.cpp (C++ API's source code)
- Client.h
- Makefile (for compiling the lib)
- example/ (Example program using the C++ API)
-
The ghttp interface adopts the
HTTP
protocol and supports multiple ways to access the interface. If the ghttp is started on the port9000
, the interface interconnection content is as follows API address:http://ip:9000/
The interface supports both
GET
andPOST
requests, whereGET
requests place > > parameters in the URL andPOST
requests place parameters in thebody
request.Note:
GET
request parameters contain special characters, such as? , @,& and other characters, you need to use urlencode encoding, especially theSPARQL
parameter must be encoded
The grpc interface adopts the HTTP protocol and supports multiple ways to access the interface. If the grpc is started on the port 9000, the interface connection information is as follows.
API address:
http://ip:9000/grpc
The interface supports both
GET
andPOST
requests, whereGET
requests place parameters in the URL andPOST
requests place parameters in thebody
request or useform
to express a request.Post request method 1 (recommended) : the parameter is passed as
JSON
structure byraw
inbody
inhttprequest
(Requires RequestHeader's parameter Content-Type to be application/json)Post request method 2: the parameter is passed as a form (Requires RequestHeader's parameter Content-Type to be application/x-www-form-urlencoded)
Note: If the
GET
request parameters contain special characters, such as? , @, and &, you need to use the urlencode encoding, especially for theSPARQL
parameter.
The red font represents the latest version additions, while the blue font represents the latest version modifications
API name | Definition | Note |
---|---|---|
Interface of system | ||
check | heartbeat signal | Detect ghttp heartbeat signal |
login | login to database | It is used to authenticate user names and passwords |
testConnect | testing connectivity | Used to check whether GHTTP is connected |
getCoreVersion | get gStore version | Get the gStore version number |
ipmanage | black/white list management | Maintains a blacklist and whitelist of IP addresses that access gStore |
upload | upload files | support file types to upload are nt, ttl, n3, rdf, txt. |
download | download files | support to download files in gstore main directory and its sub directories. |
stat | query system resources | statistics CPU, memory, disk available space information. |
shutdown | close ghttp | |
Interface of system operations | ||
show | display graph database | Display a list of all databases |
load | load graph database | Load the database into memory |
unload | unload graph database | Unload the database from memory |
monitor | monitor graph database | Count information about the specified database (such as the number of triples, etc.) |
build(update) | build graph database | The database file must be locally stored on the server |
drop | drop graph database | Logical deletion and physical deletion can be performed |
backup(update) | backup database | backup database information |
backuppath | get the backup database path | Returns a list of all backup files in the default backup path. |
restore(update) | restore database | restore database information |
query | query database | Including query, delete, and insert |
export | export database | Export database as NT file |
batchInsert(update) | batch insert data | Batch insert NT data |
batchRemove(update) | batch delete data | Batch delete NT data |
rename | rename graph database | modify graph database name. |
checkOperationState(new) | Query asynchronous operation status | Query the asynchronous execution status of build, backup, restore, batch_insert, batch_remove |
Interface of database transaction | ||
begin | Start transaction | Transaction starts and needs to be used in conjunction with TQuery |
tquery | Querying the database (with transactions) | Data queries with transaction mode (insert and DELETE only) |
commit | commit transactions | Commit the transaction after it completes |
rollback | rollback transaction | Roll back the transaction to begin state |
checkpoint | write data to a disk | After an INSERT or delete operation is performed on the database, manually checkpoint is required |
Interface of user management | ||
showuser | display all user list | Display a list of all users |
usermanage | user management | Add, delete, or modify user information |
userprivilegemanage | user privilege management | Add, delete, or modify user's privilege information |
userpassword | modify user's password | modify user's password |
Interface of custom function | ||
funquery | Query operator function | Gets a list of user-defined graph analysis functions |
funcudb | Manage operator function | Adds, modifies, deletes, or compiles operator function |
funreview | Preview operator function | View the latest generated graph analysis function source code |
Interface of log | ||
txnlog | Obtain transaction log information | Returns transcation log information as JSON |
querylogdate | Gets the date list of query logs | Returns the date list of existing query logs |
querylog | Get query log information | Returns query log information as JSON |
accesslogdate | Get the date of the API log | Returns the date list of existing API logs |
accesslog | Get API access logs | Returns API access log information as JSON |
Interface of reason engine(new) | ||
addReason | add reason | |
listReason | list reason | |
compileReason | compile reason | |
executeReason | execute reason | |
disableReason | disable reason | |
showReason | show reason | |
removeReason | remove reason |
The input and output parameters of each interface are specified in this section. Assume that the IP address of the GHTTP server is 127.0.0.1 and the port is 9000 Interfaces of system
Brief description
- Detect ghttp heartbeat signal
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is check |
Return value
Parameter name | Tpye | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "the ghttp server is running..."
}
Brief description
- User login (verify username and password)
- Updates in this version: the full path information of RootPath will be returned after successful login
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inhttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is login |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
CoreVersion | string | Kernel version |
licensetype | string | Certificate type (Open Source or Enterprise) |
RootPath | string | Full path to the gStore root directory |
type | string | HTTP service type |
Return sample
{
"StatusCode": 0,
"StatusMsg": "login successfully",
"CoreVersion": "1.0.0",
"licensetype": "opensource",
"Rootpath": "/data/gstore",
"type": "ghttp"
}
Brief description
- Test whether the server can connect (for Workbench)
- Updates in this version: added HTTP service type in the return value
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inhttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is testConnect |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
CoreVersion | string | Kernel version |
licensetype | string | Certificate type (Open Source or Enterprise) |
type | string | HTTP service type (fixed as ghttp) |
Return sample
{
"StatusCode": 0,
"StatusMsg": "success",
"CoreVersion": "1.0.0",
"licensetype": "opensource",
"type": "ghttp"
}
Brief description
- Get the server version number (for Workbench)
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inhttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is getCoreVersion |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
CoreVersion | string | Kernel version |
type | string | HTTP service type (fixed as ghttp) |
Return sample
{
"StatusCode": 0,
"StatusMsg": "success",
"CoreVersion": "1.0.0",
"type": "ghttp"
}
Brief description
- Blacklist and whitelist management
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Querying the blacklist and whitelist:
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is ipmanage |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
type | yes | string | Operation type, fixed value is 1 |
Saving the blacklist and whitelist:
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is ipmanage |
username | yes | string | user name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
type | yes | string | Operation type, fixed value is 2 |
ip_type | yes | string | List type, 1-Blacklist 2-Whitelist |
ips | yes | string | IP List (Multiple separated by , supporting range configuration, using - connections such as ip1-ip2) |
//Post example
{
"operation": "ipmanage",
"username": "root",
"password": "123456",
"type": "2",
"ip_type":"1",
"ips": "192.168.1.111,192.168.1.120-192.168.1.129"
}
Return value
Parameter | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
ResponseBody | Object | Return data (only for queries) |
ip_type | string | List type, 1-Blacklist 2-Whitelist |
ips | array | IP List |
Return sample
//result of querying the black list and white list
{
"StatusCode": 0,
"StatusMsg": "success",
"ResponseBody": {
"ip_type": "1",
"ips": [
"192.168.1.111",
"192.168.1.120-192.168.1.129"
]
}
}
// result of saving the black list and white list
{
"StatusCode": 0,
"StatusMsg": "success"
}
Brief Description
- Uploading files. Currently supported file formats include nt, ttl, and txt
Request URL
- ghttp service:
http://127.0.0.1:9000/file/upload
(note that the address has changed) - grpc service:
http://127.0.0.1:9000/grpc/file/upload
(note that the address has changed)
Request method
- POST
Parameter Transfer Methods
- POST request,
form-data
in thebody
ofhttprequest
(requires the RequestHeader parameter Content-Type: multipart/form-data
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
username | Yes | string | Username |
password | Yes | string | Password (clear text) |
encryption | No | string | If it is empty, the password is clear text. If it is 1, it means md5 encryption is used |
file | Yes | boudary | Binary file stream of the file to be uploaded |
Return Value
Parameter name | Type | Description |
---|---|---|
StatusCode | int | Return value code value (please refer to the attached table: Return Value Code Table) |
StatusMsg | string | Returns specific information |
filepath | string | The relative path address returned after successful upload |
Return Sample:
{
"StatusCode": 0,
"StatusMsg": "success",
"filepath": "./upload/test_20221101164622.nt"
}
Brief Description
- Download files, currently supports downloading files from the gStore root directory.
Request URL
- ghttp service:
http://127.0.0.1:9000/file/download
(Note that the address has changed) - grpc service:
http://127.0.0.1:9000/grpc/file/upload
(Note that the address has changed)
Request method
- POST
Parameter Transfer Method
- POST request: the parameters are passed in the form of Form data (requires the RequestHeader parameter Content-Type: application/x-www-form-urlencoded)
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
username | Yes | string | Username (the default username is system) |
password | Yes | string | Password (clear text) |
encryption | No | string | If it is empty, the password is clear text. If it is 1, it means md5 encryption is used |
filepath | Yes | string | The path of the file to be downloaded (only supports downloading files from the main directory and subdirectories of gstore) |
Return Value
- Binary stream response
Return Sample:
Content-Range: bytes 0-389/389
Content-Type: application/octet-stream
Date: Tue, 01 Nov 2022 17:21:40 GMT
Content-Length: 389
Connection: Keep-Alive
Brief Description
- Statistics on system resource information
Request URL
- ghttp service:
http://127.0.0.1:9000/ghttp/api
- grpc service:
http://127.0.0.1:9000/grpc/api
Request method
- GET/POST
Parameter Transfer Method
- GET request, the parameters are passed directly as the URL
- POST request: the parameters are passed in the form of Form data (requires the RequestHeader parameter Content-Type: application/x-www-form-urlencoded)
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
operation | yes | string | Operation name, fixed value is stat |
username | Yes | string | Username (the default username is system) |
password | Yes | string | Password (plain text) |
encryption | No | string | If it is empty, the password is clear text. If it is 1, it means md5 encryption is used |
Return Value
Parameter name | Type | Description |
---|---|---|
StatusCode | int | Return value code value (please refer to the attached table: Return Value Code Table) |
StatusMsg | string | Returns specific information |
cup-usage | string | CPU usage ratio |
mem_usage | string | Memory usage (in MB) |
disk_available | string | Available disk space (in MB) |
Return Sample:
{
"StatusCode": 0,
"StatusMsg": "success",
"cpu_usage": "10.596026",
"mem_usage": "2681.507812",
"disk_available": "12270"
}
Brief description
- close ghttp
Request URL
-
ghttp service:
http://127.0.0.1:9000/shutdown
(Note that the address has changed) -
grpc service:
http://127.0.0.1:9000/grpc/shutdown
(Note that the address has changed) Request mode -
GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
username | yes | string | user name(default user name is system) |
password | yes | string | Password(This password need to be viewed in the server's system.db/password[port].txt file) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Server stopped successfully."
}
Brief description
- Display all database list
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is show |
username | yes | string | user name |
password | yes | string | Password (plain text) |
encryption | No | string | If it is empty, the password is clear text. If it is 1, it means it is encrypted with md5. |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
ResponseBody | JSONArray | JSON arrays (each of which is a database information) |
database | string | database name |
creator | string | creator |
built_time | string | create time |
status | string | database status |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Get the database list successfully!",
"ResponseBody": [
{
"database": "lubm",
"creator": "root",
"built_time": "2021-08-22 11:08:57",
"status": "loaded"
},
{
"database": "movie",
"creator": "root",
"built_time": "2021-08-27 20:56:56",
"status": "unloaded"
}
]
}
Brief description
- Loading a database into memory is a prerequisite for many operations, such as query and monitor.
Request mode
- GET/POST
Parameter transfer mode
- GET request: the parameters are passed directly as the URL
- POST request:
raw
inbody
inhttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is load |
username | yes | string | User name |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
password | yes | string | Password (plain text) |
db_name | yes | string | Database name (.db is not required) |
csr | no | string | Whether to load CSR resources, default is 0 (set to 1 when using advanced query functions) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
csr | string | Whether to load CSR resources |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Database loaded successfully.",
"csr": "1"
}
Brief description
- Unload the database from memory (all changes are flushed back to hard disk)
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is unload |
db_name | yes | string | Database name (.db is not required) |
username | yes | string | user name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Database unloaded."
}
Brief description
- Get database statistics (database needs to be loaded)
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is monitor |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
db_name | yes | string | Database name (.db is not required) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
database | string | database name |
creator | string | creator |
builtTime | string | create time |
tripleNum | string | number of triples |
entityNum | int | number of entities |
literalNum | int | number of characters (attribute value) |
subjectNum | int | number of subjects |
predicateNum | int | number of objects |
connectionNum | int | number of connections |
diskUsed | int | disk space(MB) |
subjectList | Array | Entity type statistics |
Return sample
{
"StatusCode": 0,
"StatusMsg": "success",
"database": "test_lubm",
"creator": "root",
"builtTime": "2021-08-27 21:29:46",
"tripleNum": "99550",
"entityNum": 28413,
"literalNum": 0,
"subjectNum": 14569,
"predicateNum": 17,
"connectionNum": 0,
"diskUsed": 3024,
"subjectList": [
{
"name": "ub:Lecturer",
"value": 93
},
{
"name": "ub:AssistantProfessor",
"value": 146
},
{
"name": "ub:University",
"value": 1
}
]
}
Brief description
- Create a database based on existing NT files, or build an empty library (supported in version 1.2)
- The file must exist on the gStore server
- You can first upload data files to the gStore server through the upload interface
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inhttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is build |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
db_name | yes | string | database name(no need .db) |
db_path | no | string | Database file path, supported file types are (can be absolute path or relative path, relative path is referenced from gStore installation root directory) |
async | no | string | If async is "true", immediately return the query opd_id, the server's asynchronous processing logic, and the client can call the checkOperationState interface through opd_id to view the operation status information |
callback | no | string | Callback interface, for example: http://127.0.0.1:8080/callback |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
failed_num | int | Number of failed constructions |
opt_id | string | Return the operation opd_id, the client can call the checkOperationState interface through opd_id to view the operation status information |
Return sample(defult)
{
"StatusCode": 0,
"StatusMsg": "Import RDF file to database done.",
"failed_num": 0,
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Return sample(async="true")
{
"StatusCode": 0,
"StatusMsg": "Operation Success.",
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Return sample(callback="http://127.0.0.1:8080/callback")
#push data to callback address
{
"operation": "build",
"StatusCode": 0,
"StatusMsg": "Import RDF file to database done.",
"failed_num": 0,
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Brief description
- Delete the database (either logically or physically)
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is drop |
db_name | yes | string | Database name (.db is not required) |
username | yes | string | user name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
is_backup | no | string | True: Logical deletion, false: represents physical deletion (default true),if it's logical deletion, change the file folder to .bak file foder, user can change the folder name to. db and add the folder to the system database by calling bin/ ginit-db database name |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Database test_lubm dropped."
}
Brief description
- Back up database
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is backup |
username | yes | string | user name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
db_name | yes | string | database that need operaions |
backup_path | no | string | The backup file path can be relative or absolute. The relative path uses the gStore root directory as reference. The default path is the backup directory in the gStore root directory |
async | no | string | If async is "true", immediately return the query opd_id, the server's asynchronous processing logic, and the client can call the checkOperationState interface through opd_id to view the operation status information |
callback | no | string | Callback interface, for example: http://127.0.0.1:8080/callback |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
backupfilepath | string | Backup file path (this value can be used as the input parameter value for restore) |
opt_id | string | Return the operation opd_id, the client can call the checkOperationState interface through opd_id to view the operation status information |
Return sample (defult)
{
"StatusCode": 0,
"StatusMsg": "Database backup successfully.",
"backupfilepath": "./backups/lubm.db_210828211529",
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Return sample (async="true")
{
"StatusCode": 0,
"StatusMsg": "Operation Success.",
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Return sample (callback="http://127.0.0.1:8080/callback")
{
"operation": "backup",
"StatusCode": 0,
"StatusMsg": "Database backup successfully.",
"backupfilepath": "./backups/lubm.db_210828211529",
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Brief description
- Obtain all backup files of the database located under the default backup path.
Request Methods
- GET/POST
Parameter Passing Methods
- For GET requests, parameters are passed directly in the URL.
- For POST requests, the
raw
field in thebody
of thehttprequest
is passed in JSON structure.
Parameters
Parameter Name | Required | Type | Description |
---|---|---|---|
operation | Yes | string | Operation name, fixed value is backuppath |
username | Yes | string | Username |
password | Yes | string | Password (plaintext) |
encryption | No | string | If it is empty, the password is plaintext. If it is 1, it means encryption with MD5 |
db_name | Yes | string | Database name that needs to be queried |
Return Values
Parameter Name | Type | Description |
---|---|---|
StatusCode | integer | Return value code (please refer to the attached table for specific values). |
StatusMsg | string | Specific return information. |
paths | Array | Backup file paths (this value can be used as input for restore operation). |
Return sample
{
"StatusCode": 0,
"StatusMsg": "success",
"paths": [
"./backups/lubm.db_220828211529",
"./backups/lubm.db_221031094522"
]
}
Brief description
- Restore database
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is restore |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If it is empty, the password is plaintext. If it is 1, it means encryption with MD5. |
db_name | yes | string | Database that need operations |
backup_path | no | string | The full time-stamped path of the backup file (can be a relative path or an absolute path. The relative path is based on the gStore root directory). The default path is the backup directory in the gStore root directory |
async | no | string | If async is "true", immediately return the query opd_id, the server's asynchronous processing logic, and the client can call the checkOperationState interface through opd_id to view the operation status information |
callback | no | string | Callback interface, for example: http://127.0.0.1:8080/callback |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
opt_id | string | Return the operation opd_id, the client can call the checkOperationState interface through opd_id to view the operation status information |
Return sample (defult)
{
"StatusCode": 0,
"StatusMsg": "Database lumb restore successfully.",
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Return sample (async="true")
{
"StatusCode": 0,
"StatusMsg": "Operation Success.",
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Return sample (callback=“http://127.0.0.1:8080/callback")
{
"StatusCode": 0,
"StatusMsg": "Database lumb restore successfully.",
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Brief description
- query the database
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is query |
username | yes | string | user name |
password | yes | string | Password (plain text) |
encryption | no | string | If it is empty, the password is plaintext. If it is 1, it means encryption with MD5. |
db_name | yes | string | database that need operations |
format | no | string | The result set returns in json, HTML, and file format. The default is JSOn |
sparql | yes | string | Sparql statement to execute (SPARQL requires URL encoding if it is a GET request) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
head | object | Head information |
link | array | |
vars | array | |
results | object | Result information (please refer to the return example for details) |
bindings | array | |
AnsNum | int | Number of results |
OutputLimit | int | Maximum number of return results (-1 for no limit) |
ThreadId | string | Query thread ID |
QueryTime | string | Query time (milliseconds) |
Return sample
{
"head": {
"link": [],
"vars": [
"x"
]
},
"results": {
"bindings": [
{
"x": {
"type": "uri",
"value": "House of Flying Daggers"
}
},
{
"x": {
"type": "uri",
"value": "Blood Brothers"
}
},
{
"x": {
"type": "uri",
"value": "flower"
}
}
]
},
"StatusCode": 0,
"StatusMsg": "success",
"AnsNum": 15,
"OutputLimit": -1,
"ThreadId": "140595527862016",
"QueryTime": "1"
}
Brief description
- export database
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is restore |
username | yes | string | user name |
password | yes | string | Password (plain text) |
encryption | no | string | If it is empty, the password is plaintext. If it is 1, it means encryption with MD5. |
db_name | yes | string | database that need operations |
db_path | no | string | Export path (gstore root by default) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
filepath | string | Path for exporting files |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Export the database successfully.",
"filepath": "export/lubm_210828214603.nt"
}
Brief description
- batch insert data
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is batchInsert |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If it is empty, the password is plaintext. If it is 1, it means encryption with MD5. |
db_name | yes | string | Database name |
file | no | string | The data to be inserted in the nt file or zip package (which can be a relative path or an absolute path) cannot be empty at the same time as the dir parameter. When both have values, take the file parameter |
dir | no | string | The data to be inserted into the nt folder (which can be a relative path or an absolute path) cannot be empty at the same time as the file parameter. When both have values, take the file parameter |
async | no | string | If async is "true", immediately return the query opd_id, the server's asynchronous processing logic, and the client can call the checkOperationState interface through opd_id to view the operation status information |
callback | no | string | Callback interface, for example: http://127.0.0.1:8080/callback |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
success_num | string | Number of successful executions |
failed_num | srting | Number of failed executions |
opt_id | string | Return the operation opd_id, the client can call the checkOperationState interface through opd_id to view the operation status information |
Return Sample (defult)
{
"StatusCode": 0,
"StatusMsg": "Batch insert data successfully.",
"success_num": 25,
"failed_num": 0,
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Return Sample (async=“true”)
{
"StatusCode": 0,
"StatusMsg": "Operation Success.",
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Return Sample (callback=“http://127.0.0.1:8080/callback”)
#push data to callback address
{
"operation": "batchInsert",
"StatusCode": 0,
"StatusMsg": "Batch insert data successfully.",
"success_num": 25,
"failed_num": 0,
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Brief description
- batch remove data
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is batchRemove |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If it is empty, the password is plaintext. If it is 1, it means encryption with MD5. |
db_name | yes | string | Database name |
file | no | string | Data NT files to be deleted (can be relative or absolute paths) |
async | no | string | If async is "true", immediately return the query opd_id, the server's asynchronous processing logic, and the client can call the checkOperationState interface through opd_id to view the operation status information |
callback | no | string | Callback interface, for example: http://127.0.0.1:8080/callback |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
success_num | string | Number of successful executions |
opt_id | string | Return the operation opd_id, the client can call the checkOperationState interface through opd_id to view the operation status information |
Return Sample (defult)
{
"StatusCode": 0,
"StatusMsg": "Batch remove data successfully.",
"success_num": 25,
"failed_num": 0,
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Return Sample (async=“true”)
{
"StatusCode": 0,
"StatusMsg": "Operation Success.",
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Return Sample (callback=“http://127.0.0.1:8080/callback”)
#push data to callback address
{
"operation": "batchRemove",
"StatusCode": 0,
"StatusMsg": "Batch remove data successfully.",
"success_num": 25,
"opt_id": "XXXX-XXXX-XXXX-XXXX"
}
Brief Description
- Rename the database.
Request method
- GET/POST
Parameter Transfer Method
- For GET requests, parameters are passed directly in the URL.
- For POST requests, the
raw
field in thebody
of thehttprequest
is used to pass parameters in JSON structure.
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
operation | Yes | string | Operation name, the fixed value is rename |
username | Yes | string | Username |
password | Yes | string | Password (clear text) |
encryption | No | string | If it is empty, the password is clear text. If it is 1, it means that md5 encryption is used. |
db_name | Yes | string | Database name |
new_name | Yes | string | New name of the database |
Return value
Parameter name | Type | Description |
---|---|---|
StatusCode | int | Return value code value (please refer to the attached table: Return Value Code Table) |
StatusMsg | string | Returns specific information |
Return Sample:
{
"StatusCode": 0,
"StatusMsg": "success"
}
Brief description
- Query asynchronous operation status (build, backup, restore, batchInsert, batchRemove)
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is checkOperationState |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If it is empty, the password is plaintext. If it is 1, it means encryption with MD5. |
opt_id | yes | string | Operation number |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
state | int | execution state(0 executing , -1 failed execution, 1 successfu execution) |
success_num | int | Number of successful executions |
failed_num | int | Number of failed executions |
Return Sample
{
"StatusCode": 0,
"StatusMsg": "Batch insert data successfully.",
"state": 1,
"success_num": 100,
"failed_num": 0
}
Brief description
- start transaction
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is begin |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If it is empty, the password is plaintext. If it is 1, it means encryption with MD5. |
db_name | yes | string | Database name |
isolevel | yes | string | Transaction isolation level 1:RC(read committed) 2:SI(snapshot isolation) 3:SR(seriablizable) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
TID | string | Transaction ID(this ID is important enough to take as a parameter |
Return sample
{
"StatusCode": 0,
"StatusMsg": "transaction begin success",
"TID": "1"
}
Brief description
- query the transaction type
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is tquery |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If it is empty, the password is plaintext. If it is 1, it means encryption with MD5. |
db_name | yes | string | Database name |
tid | yes | string | Transaction ID |
sparql | yes | string | sparql statement |
Return value
Parameter Name | Type | Description |
---|---|---|
StatusCode | int | Return value code (please refer to the attached table for specific values) |
StatusMsg | string | Specific return information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "success"
}
Brief description
- submit transaction
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is commit |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If it is empty, the password is plaintext. If it is 1, it means encryption with MD5. |
db_name | yes | string | Database name |
tid | yes | string | Transaction ID |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "transaction commit success. TID: 1"
}
Brief description
- Rollback trasnsaction
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is rollback |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If it is empty, the password is plaintext. If it is 1, it means encryption with MD5. |
db_name | yes | string | Database name |
tid | yes | string | Transaction ID |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "transaction rollback success. TID: 2"
}
Brief description
- Received Flush data back to hard disk (to make data final)
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is checkpoint |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If it is empty, the password is plaintext. If it is 1, it means encryption with MD5. |
db_name | yes | string | Database name |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Database saved successfully."
}
Brief description
- Display all user information
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is showuser |
username | yes | string | user name |
password | yes | string | Password (plain text) |
encryption | No | string | If it is empty, the password is clear text. If it is 1, it means it is encrypted with md5. |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
ResponseBody | JsonArray | JSON object array |
username | string | user name |
password | string | password |
query_privilege | string | Query permissions (database names separated by commas) |
update_privilege | string | Update permissions (database names separated by commas) |
load_privilege | string | Load permissions (database names separated by commas) |
unload_privilege | string | Unload permissions (database names separated by commas) |
backup_privilege | string | Back up permissions (database names separated by commas) |
restore_privilege | string | Restore permissions (database names separated by commas) |
export_privilege | string | Export permissions (database names separated by commas) |
Return sample
{
"StatusCode": 0,
"StatusMsg": "success",
"ResponseBody": [
{
"username": "liwenjie",
"password": "shuaige1982",
"query_privilege": "",
"update_privilege": "",
"load_privilege": "",
"unload_privilege": "",
"backup_privilege": "",
"restore_privilege": "",
"export_privilege": ""
},
{
"username": "root",
"password": "123456",
"query_privilege": "all",
"update_privilege": "all",
"load_privilege": "all",
"unload_privilege": "all",
"backup_privilege": "all",
"restore_privilege": "all",
"export_privilege": "all"
}
]
}
Brief description
- Manage users (including adding, deleting, and changing users)
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is usermanage |
type | yes | string | Operation Type(1:adduser ,2:deleteUser 3:alterUserPassword) |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | No | string | If it is empty, the password is clear text. If it is 1, it means it is encrypted with md5. |
op_username | yes | string | User name for the operation |
op_password | yes | string | Password of the operation (if the password is to be changed, the password is the password to be changed) (If the operation contains special characters and the get request is adopted, the value must be urlencode-encoded) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 1004,
"StatusMsg": "username already existed, add user failed."
}
Notes
-
The default interface permissions for the new user are:
login
,check
,testConnect
,getCoreVersion
,show
,funquery
,funcudb
,funreview
,userpassword
. -
Users with
query
rights also have the following interface rights:query
,monitor
. -
Users with the
update
permission also have the following interface permissions:batchInsert
,batchRemove
,begin
,tquery
,commit
,rollback
. -
Only the root user can invoke the interface rights that are not within the scope of authorization management, for example:
build
,drop
,usermanage
,showuser
,userprivilege
,manage
,txnlog
,checkpoint
,shutdown
,querylog
,accesslog
,ipmanage
.
Brief description
- Manage user permissions (including adding, deleting, and changing users)
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is userprivilegemanage |
type | yes | string | Operation type(1:add privilege,2:delete privilege 3:clear Privilege ) |
username | yes | string | user name |
password | yes | string | Password (plain text) |
encryption | No | string | If it is empty, the password is clear text. If it is 1, it means it is encrypted with md5. |
op_username | yes | string | User name for the operation |
privileges | no | string | Permissions to operate on (multiple permissions separated by commas) (can be null for clear Privilege)1:query,2:load,3:unload,4:update,5:backup,6:restore,7:export, you can set multi privileges by using , to split. |
db_name | no | string | The database to operate on (this can be empty if it is clearPrivilege |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "add privilege query successfully. \r\nadd privilege load successfully. \r\nadd privilege unload successfully. \r\nadd privilege update successfully. \r\nadd privilege backup successfully. \r\n"
}
Brief description
- Modify the user password.
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inhttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is userpassword |
username | yes | string | User name |
password | yes | string | Password |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
op_password | yes | string | New password (plain text) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode":0,
"StatusMsg": "change password done."
}
Brief description
- Show user-defined graph analysis functions
Request mode
- POST
Parameter transfer mode
- POST request,
raw
inbody
inhttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is funquery |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
funInfo | no | JSONObject | Query parameters |
funName | no | string | Function name |
funStatus | no | string | Status (1- to compile; 2- compiled; 3- exception) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
list | JSONArray | JSON array (if there is no data, no array is returned) |
funName | string | Name |
funDesc | string | Description |
funArgs | string | Parameter type (1- no K hop parameter; 2- with K hop parameter) |
funBody | string | Function content |
funSubs | string | Child functions (can be called in funBody) |
funStatus | string | Status (1- to compile; 2- compiled; 3- exception) |
lastTime | string | Last edit time (yyyy-MM-dd HH:mm:ss) |
Return sample
{
"StatusCode": 0,
"StatusMsg": "success",
"list": [
{
"funName": "demo",
"funDesc": "this is demo",
"funArgs": "2",
"funBody": "{\nstd::cout<<\"uid=\<<uid<<endl;\nstd::cout<<\"vid=\<<vid<<endl;\nstd::cout<<\"k=\"<<k<<endl;\nreturn \"success\";\n}",
"funSubs": "",
"funStatus": "1",
"lastTime": "2022-03-15 11:32:25"
}
]
}
Brief description
- User-defined graph analysis function management (add, modify, delete, compile)
Request mode
- POST
Parameter transfer mode
- POST request,
raw
inbody
inhttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is funcudb |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
type | yes | string | 1: add, 2: modify, 3: delete, 4: compile |
funInfo | yes | JSONObject | Operator function |
funName | yes | string | Function name |
funDesc | no | string | Description |
funArgs | no | string | Parameter type (1- no K hop parameter; 2- with K hop parameter). |
funBody | no | string | Function contents (wrapped in {}). |
funSubs | no | string | Child functions (can be called in funBody) |
funReturn | no | string | Return type(decode is required) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "success"
}
Brief description
- Preview the user-defined graph analysis function
Request mode
- POST
Parameter transfer mode
- POST request,
raw
inbody
inhttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is funreview |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
funInfo | yes | JSONObject | Operator function |
funName | yes | string | Function name |
funDesc | no | string | Description |
funArgs | yes | string | Parameter type (1- no K hop parameter; 2- with K hop parameter) |
funBody | yes | string | Function contents (contents wrapped in {}) |
funSubs | yes | string | Child function (can be called in funBody) |
funReturn | yes | string | Return type (path : the path class result; value : value class result) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
result | string | Function source code (decode is required) |
Return sample
{
"StatusCode": 0,
"StatusMsg": "success",
"Result":"%23include+%3Ciostream%3E%0A%23include+%22..%2F..%2FDatabase%2FCSRUtil.h%22%0A%0Ausing+..."
}
Brief description
- Get transaction logs (this function is only available for the root user)
- Updates in this version: added paging query parameters
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inhttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is txnlog |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
pageNo | yes | int | Page number, the value ranges from 1 to N, the default value is 1 |
pageSize | yes | int | The number of entries per page, the value ranges from 1 to N, the default value is 10 |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
totalSize | int | Total size |
totalPage | int | The total number of pages |
pageNo | int | The current page number |
pageSize | int | The number of entries per page |
list | JSONArray | Log array |
db_name | string | Database name |
TID | string | Transaction ID |
user | string | User |
state | string | State (COMMITED/RUNNING/ROLLBACK) |
begin_time | string | Start time |
end_time | string | End time |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Get Transaction log success",
"totalSize": 2,
"totalPage": 1,
"pageNo": 1,
"pageSize": 10,
"list": [
{
"db_name": "lubm2",
"TID": "1",
"user": "root",
"begin_time": "1630376221590",
"state": "COMMITED",
"end_time": "1630376277349"
},
{
"db_name": "lubm2",
"TID": "2",
"user": "root",
"begin_time": "1630376355226",
"state": "ROLLBACK",
"end_time": "1630376379508"
}
]
}
Brief description
- Get the date of gStore's query log (for the date parameter of the query log interface)
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is querylogdate |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
Return value
Parameter | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
list | array | The list of dates |
Return sample
{
"StatusCode":0,
"StatusMsg":"Get query log date success",
"list":[
"20220828",
"20220826",
"20220825",
"20220820"
]
}
Brief description
- Obtaining query Logs
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is querylog |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
date | yes | string | Date format is yyyyMMdd |
pageNo | yes | int | Page number. The value ranges from 1 to N. The default value is 1 |
pageSize | yes | int | The number of entries per page. The value ranges from 1 to N. The default value is 10 |
Return value
Parameter | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
totalSize | int | Total number |
totalPage | int | Total page number |
pageNo | int | Current page number |
pageSize | int | The number of entries per page |
list | Array | Log array |
QueryDateTime | string | Query date/time |
Sparql | string | SPARQL statement |
Format | string | Query return format |
RemoteIP | string | Request IP |
FileName | string | Query result set files |
QueryTime | int | Time (ms) |
AnsNum | int | Result number |
Return sample
{
"StatusCode":0,
"StatusMsg":"Get query log success",
"totalSize":64,
"totalPage":13,
"pageNo":2,
"pageSize":5,
"list":[
{
"QueryDateTime":"2021-11-16 14:55:52:90ms:467microseconds",
"Sparql":"select ?name where { ?name <不喜欢> <Eve>. }",
"Format":"json",
"RemoteIP":"183.67.4.126",
"FileName":"140163774674688_20211116145552_847890509.txt",
"QueryTime":0,
"AnsNum":2
}
......
]
}
Brief description
- Get the date of gStore's access log (for the date parameter of the access log interface)
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is querylogdate |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
Return value
Parameter | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
list | array | The list of dates |
Return sample
{
"StatusCode":0,
"StatusMsg":"Get access log date success",
"list":[
"20220913",
"20220912",
"20220911",
"20220818",
"20220731",
"20220712",
"20220620",
]
}
Brief description
- Get the access log of the API
Request mode
- GET/POST
Parameter transfer mode
- GET request, the parameters are passed directly as the URL
- POST request,
raw
inbody
inHttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is accesslog |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
date | yes | string | Date format is yyyyMMdd |
pageNo | yes | int | Page number. The value ranges from 1 to N. The default value is 1 |
pageSize | yes | int | The number of entries per page. The value ranges from 1 to N. The default value is 10 |
Return value
Parameter | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
totalSize | int | Total number |
totalPage | int | Total page number |
pageNo | int | Current page number |
pageSize | int | The number of entries per page |
list | Array | Log array |
ip | string | The IP that makes the access |
operation | string | The type of operation performed |
createtime | string | The time of the operation |
code | string | The result of the operation (refer to Appendix: Return value code table for details) |
msg | string | Log description |
Return sample
{
"StatusCode":0,
"StatusMsg":"Get access log success",
"totalSize":64,
"totalPage":13,
"pageNo":2,
"pageSize":5,
"list":[
{
"ip":"127.0.0.1",
"operation":"StopServer",
"createtime":"2021-12-14 09:55:16",
"code":0,
"msg":"Server stopped successfully."
}
......
]
}
There are 7 types of operation to parameter type
- 1:addReason
- 2:listReason
- 3:compileReason
- 4:executeReason
- 5:disableReason
- 6.showReason
- 7.deleteReason
Brief description
- add reasoning rules
Request mode
- POST
Parameter transfer mode
- POST request,
raw
inbody
inHttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is reasonManage |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
db_name | yes | string | Database name |
type | yes | string | Operation type is "1" |
ruleinfo | yes | object | Rule information: "ruleinfo": {"rulename":"", ...},Rule details |
rulename | yes | string | Rule name(Same database ,unique rulename) |
description | no | string | Rule description |
isenable | yes | int | Whether to enable, optional values: 1 enable ,0 disable |
type | yes | int | Reason type:optional values:1 relational reason , 0 attribute reason |
logic | yes | int | The relationship between conditions and conditions,optional values:1 logical and , 0 logical or |
conditions | yes | array | Rules set |
patterns | yes | array | Triples set |
subject | yes | string | Subject |
predicate | yes | string | Predicate |
object | yes | string | Object |
filters | no | array | Filter conditions |
count_info | no | Object | Aggregate function(undetermined) |
return | yes | Object | Return object |
source | yes | string | Source node |
target | no | string | Terminal node |
label | 否 | string | predicate(The system automatically adds the Rule: prefix) |
value | 否 | string | Attribute value |
Return value
Parameter | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Relational reasoning rule sample
{
"rulename": "uncle",
"description": "The mother's male sibling was the uncle"
"isenable": 1,
"type": 1,
"logic": 1,
"conditions": [
{
"patterns": [
{
"subject": "?x ",
"predicate": "<mother>",
"object": "?y"
},
{
"subject": "?y ",
"predicate": "<father>",
"object": "?z"
},
{
"subject": "?k",
"predicate": "<father>",
"object": "?z"
},
{
"subject": "?k",
"predicate": "<gender>",
"object": "\"male\"^^<http://www.w3.org/2001/XMLSchema#string>"
}
],
"filters": [],
"count_info": {}
}
],
"return": {
"source": "?x",
"target": "?k",
"label": "uncle"
}
}
Attribute reasoning rule sample
{
"rulename": "orphan",
"description": "Both parents died and were orphaned",
"isenable": 1,
"type": 0,
"logic": 1,
"conditions": [
{
"patterns": [
{
"subject": "?x ",
"predicate": "<father>",
"object": "?y"
},
{
"subject": "?x",
"predicate": "<mother>",
"object": "?z"
},
{
"subject": "?y",
"predicate": "<state>",
"object": "\"died\"^^<http://www.w3.org/2001/XMLSchema#string>"
},
{
"subject": "?z",
"predicate": "<state>",
"object": "\"died\"^^<http://www.w3.org/2001/XMLSchema#string>"
}
],
"filters": [],
"count_info": {}
}
],
"return": {
"source": "?x",
"label": "died",
"value": "\"orphan\"^^<http://www.w3.org/2001/XMLSchema#string>"
}
}
Return sample
{
"StatusCode": 0,
"StatusMsg": "Save Successfully! the file path is ./dbhome/lubm.db/reason_rule_files/test.json"
}
Brief description
- show rules list
Request mode
- POST
Parameter transfer mode
- POST request,
raw
inbody
inHttprequest
, passed asJSON
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is reasonManage |
username | yes | string | Username |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
db_name | yes | string | Database name |
type | yes | string | Operation type:“2” |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
num | int | Rule number |
list | JSONArray | Rule name list |
rulename | string | Rule name(Same database,unique rule name) |
description | string | Rule description |
isenable | int | Whether to enable, optional values: 1 enable ,0 disable |
type | int | Reason type:optional values:1 relational reason , 0 attribute reason |
logic | int | The relationship between conditions and conditions,optional values:1 logical and , 0 logical or |
conditions | array | Rules set |
condition | arry | Rule |
patterns | array | Triples set |
subject | string | Subject |
predicate | string | Predicate |
object | string | Object |
filters | array | Filter rule |
count_info | Object | Aggregate function(undetermined) |
return | Object | Return object |
source | string | Source node |
target | string | Terminal node |
label | string | predicate(The system automatically adds the Rule: prefix) |
value | string | Attribute value |
status | string | status |
insert_sparql | string | insert sparql |
delete_sparql | string | delete sparql |
createtime | string | create time |
Return value
{
"StatusCode": 0,
"StatusMsg": "ok",
"list": [
{
"ruleid": "002",
"rulename": "orphan",
"description": "Both parents died and were orphaned",
"conditions": [
{
"condition": {
"patterns": [
{
"subject": "?x ",
"predicate": "<father>",
"object": "?y"
},
{
"subject": "?x",
"predicate": "<mother>",
"object": "?z"
},
{
"subject": "?y",
"predicate": "<state>",
"object": "\"died\"^^<http://www.w3.org/2001/XMLSchema#string>"
},
{
"subject": "?z",
"predicate": "<state>",
"object": "\"died\"^^<http://www.w3.org/2001/XMLSchema#string>"
}
],
"filters": [],
"count_info": {}
},
"logic": 1
}
],
"isenable": 1,
"type": 0,
"return": {
"source": "?x",
"label": "state",
"value": "\"orphan\"^^<http://www.w3.org/2001/XMLSchema#string>"
},
"createtime": "2023-12-29 16:58:00",
"status": "executed",
"insert_sparql": "insert {?x <Rule:state> \"orphan\"^^<http://www.w3.org/2001/XMLSchema#string>. } where { ?x <father> ?y. ?x <mother> ?z. ?y <state> \"died\"^^<http://www.w3.org/2001/XMLSchema#string>. ?z <state> \"died\"^^<http://www.w3.org/2001/XMLSchema#string>. }",
"delete_sparql": "delete where {?x <Rule:state> \"orphan\"^^<http://www.w3.org/2001/XMLSchema#string>.}"
},
{
"ruleid": "001",
"rulename": "uncle2",
"description": "The mother's male sibling was the uncle",
"conditions": [
{
"condition": {
"patterns": [
{
"subject": "?x ",
"predicate": "<mother>",
"object": "?y"
},
{
"subject": "?y ",
"predicate": "<father>",
"object": "?z"
},
{
"subject": "?k",
"predicate": "<father>",
"object": "?z"
},
{
"subject": "?k",
"predicate": "<gender>",
"object": "\"male\"^^<http://www.w3.org/2001/XMLSchema#string>"
}
],
"filters": [],
"count_info": {}
},
"logic": 1
}
],
"isenable": 1,
"type": 1,
"return": {
"source": "?x",
"target": "?k",
"label": "uncle",
"value": ""
},
"createtime": "2023-12-29 16:58:00",
"status": "executed",
"insert_sparql": "insert { ?x <Rule:uncle> ?k. } where { ?x <mother> ?y. ?y <father> ?z. ?k <father> ?z. ?k <gender> \"male\"^^<http://www.w3.org/2001/XMLSchema#string>. }",
"delete_sparql": "delete where {?x <Rule:unlce> ?y.}"
}
],
"num": 2
}
Brief description
- compile rules
Request mode
- POST
Parameter transfer mode
- POST request:
raw
inbody
inhttprequest
, passed asJSON
Parameter
parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name.fixed reasonManage |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
db_name | yes | string | Database name |
type | yes | string | Operation type:“3” |
rulename | yes | string | Rule name |
Return value
parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
insert_sparql | string | insert sparql |
delete_sparql | string | delete sparql |
Return value
{
"insert_sparql": "insert {?x <Rule:state> \"orphan\"^^<http://www.w3.org/2001/XMLSchema#string>. } where { ?x <father> ?y. ?x <mother> ?z. ?y <state> \"died\"^^<http://www.w3.org/2001/XMLSchema#string>. ?z <state> \"died\"^^<http://www.w3.org/2001/XMLSchema#string>. }",
"delete_sparql": "delete where {?x <Rule:state> \"orphan\"^^<http://www.w3.org/2001/XMLSchema#string>.}",
"StatusCode": 0,
"StatusMsg": "ok"
}
Brief description
- execute rules
Request mode
- POST
Parameter transfer mode
- POST request,
raw
inbody
inHttprequest
, passed asJSON
Parameter
parameter | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is reasonManage |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
db_name | yes | string | Database name |
type | yes | string | Operation type :“4” |
rulename | yes | string | Rule name |
Return value
parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
insert_sparql | string | insert sparql |
AnsNum | int | successful answer number |
return value
{
"insert_sparql": "insert {?x <Rule:state> \"orphan\"^^<http://www.w3.org/2001/XMLSchema#string>. } where { ?x <father> ?y. ?x <mother> ?z. ?y <state> \"died\"^^<http://www.w3.org/2001/XMLSchema#string>. ?z <state> \"died\"^^<http://www.w3.org/2001/XMLSchema#string>. }",
"AnsNum": 0,
"StatusCode": 0,
"StatusMsg": "ok"
}
Brief description
- Invalidate the rule
Request mode
- POST
Parameter transfer mode
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed reasonManage |
username | yes | string | User name |
password | yes | string | Password (plain text) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
db_name | yes | string | Database name |
type | yes | string | Operation type:“5” |
rulename | yes | string | Rule name |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
delete_sparql | string | Delete sparql |
AnsNum | int | successful answer number |
Return value
{
"delete_sparql": "delete where {?x <Rule:state> \"orphan\"^^<http://www.w3.org/2001/XMLSchema#string>.}",
"AnsNum": 1,
"StatusCode": 0,
"StatusMsg": "ok"
}
Brief description
- show rule details
Request mode
- POST
Parameter transfer mode
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value reasonManage |
username | yes | string | User name |
password | yes | string | Password(plain test) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
db_name | yes | string | Database name |
type | yes | string | Operation type:“6” |
rulename | yes | string | Rule name |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
ruleinfo | Object | Object |
insert_sparql | string | insert sparql |
delete_sparql | string | delete sparql |
status | string | status |
rulename | string | Rule name(Same database,unique rule name) |
description | string | Rule description |
isenable | int | Whether to enable |
type | int | 1:relational reasoning 0:attribute reasoning |
logic | int | Relationship between conditions and conditions. Optional values:1: logical and ; 0 : logical or |
createtime | string | Create time |
conditions | JSONArray | Rule conditions(Array) |
condition | Object | Rule |
patterns | array | Triples set |
subject | string | Subject |
predicate | string | Predicate |
object | string | Object |
filters | array | Filter conditions |
count_info | Object | Aggregate function (undermined) |
return | Object | Return object |
source | string | Source node |
target | string | Terminal node |
label | string | predicate(The system automatically adds the Rule: prefix) |
value | string | Attribute value |
Return value
{
"ruleid": "002",
"rulename": "orphan",
"description": "The person whose both parents died is orphan",
"conditions": [
{
"condition": {
"patterns": [
{
"subject": "?x ",
"predicate": "<father>",
"object": "?y"
},
{
"subject": "?x",
"predicate": "<mother>",
"object": "?z"
},
{
"subject": "?y",
"predicate": "<state>",
"object": "\"died\"^^<http://www.w3.org/2001/XMLSchema#string>"
},
{
"subject": "?z",
"predicate": "<state>",
"object": "\"died\"^^<http://www.w3.org/2001/XMLSchema#string>"
}
],
"filters": [],
"count_info": {}
},
"logic": 1
}
],
"isenable": 1,
"type": 0,
"return": {
"source": "?x",
"label": "state",
"value": "\"orphan\"^^<http://www.w3.org/2001/XMLSchema#string>"
},
"createtime": "2023-12-29 16:58:00",
"status": "disabled",
"insert_sparql": "insert {?x <Rule:state> \"orphan\"^^<http://www.w3.org/2001/XMLSchema#string>. } where { ?x <father> ?y. ?x <mother> ?z. ?y <state> \"died\"^^<http://www.w3.org/2001/XMLSchema#string>. ?z <state> \"died\"^^<http://www.w3.org/2001/XMLSchema#string>. }",
"delete_sparql": "delete where {?x <Rule:state> \"orphan\"^^<http://www.w3.org/2001/XMLSchema#string>.}",
"StatusCode": 0,
"StatusMsg": "ok"
}
Brief description
- Delete rule
Request mode
- POST
Parameter transfer mode
- POST request,
raw
inbody
inHttprequest
, passed asJSON
structure
Parameter
Parameter | Mandatory | Type | Note |
---|---|---|---|
operation | yes | string | Operation name, fixed value is reasonManage |
username | yes | string | User name |
password | yes | string | Password(plain test) |
encryption | no | string | If the value is null, the password is in plain text. If the value is 1, the password is encrypted using md5 |
db_name | yes | string | Database name |
type | yes | string | Operation type:“7” |
rulename | yes | string | Rule name |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return value
{
"StatusCode": 0,
"StatusMsg": "the reason file has been remove successfully! file path:./dbhome/reason.db/reason_rule_files/orphan.json"
}
Code | Details |
---|---|
0 | Success |
1000 | The method type is not support |
1001 | Authentication Failed |
1002 | Check Privilege Failed |
1003 | Param is illegal |
1004 | The operation conditions are not satisfied |
1005 | Operation failed |
1006 | Add privilege Failed |
1007 | Loss of lock |
1008 | Transcation manage Failed |
1100 | The operation is not defined |
1101 | IP Blocked |
The gServer interface uses the socket
protocol and supports multiple ways to access the interface. If the port 9000
is started from the gServer in the Main directory, the contents of the interface interconnection are as follows:
API address:
http://ip:9000/
The API supports the input of a parameter list in JSON format, as shown below:
{"op": "[op_type]", "[paramname1]": "[paramvalue1]", "[paramname2]": "[paramvalue2]"……}
API name | Definition | Note |
---|---|---|
build | Build graph database | The database file must be locally stored on the server |
load | Load graph database | Load the database into memory |
unload | Unload graph database | Unload the database from memory |
drop | Delete graph database | Logical deletion and physical deletion can be performed |
show | Display graph database | Display list of all databases |
query | Query graph database | Including query, delete, and insert |
stop | Close server | Only root user root can perform this operation |
close | Close client server connection | Process client connection closure requests |
login | login to database | authenticate user names and password |
This section describes the input and output parameters of each interface. Assume that the IP address of the gserver is 127.0.0.1 and the port is 9000
(1) build- build database
Brief description
- Create a database based on existing NT file
- Files must exist on the gStore server
Request ip
127.0.0.1
Request port number
9000
Parameter transfer mode
- Pass it as a
JSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
op | yes | string | Operation name, fixed value is build |
db_name | yes | string | Database name (.db is not required) |
db_path | yes | string | Database file path (can be an absolute path or a relative path. The relative path uses the gStore installation root directory as a reference directory) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Import RDF file to database done."
}
(2) load
Brief description
- To load a database into memory, a load operation is a prerequisite for many operations, such as Query
Request ip
127.0.0.1
Request port number
9000
Parameter transfer mode
- Pass it as a
JSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
op | yes | string | Operation name, fixed value is load |
db_name | yes | string | Database name (.db is not required) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Load database successfully."
}
(3) unload
Brief description
- Unmount the database from memory (all changes are flushed back to hard disk)
Request ip
127.0.0.1
Request port number
9000
Parameter transfer mode
- Pass it as a
JSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
op | yes | string | Operation name, fixed value is unload |
db_name | yes | string | Database name (.db is not required) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Unload database done."
}
(4) drop
Brief description
- Delete the database
Request ip
127.0.0.1
Request port number
9000
Parameter transfer mode
- Pass it as a
JSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
op | yes | string | Operation name, fixed value is drop |
db_name | yes | string | Database name (.db is not required) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Drop database done."
}
(5) show
Brief description
- Display all database list
Request ip
127.0.0.1
Request port number
9000
Parameter transfer mode
- Pass it as a
JSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
op | yes | string | Operation name, fixed value is show |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
ResponseBody | JSONArray | JSON arrays (each of which is a database information0 |
-------- database | string | database name |
---------status | string | database status |
Return sample
{
"StatusCode": 0,
"StatusMsg": "success",
"ResponseBody": [
"lubm": "loaded",
"lubm10K": "unloaded"
]
}
(6) query
Brief description
- query database
Request ip
127.0.0.1
Request port number
9000
Parameter transfer mode
- Pass it as a
JSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
op | yes | string | Operation name, fixed value is query |
db_name | yes | string | database that need operations |
format | no | string | The result set return format is json by default |
sparql | yes | string | The SPARQL statement to execute |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
head | JSON | Head information |
results | JSON | Result information (see Return Sample for details) |
Return sample
{
"head": {
"link": [],
"vars": [
"x"
]
},
"results": {
"bindings": [
{
"x": {
"type": "uri",
"value": "十面埋伏"
}
},
{
"x": {
"type": "uri",
"value": "投名状"
}
},
{
"x": {
"type": "uri",
"value": "如花"
}
}
]
},
"StatusCode": 0,
"StatusMsg": "success"
}
(7) login
Brief description
- Login user (verify username and password)
Request ip
127.0.0.1
Request port number
9000
Parameter transfer mode
- Pass it as a
JSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
op | yes | string | Operation name, fixed value is login |
username | yes | string | user name |
password | yes | string | Password (plain text) |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 1001,
"StatusMsg": "wrong password."
}
(8) stop
Brief description
- Close server
Request ip
127.0.0.1
Request port number
9000
Parameter transfer mode
- Pass it as a
JSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
op | yes | string | Operation name, fixed value is stop |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Server stopped."
}
Brief description
- Close the connection to the client
Request ip
127.0.0.1
Request port number
9000
Parameter transfer mode
- Pass it as a
JSON
structure
Parameter
Parameter name | Mandatory | Type | Note |
---|---|---|---|
op | yes | string | Operation name, fixed value is close |
Return value
Parameter name | Type | Note |
---|---|---|
StatusCode | int | Return value code value (refer to Appendix: Return value code table for details) |
StatusMsg | string | Return specific information |
Return sample
{
"StatusCode": 0,
"StatusMsg": "Connection disconnected."
}
Code value | Definition |
---|---|
0 | Success |
1000 | The method type is not support |
1001 | Authentication Failed |
1002 | Check Privilege Failed |
1003 | Param is illegal |
1004 | The operation conditions are not satisfied |
1005 | Operation failed |
1006 | Add privilege Failed |
1007 | Loss of lock |
1008 | Transcation manage Failed |
1100 | The operation is not defined |
1101 | IP Blocked |
To use the C++ API, put the phrase '#include "client.h"
in your CPP code, as shown below:
Construct the initialization function
GstoreConnector(std::string serverIP, int serverPort, std::string httpType, std::string username, std::string password);
Function: Initialize
Parameter Definition:[Server IP], [HTTP port on the server], [HTTP service type], [Username], [password]
Example:GstoreConnector gc("127.0.0.1", 9000, "ghttp", "root", "123456");
Build database: build
std::string build(std::string db_name, std::string rdf_file_path, std::string request_type);
Function:Create a new database from an RDF file
Parameter Definition:[database name], [.nt file path], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:gc.build("lubm", "data/lubm/lubm.nt");
Load database: load
std::string load(std::string db_name, std::string request_type);
Function:Load the database you created
Parameter Definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:gc.load("lubm");
Stopping database loading: unload
std::string unload(std::string db_name, std::string request_type);
Function:Stopping database loading
Parameter Definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:gc.unload("lubm");
User management: user
std::string user(std::string type, std::string username2, std::string addition, std::string request_type);
Function:The root user can add, delete, or modify the user's permission only
1.Add or delete users:
Parameter Definition:["add_user" adds user, "delete_user" deletes user],[user name],[password],[request type "GET" and "POST ", if request type "GET" can be omitted]
Example:gc.user("add_user", "user1", "111111");
2.Modify user's privilege:
Parameter Definition:["Add_query" adds query permission, "delete_query" deletes query permission, "add_load" adds load permission, "delete_load" deletes load permission, "add_unload" adds no load permission, "delete_unload" deletes no load permission, "Add_update" adds update permission, "delete_update" deletes update permission, "add_backup" adds backup permission, "delete_bakup" deletes backup permission, "add_restore" adds restore permission, "Delete_restore" deletes restore permission,"add_export" adds export permission," delete_export" deletes export permission],[user name],[database name],[Request type "GET" and "POST ", if the request type is "GET", it can be omitted.]
Example:gc.user("add_query", "user1", "lubm");
Display user: showUser
std::string showUser(std::string request_type);
Function:Display all Users
Parameter Definition:[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:gc.showUser();
Database query: query
std::string query(std::string db_name, std::string format, std::string sparql, std::string request_type);
Function:Query the database
Parameter Definition:[database name], [query result type JSON, HTML or text], [SPARQL statement], [Request type "GET" and "POST ", if the request type is "GET", it can be omitted]
Example:
std::string res = gc.query("lubm", "json", sparql);
std::cout << res << std::endl; //output result
Deleting a Database: drop
std::string drop(std::string db_name, bool is_backup, std::string request_type);
Function:Delete the database directly or delete the database while leaving a backup
Parameter Definition:[database name], [false not backup, true backup], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:gc.drop("lubm", false); //Delete the database without leaving a backup
Monitoring database: monitor
std::string monitor(std::string db_name, std::string request_type);Function:Displays information for a specific database.
Parameter Definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]Example:gc.monitor("lubm");
Save the database: checkpoint
std::string checkpoint(std::string db_name, std::string request_type);Function:If you change the database, save the databas Parameter Definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]Example:gc.checkpoint("lubm");
Show the database: show
std::string show(std::string request_type);Function:Displays all created databases Parameter Definition:[Request types "GET" and "POST" can be omitted if the request type is "GET"] Example:gc.show();
The kernel version information is displayed: getCoreVersion
std::string getCoreVersion(std::string request_type);Function:Get kernel version information Parameter Definition:[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:gc.getCoreVersion();
The API version information is displaye: getAPIVersion
std::string getAPIVersion(std::string request_type);
Function:Get the API version information
Parameter Definition:[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:gc.getAPIVersion();
Exporting the Database
std::string exportDB(std::string db_name, std::string dir_path, std::string request_type);
Function:Export the database to a folder
Parameter Definition:[database name], [path to database export folder], [request type "GET" and "POST ", if the request type is "GET", can be omitted]
Example:gc.exportDB("lubm", "/root/gStore/");
To use the Java API, please refer to the gStore/API/HTTP/Java/SRC/JGSC/GstoreConnector. Java. Specific use is as follows:
Construct the initialization function
public class GstoreConnector(String serverIP, int serverPort, String httpType,
String username, String password);
Function: Initialize
Parameter Definition:[Server IP], [HTTP port on the server], [HTTP service type], [Username], [password]
Example:GstoreConnector gc = new GstoreConnector("127.0.0.1", 9000, "ghttp",
"root", "123456");
Building a database: build
public String build(String db_name, String rdf_file_path, String request_type);
Function:Create a new database from an RDF file
Parameter Definition:[database name], [.nt file path], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:gc.build("lubm", "data/lubm/lubm.nt");
Loading a database: load
public String load(String db_name, String request_type);
Function:Load the database you created
Parameter Definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:gc.load("lubm");
Stopping database loading: unload
public String unload(String db_name, String request_type);
Function:Stopping database loading
Parameter Definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:gc.unload("lubm");
User management:user
public String user(String type, String username2, String addition, String request_type);
Function:The root user can add, delete, or modify the user's permission only.
1.Add or delete users:
Parameter Definition:["add_user" adds user, "delete_user" deletes user],[user name],[password],[request type "GET" and "POST ", if request type "GET" can be omitted]
Example:gc.user("add_user", "user1", "111111");
2.Modify user's privilege:
Parameter Definition:["Add_query" adds query permission, "delete_query" deletes query permission, "add_load" adds load permission, "delete_load" deletes load permission, "add_unload" adds no load permission, "delete_unload" deletes no load permission, "Add_update" adds update permission, "delete_update" deletes update permission, "add_backup" adds backup permission, "delete_bakup" deletes backup permission, "add_restore" adds restore permission, "Delete_restore" deletes restore permission,"add_export" adds export permission," delete_export" deletes export permission],[user name],[database name],[Request type "GET" and "POST ", if the request type is "GET", it can be omitted.]
Example:gc.user("add_query", "user1", "lubm");
Display user:showUser
public String showUser(String request_type);
Function:Display all users
Parameter Definition:[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:gc.showUser();
Database query: query
public String query(String db_name, String format, String sparql, String request_type);
Function:query databse
Parameter Definition:[database name], [query result type JSON, HTML or text], [SPARQL statement], [Request type "GET" and "POST ", if the request type is "GET", it can be omitted]
Example:
String res = gc.query("lubm", "json", sparql);
System.out.println(res); //output result
Database deletion :drop
public String drop(String db_name, boolean is_backup, String request_type);
Function:Delete the database directly or delete the database while leaving a backup.
Parameter Definition:[database name], [false not backup, true backup], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:gc.drop("lubm", false); //Delete the database without leaving a backup
Monitoring database: monitor
public String monitor(String db_name, String request_type);
Function:Displays information for a specific database
Parameter Definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]Example:gc.monitor("lubm");
Save the database: checkpoint
public String checkpoint(String db_name, String request_type);
Function:If you change the database, save the database
Parameter Definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]Example:gc.checkpoint("lubm");
Show database:show
public String show(String request_type);Function:Displays all created databasesParameter Definition:[Request types "GET" and "POST" can be omitted if the request type is "GET"]Example:gc.show();
The kernel version information is displayed:getCoreVersion
public String getCoreVersion(String request_type);Function:Get kernel version information Parameter Definition:[Request types "GET" and "POST" can be omitted if the request type is "GET"]Example:gc.getCoreVersion();
Display API version:getAPIVersion
public String getAPIVersion(String request_type);Function:Get API version Parameter:[Request types "GET" and "POST" can be omitted if the request type is "GET"]Example:gc.getAPIVersion();
Export database
public String exportDB(String db_name, String dir_path, String request_type);Function:Export database to parameter definition under file folder:[database name], [database export folder path],[Request types "GET" and "POST" can be omitted if the request type is "GET"】Example:gc.exportDB("lubm", "/root/gStore/");
To use the Python API, please refer to the gStore/API/HTTP/Python/src/GstoreConnector. Py. Specific use is as follows:
Construct the initialization function
def __init__(self, ip, port, username, password, http_type='ghttp'):
Function: Initialize
Parameter Definition:[Server IP], [HTTP port on the server], [Username], [password],[HTTP service type]
Example:gc = GstoreConnector.GstoreConnector("127.0.0.1", 9000, "ghttp", "root",
"123456")
Build database: build
def build(self, db_name, rdf_file_path, request_type):
Function:Create a new database from an RDF file
Parameter definition:[Database name],[.nt文件路径],[Request types "GET" and "POST" can be omitted if the request type is "GET"】
Example:res = gc.build("lubm", "data/lubm/lubm.nt")
Load database: load
def load(self, db_name, request_type):
Function:load the database you have created
Parameter definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:res = gc.load("lubm")
Unload database: unload
def unload(self, db_name, request_type):
Function:Unload database
Parameter definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:res = gc.unload("lubm")
User management: user
def user(self, type, username2, addition, request_type):
Function:The root user can add, delete, or modify the user's permission only.
1.Add or delete users:
Parameter definition:["add_user" adds a user, "delete_user" deletes a user], [username],[password],[Request types "GET" and "POST" can be omitted if the Request type is "GET"]
Example:res = gc.user("add_user", "user1", "111111")
2.Modify user's privilege:
Parameter definition:["Add_query" adds query permission, "delete_query" deletes query permission, "add_load" adds load permission, "delete_load" deletes load permission, "add_unload" adds no load permission, "delete_unload" deletes no load permission, "Add_update" adds update permission, "delete_update" deletes update permission, "add_backup" adds backup permission, "delete_bakup" deletes backup permission, "add_restore" adds restore permission, "Delete_restore" deletes restore permission,"add_export" adds export permission," delete_export" deletes export permission], [user name],[database name],[Request types "GET" and "POST" can be omitted if the Request type is "GET"]
Example:res = gc.user("add_query", "user1", "lubm")
Display users: showUser
def showUser(self, request_type):
Function:Display all users
Parameter definition:[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:res = gc.showUser()
Query Database: query
def query(self, db_name, format, sparql, request_type):
Function:Query the database
Parameter definition:[Database name],[Query result type JSON, HTML or text], [SPARQL statement], [Request types "GET" and "POST" can be omitted if the Request type is "GET"]
Example:
res = gc.query("lubm", "json", sparql)
print(res) //output result
Database deletion: drop
def drop(self, db_name, is_backup, request_type):
Function:Delete the database directly or delete the database while leaving a backup
Parameter definition:[database name], [false not backup, true backup],[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:res = gc.drop("lubm", false) //Delete the database without leaving a backup
Database Monitor :monitor
def monitor(self, db_name, request_type): Function:Displays information for a specific database Parameter definition:[Database name],[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:res = gc.monitor("lubm")
Save database: checkpoint
def checkpoint(self, db_name, request_type):Function:If the database is changed, save the meaning of the database parameters:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted] Example:res = gc.checkpoint("lubm")
Display database:show
def show(self, request_type):Function:Display the meanings of all created databases:[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:res = gc.show()
The kernel version information is displayed: getCoreVersion
def getCoreVersion(self, request_type):Function:Get the definition of kernel version parameter :[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:res = gc.getCoreVersion()
Display API version: getAPIVersion
def getAPIVersion(self, request_type):Function:Get the API version information parameter definition:[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:res = gc.getAPIVersion()
Export databse
def exportDB(self, db_name, dir_path, request_type): Function:parameter definition of exprotin database to folders:[database name], [database export folder path],[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:res = gc.exportDB("lubm", "/root/gStore/")
Before using the Nodejs API, type NPM install Request
and NPM Install request-promise
to add the required modules under the Nodejs folder.
To use Nodejs API, please refer to the gStore/API/http/Nodejs/GstoreConnector.js
. Specific use is as follows:
Construct the initialization function
class GstoreConnector(ip = '', port, httpType = 'ghttp', username = '', password
= '');
Function: Initialize
Parameter Definition:[Server IP], [HTTP port on the server], [HTTP service type], [Username], [password]
Example:gc = new GstoreConnector("127.0.0.1", 9000, "ghttp", "root", "123456");
Build database: build
async build(db_name = '', rdf_file_path = '', request_type);
Function:Create a new database from an RDF file
The defintion of parameters are as follows: [database name], [.nt file path],[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:res = gc.build("lubm", "data/lubm/lubm.nt");
Load database:load
async load(db_name = '', request_type);
Function:Load the database you have created
Parameter definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:res = gc.load("lubm");
Unload databse:unload
async unload(db_name = '', request_type);
Function:Unload databse
Parameter definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:res = gc.unload("lubm");
User management:user
async user(type = '', username2 = '' , addition = '' , request_type);
Function:The root user can add, delete, or modify the user's permission only
1.Add or delete users:
Parameter definition:["add_user" adds a user, "delete_user" deletes a user], [user name],[password],[Request types "GET" and "POST" can be omitted if the Request type is "GET"]
Example:res = gc.user("add_user", "user1", "111111");
2.Privilege to modify user:
Parameter definition:["Add_query" adds query permission, "delete_query" deletes query permission, "add_load" adds load permission, "delete_load" deletes load permission, "add_unload" adds no load permission, "delete_unload" deletes no load permission, "Add_update" adds update permission, "delete_update" deletes update permission, "add_backup" adds backup permission, "delete_bakup" deletes backup permission, "add_restore" adds restore permission, "Delete_restore" deletes restore permission,"add_export" adds export permission," delete_export" deletes export permission], [user name],[database name],[Request types "GET" and "POST" can be omitted if the Request type is "GET"]]
Example:res = gc.user("add_query", "user1", "lubm");
Display user:showUser
async showUser(request_type);
Function:Display all users
Parameter definition: [Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:res = gc.showUser();
Query database:query
async query(db_name = '', format = '' , sparql = '' , request_type);
Function:Query database
Parameter definition:[Database name], [query result type JSON, HTML or text], [SPARQL statement], [Request types "GET" and "POST" can be omitted if the Request type is "GET"]
Example:
res = gc.query("lubm", "json", sparql);
console.log(JSON.stringify(res,",")); //output result
Database deletion:drop
async drop(db_name = '', is_backup , request_type);
Function:Delete the database directly or delete the database while leaving a backup
Parameter definition:[database name],[false no backup, true backup],[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:res = gc.drop("lubm", false); //Delete the database without leaving a backup
Database monitor: monitor
async monitor(db_name = '', request_type); Function:Parameter definition for displaying information about a specific database:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]Example:res = gc.monitor("lubm");
Save database: checkpoint
async checkpoint(db_name = '', request_type);Function:If the database is changed, the parameter definition of saving database:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]Example:res = gc.checkpoint("lubm");
Display database: show
async show(request_type);Function:Displays all created databases Parameter definition: [Request types "GET" and "POST" can be omitted if the request type is "GET"]Example:res = gc.show();
Display kernel version information: getCoreVersion
async getCoreVersion(request_type);Function:Get kernel version information
Parameter definition: [Request types "GET" and "POST" can be omitted if the request type is "GET"]Example:res = gc.getCoreVersion();
Display API version: getAPIVersion
async getAPIVersion(request_type);
Function:Get the API version information
Parameter definition:[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:res = gc.getAPIVersion();
Export database
async exportDB(db_name = '' , dir_path = '' , request_type);
Function:export database to folders
parameter definition:[database name], [directory where the database is exported], [Request types "GET" and "POST" can be omitted if the Request type is "GET"]
Example:res = gc.exportDB("lubm", "/root/gStore/");
To use the Php API, please refer to the gStore/API/HTTP/Php/SRC/GstoreConnector. Php. Specific use is as follows:
Construct the initialization function
class GstoreConnector($ip, $port, $httpType, $username, $password)
Function: Initialize
Parameter Definition:[Server IP], [HTTP port on the server], [HTTP service type], [Username], [password]
Example:$gc = new GstoreConnector("127.0.0.1", 9000, "ghttp", "root", "123456");
Build databse:build
function build($db_name, $rdf_file_path, $request_type)
Function:Create a new database from an RDF file
Parameter definition:[database name], [.nt file path],[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:
$res = $gc->build("lubm", "data/lubm/lubm.nt");
echo $res . PHP_EOL;
Load database:load
function load($db_name, $request_type)
Function:Load the database you have created
Parameter definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:
$ret = $gc->load("test");
echo $ret . PHP_EOL;
Unload databse:unload
function unload($db_name, $request_type)
Function:Unload databse
Parameter definition:[database name],[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:
$ret = $gc->unload("test");
echo $ret . PHP_EOL;
User management:user
function user($type, $username2, $addition, $request_type)
Function:Only the root user can add, delete, or modify the user's permission
1.Add or delete users:
Parameter definition:["add_user" adds a user, "delete_user" deletes a user], [user name],[password],[Request types "GET" and "POST" can be omitted if the Request type is "GET"]
Example:
$res = $gc->user("add_user", "user1", "111111");
echo $res . PHP_EOL;
2.Privilege to modify user:
参数含义:["Add_query" adds query permission, "delete_query" deletes query permission, "add_load" adds load permission, "delete_load" deletes load permission, "add_unload" adds no load permission, "delete_unload" deletes no load permission, "Add_update" adds update permission, "delete_update" deletes update permission, "add_backup" adds backup permission, "delete_bakup" deletes backup permission, "add_restore" adds restore permission, "Delete_restore" deletes restore permission,"add_export" adds export permission," delete_export" deletes export permission], [user name],[database name],[Request types "GET" and "POST" can be omitted if the Request type is "GET"]]
Example:
$res = $gc->user("add_user", "user1", "lubm");
echo $res . PHP_EOL;
Display user:showUser
function showUser($request_type)
Function:Display all users
Parameter definition:[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:
$res = $gc->showUser();
echo $res. PHP_EOL;
Query database:query
function query($db_name, $format, $sparql, $request_type)
Parameter definition:[database name], [query result type JSON, HTML or text], [SPARQL statement],[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:
$res = $gc->query("lubm", "json", $sparql);
echo $res. PHP_EOL; //output result
Database deletion:drop
function drop($db_name, $is_backup, $request_type)
Function:Delete the database directly or delete the database while leaving a backup
Parameter definition:[database name], [false not backup, true backup],[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:
$res = $gc->drop("lubm", false); //Delete the database without leaving a backup
echo $res. PHP_EOL;
Database monitor: monitor
function monitor($db_name, $request_type)Function:Displays information for a specific database
Parameter definition:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]
Example:$res = $gc->monitor("lubm");echo $res. PHP_EOL;
Save database: checkpoint
function checkpoint($db_name, $request_type)Function:the Parameter definition of save database if it has been changed:[database name], [request type "GET" and "POST ", if request type "GET" can be omitted]Example:$res = $gc->checkpoint("lubm");echo $res. PHP_EOL;
Display database: show
function show($request_type)Function:Displays all created databases
Parameter definition:[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:$res = $gc->show();echo $res. PHP_EOL;
Display kernel version information: getCoreVersion
function getCoreVersion($request_type)Function:get kernel version information
Parameter definition: [Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:$res = $gc->getCoreVersion();echo $res. PHP_EOL;
Display API version: getAPIVersion
function getAPIVersion($request_type)
Function:Get API version
Parameter definition: [Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:
$res = $gc->getAPIVersion();
echo $res. PHP_EOL;
Export database
function exportDB($db_name, $dir_path, $request_type)
Function:Export the database to a folder
Parameter definition:[database name], [database export folder path],[Request types "GET" and "POST" can be omitted if the request type is "GET"]
Example:$res = $gc->exportDB("lubm", "/root/gStore/");