REST::Neo4p::Constraint::Property - Neo4j Property Constraints
# 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]+/ } );
REST::Neo4p::Constraint::NodeProperty and REST::Neo4p::Constraint::RelationshipProperty are classes that represent constraints on the presence and values of Node and Relationship entities.
REST::Neo4p::Constraint::NodeProperty
REST::Neo4p::Constraint::RelationshipProperty
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 }
$np = REST::Neo4p::Constraint::NodeProperty->new( $tag => $constraint_hash ); $rp = REST::Neo4p::Constraint::RelationshipProperty->new( $tag => $constraint_hash );
$np->add_constraint( optional_accessory => [qw(tie ascot boutonniere)] );
$np->remove_constraint( 'unneeded_property' );
Returns the constraint tag.
Returns the constraint type ('node_property' or 'relationship_property').
Set/get 'all', 'only', 'none' for a given property constraint. See REST::Neo4p::Constrain.
Constraints with higher priority will be checked before constraints with lower priority by validate_properties().
validate_properties()
Returns the internal constraint spec hashref.
$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.
REST::Neo4p, REST::Neo4p::Node, REST::Neo4p::Relationship, REST::Neo4p::Constraint, REST::Neo4p::Constraint::Relationship, REST::Neo4p::Constraint::RelationshipType.
Mark A. Jensen CPAN ID: MAJENSEN majensen -at- cpan -dot- org
Copyright (c) 2012-2014 Mark A. Jensen. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install REST::Neo4p, copy and paste the appropriate command in to your terminal.
cpanm
cpanm REST::Neo4p
CPAN shell
perl -MCPAN -e shell install REST::Neo4p
For more information on module installation, please visit the detailed CPAN module installation guide.