DEV Community

Pawan Kukreja
Pawan Kukreja

Posted on

Introduction of Apache AGE.

Overview

Apache AGE, a PostgreSQL extension, delivers robust graph database capabilities. Representing "A Graph Extension" (AGE), it draws inspiration from Bitnine's variant of PostgreSQL 10, AgensGraph—a versatile multi-model database. The project aims to establish a unified storage solution capable of managing both relational and graph model data. This empowers users to seamlessly leverage standard ANSI SQL alongside openCypher, the designated Graph query language.

Graphs

A graph is made up of vertices and edges, and every node and edge has a unique set of attributes associated with it. The fundamental unit of a graph is a vertex, which is independent of all other nodes in the graph. A directed link between two vertices is formed by an edge.

To create a graph, use the create_graph function, located in the ag_catalog namespace.

Syntax: create_graph(graph_name);

Returns:

void

To delete a graph, use the drop_graph function, located in the ag_catalog namespace.

Syntax: drop_graph(graph_name, cascade);

Returns:

void

Simple Datatype

Null
SELECT *
FROM cypher('graph_name', $$
RETURN NULL
$$) AS (null_result agtype);

Integer
SELECT *
FROM cypher('graph_name', $$
RETURN 1
$$) AS (int_result agtype);

Float
SELECT *
FROM cypher('graph_name', $$
RETURN 1.0
$$) AS (float_result agtype);

Numeric
SELECT *
FROM cypher('graph_name', $$
RETURN 1.0::numeric
$$) AS (numeric_result agtype);

Bool
SELECT *
FROM cypher('graph_name', $$
RETURN TRUE
$$) AS (boolean_result agtype);

String
SELECT *
FROM cypher('graph_name', $$
RETURN 'This is a string'
$$) AS (string_result agtype);

Top comments (0)