-
-
23 Jan 2022 01:02:57 UTC
- Distribution: REST-Neo4p
- Module version: 0.4003
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (9)
- Testers (276 / 0 / 3)
- Kwalitee
Bus factor: 1- 41.72% Coverage
- License: perl_5
- Perl: v5.10.1
- Activity
24 month- Tools
- Download (161.97KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 5 contributors- Mark A. Jensen
-
Arne Johannessen
- Keith Broughton <@keithbro>
- Christiaan Kras <@Htbaa>
- denixx
NAME
REST::Neo4p::Constraint::Property - Neo4j Property Constraints
SYNOPSIS
# use REST::Neo4p::Constrain, it's nicer $npc = REST::Neo4p::Constraint::NodeProperty->new( 'soldier' => { _condition => 'all', _priority => 1, name => '', rank => [], serial_number => qr/^[0-9]+$/, army_of => 'one' } ); $rpc = REST::Neo4p::Constraint::RelationshipProperty->new( 'position' => { _condition => 'only', position => qr/[0-9]+/ } );
DESCRIPTION
REST::Neo4p::Constraint::NodeProperty
andREST::Neo4p::Constraint::RelationshipProperty
are classes that represent constraints on the presence and values of Node and Relationship entities.Constraint hash specification:
{ _condition => constraint_conditions, # ('all'|'only'|'none') _relationship_type => <relationship type>, _priority => <integer priority>, prop_0 => [], # may have, no constraint prop_1 => [<string|regexp>], # may have, if present must meet prop_2 => '', # must have, no constraint prop_3 => 'value', # must have, value must eq 'value' prop_4 => qr/.alue/, # must have, value must match qr/.alue/, prop_5 => qr/^value1|value2|value3$/ # regexp for enumerations }
METHODS
- new()
-
$np = REST::Neo4p::Constraint::NodeProperty->new( $tag => $constraint_hash ); $rp = REST::Neo4p::Constraint::RelationshipProperty->new( $tag => $constraint_hash );
- add_constraint()
-
$np->add_constraint( optional_accessory => [qw(tie ascot boutonniere)] );
- remove_constraint()
-
$np->remove_constraint( 'unneeded_property' );
- tag()
-
Returns the constraint tag.
- type()
-
Returns the constraint type ('node_property' or 'relationship_property').
- condition()
- set_condition()
-
Set/get 'all', 'only', 'none' for a given property constraint. See REST::Neo4p::Constrain.
- priority()
- set_priority()
-
Constraints with higher priority will be checked before constraints with lower priority by
validate_properties()
. - constraints()
-
Returns the internal constraint spec hashref.
- validate()
-
$c->validate( $node_object ) $c->validate( $relationship_object ) $c->validate( { name => 'Steve', instrument => 'banjo } );
Returns true if the item meets the constraint, false if not.
SEE ALSO
REST::Neo4p, REST::Neo4p::Node, REST::Neo4p::Relationship, REST::Neo4p::Constraint, REST::Neo4p::Constraint::Relationship, REST::Neo4p::Constraint::RelationshipType.
AUTHOR
Mark A. Jensen CPAN ID: MAJENSEN majensen -at- cpan -dot- org
LICENSE
Copyright (c) 2012-2022 Mark A. Jensen. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install REST::Neo4p, copy and paste the appropriate command in to your terminal.
cpanm REST::Neo4p
perl -MCPAN -e shell install REST::Neo4p
For more information on module installation, please visit the detailed CPAN module installation guide.