Skip to content

Commit

Permalink
Add Apache AGE
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanlonel committed Dec 18, 2024
1 parent 6d6b365 commit 69ab7fd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ RUN apt-get update && \
# runtime requirement for using spatialite with sqlite_fdw
libsqlite3-mod-spatialite \
pgagent \
postgresql-$PG_MAJOR-age \
postgresql-$PG_MAJOR-asn1oid \
postgresql-$PG_MAJOR-credcheck \
postgresql-$PG_MAJOR-cron \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ For more detailed instructions about how to start and control your Postgres cont

## Available extensions

- [age](https://github.com/apache/age)
- [asn1oid](https://github.com/df7cb/pgsql-asn1oid)
- [credcheck](https://github.com/MigOpsRepos/credcheck)
- [ddlx](https://github.com/lacanoid/pgddl)
Expand Down
37 changes: 37 additions & 0 deletions tests/create_extensions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,43 @@ CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;
SELECT PostGIS_Full_Version();


-- https://github.com/apache/age
CREATE EXTENSION age;
LOAD 'age';

BEGIN;

SET search_path = ag_catalog, "$user", public;

SELECT create_graph('graph_name');

-- create vertices
SELECT * FROM cypher('graph_name', $$CREATE (:label {property:"Node A"})$$) as (v agtype);
SELECT * FROM cypher('graph_name', $$CREATE (:label {property:"Node B"})$$) as (v agtype);

-- create an edge between two nodes and set its properties
SELECT * FROM cypher(
'graph_name',
$$
MATCH (a:label), (b:label)
WHERE a.property = 'Node A' AND b.property = 'Node B'
CREATE (a)-[e:RELTYPE {property:a.property + '<->' + b.property}]->(b)
RETURN e
$$
) as (e agtype);

-- query the connected nodes
SELECT * from cypher(
'graph_name',
$$
MATCH (V)-[R]-(V2)
RETURN V,R,V2
$$
) as (V agtype, R agtype, V2 agtype);

ROLLBACK;


-- https://github.com/df7cb/pgsql-asn1oid
CREATE EXTENSION IF NOT EXISTS asn1oid;
SELECT '1.3.6.1.4.1'::asn1oid;
Expand Down

0 comments on commit 69ab7fd

Please sign in to comment.