NAME

Neo4j::Types::Relationship - Describes a relationship from a Neo4j graph

VERSION

version 1.00

SYNOPSIS

$rel_id   = $relationship->id;
$rel_type = $relationship->type;

$start_node_id = $relationship->start_id;
$end_node_id   = $relationship->end_id;

$property1  = $relationship->get('property1');
$property2  = $relationship->get('property2');
%properties = %{ $relationship->properties };

DESCRIPTION

Describes a relationship from a Neo4j graph. A relationship may be created by executing a Cypher statement against a Neo4j database server. Its description contains the relationship's properties as well as certain meta data, all accessible by methods that this class provides.

This module makes no assumptions about its internal data structure. While default implementations for all methods are provided, inheritors are free to override these according to their needs. The default implementations assume the data is stored in the format defined for Neo4j::Bolt::Relationship.

Neo4j::Types::Relationship objects are typically not in a one-to-one relation with relationships in a Neo4j graph. If the same Neo4j relationship is fetched multiple times, then multiple distinct Neo4j::Types::Relationship objects may be created. Refer to the documentation of the Perl module you use to fetch relationships from the Neo4j database for information about how that particular module handles this aspect.

METHODS

Neo4j::Types::Relationship implements the following methods.

get

$value = $relationship->get('property_key');

Retrieve the value of this relationship's property with the given key. If no such key exists, return an undefined value.

id

$id = $relationship->id;

Return an ID for this relationship that is unique within a particular context, for example the current driver session or Bolt connection.

Neo4j relationship IDs are not designed to be persistent. After a relationship is deleted, its ID may be reused by another relationship.

IDs are always integer numbers. A relationship with the ID 0 may exist. Nodes and relationships do not share the same ID space.

properties

$hashref = $relationship->properties;
$value = $hashref->{property_key};

Return all properties of this relationship as a hash reference.

start_id

$id = $relationship->start_id;

Return an ID for the node where this relationship starts.

end_id

$id = $relationship->end_id;

Return an ID for the node where this relationship ends.

type

$type = $relationship->type;

Return the type of this relationship.

BUGS

The behaviour of the properties() method when called in list context has not yet been defined.

The effect of making changes to the contents of the hash to which a reference is returned from the properties() method has not yet been defined.

SEE ALSO

AUTHOR

Arne Johannessen <ajnn@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2021 by Arne Johannessen.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)