Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

JSON can be loaded into Apache AGE in the following ways:

  1. Using the LOAD JSON command: This command can be used to load data from a JSON file into AGE graph. The command requires the JSON file path and the target graph name as input.

Example syntax:

LOAD JSON 'path/to/jsonfile.json' into graph <graph_name>; 
  1. Using the CREATE VERTEX/EDGE commands: JSON data can be loaded into the graph by creating vertices and edges using the CREATE VERTEX/EDGE commands. The JSON data can be passed as a JSON object property in the command.

Example syntax:

CREATE VERTEX v1 PROPERTIES { "name": "Alice", "age": 30 }; CREATE EDGE e1 FROM v1 TO v2 PROPERTIES { "type": "friendship" }; 
  1. Using the INSERT command with JSON data: The INSERT command in AGE allows inserting data in JSON format. The data can be directly provided as a JSON object in the command.

Example syntax:

INSERT INTO <graph_name> JSON '{"v":[{"id": "v1", "name": "Alice", "age": 30}, {"id": "v2", "name": "Bob", "age": 40}], "e": [{"from": "v1", "to": "v2", "type": "friendship", "id": "e1"}]}'; 

These are some of the ways JSON data can be loaded into Apache AGE for analysis and querying.