| 1 | package DBIO::PostgreSQL::Age; | ||
| 2 | # ABSTRACT: Apache AGE graph database support for DBIO::PostgreSQL | ||
| 3 | 2 | our $VERSION = '0.900001'; | |
| 4 | |||
| 5 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | |||
| 9 | 1 | ▶ | sub connection { |
|
Subroutine
connection: called CC=1 SCAR=0.0
Pod
documented
| |||
| 10 | 1 | my ($self, @info) = @_; | |
| 11 | 1 | $self->register_storage_layer('DBIO::PostgreSQL::Age::Storage'); | |
| 12 | 1 | return $self->next::method(@info); | |
| 13 | } | ||
| 14 | |||
| 15 | |||
| 16 | 2 | 1; | |
| 17 | |||
| 18 | __END__ | ||
| 19 | |||
| 20 | =pod | ||
| 21 | |||
| 22 | =encoding UTF-8 | ||
| 23 | |||
| 24 | =head1 NAME | ||
| 25 | |||
| 26 | DBIO::PostgreSQL::Age - Apache AGE graph database support for DBIO::PostgreSQL | ||
| 27 | |||
| 28 | =head1 VERSION | ||
| 29 | |||
| 30 | version 0.900001 | ||
| 31 | |||
| 32 | =head1 SYNOPSIS | ||
| 33 | |||
| 34 | package MyApp::Schema; | ||
| 35 | use base 'DBIO::Schema'; | ||
| 36 | __PACKAGE__->load_components('PostgreSQL::Age'); | ||
| 37 | |||
| 38 | my $schema = MyApp::Schema->connect( | ||
| 39 | $dsn, $user, $pass, | ||
| 40 | { on_connect_call => 'load_age' }, | ||
| 41 | ); | ||
| 42 | |||
| 43 | $schema->storage->create_graph('social'); | ||
| 44 | |||
| 45 | my $rows = $schema->storage->cypher( | ||
| 46 | 'social', | ||
| 47 | $$ MATCH (a:Person)-[:KNOWS]->(b:Person) RETURN a.name, b.name $$, | ||
| 48 | [qw( person friend )], | ||
| 49 | ); | ||
| 50 | |||
| 51 | =head1 DESCRIPTION | ||
| 52 | |||
| 53 | L<DBIO::PostgreSQL::Age> integrates L<Apache AGE|https://age.apache.org/> | ||
| 54 | graph database support into L<DBIO::PostgreSQL>. Apache AGE is a PostgreSQL | ||
| 55 | extension that adds openCypher graph query capabilities via the C<cypher()> | ||
| 56 | SQL function. | ||
| 57 | |||
| 58 | Loading this component registers L<DBIO::PostgreSQL::Age::Storage> as a storage | ||
| 59 | B<layer> (via L<DBIO::Schema/register_storage_layer>), so it is composed over the | ||
| 60 | resolved PostgreSQL driver storage at connection time -- see | ||
| 61 | L<DBIO::Storage::Composed>. The composed storage carries graph lifecycle | ||
| 62 | management and Cypher query execution alongside the standard PostgreSQL storage, | ||
| 63 | and stacks with other storage-layer extensions (e.g. L<DBIO::PostgreSQL::PostGIS>) | ||
| 64 | on the same schema. | ||
| 65 | |||
| 66 | =head1 METHODS | ||
| 67 | |||
| 68 | =head2 connection | ||
| 69 | |||
| 70 | Overrides L<DBIO/connection> to register L<DBIO::PostgreSQL::Age::Storage> as a | ||
| 71 | storage layer (L<DBIO::Schema/register_storage_layer>) before connecting, so it | ||
| 72 | is composed over the resolved driver storage rather than replacing it. This is | ||
| 73 | what lets AGE stack with other PostgreSQL storage-layer extensions and ride | ||
| 74 | every async transport its layer is composed onto. | ||
| 75 | |||
| 76 | =head1 CONNECTION SETUP | ||
| 77 | |||
| 78 | Apache AGE requires C<LOAD 'age'> and C<SET search_path = ag_catalog, ...> | ||
| 79 | on each database connection before any graph operations. Use the C<load_age> | ||
| 80 | connection callback: | ||
| 81 | |||
| 82 | MyApp::Schema->connect( | ||
| 83 | $dsn, $user, $pass, | ||
| 84 | { on_connect_call => 'load_age' }, | ||
| 85 | ); | ||
| 86 | |||
| 87 | =seealso | ||
| 88 | |||
| 89 | =over 4 | ||
| 90 | |||
| 91 | =item * L<DBIO::PostgreSQL> - Base PostgreSQL driver component | ||
| 92 | |||
| 93 | =item * L<DBIO::PostgreSQL::Age::Storage> - Storage class with graph methods | ||
| 94 | |||
| 95 | =back | ||
| 96 | |||
| 97 | =head1 AUTHOR | ||
| 98 | |||
| 99 | DBIO Authors | ||
| 100 | |||
| 101 | =head1 COPYRIGHT AND LICENSE | ||
| 102 | |||
| 103 | Copyright (C) 2026 DBIO Authors | ||
| 104 | |||
| 105 | This is free software; you can redistribute it and/or modify it under | ||
| 106 | the same terms as the Perl 5 programming language system itself. | ||
| 107 | |||
| 108 | =cut | ||