The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

REST::Neo4p::Constraint::Relationship - Neo4j Relationship Constraints

SYNOPSIS

 # use REST::Neo4p::Constrain, it's nicer

 $rc = REST::Neo4p::Constraint::Relationship->new(
   'allowed_contains_relns' => 
     { _condition => 'only',
       _relationship_type => 'contains',
       _priority => 0,
       _descriptors  => [ {'module' => 'method'},
                          {'module' => 'variable'},
                          {'method' => 'variable'} ] }
   );

DESCRIPTION

REST::Neo4p::Constraint::Relationship is a class that represents constraints on the type and direction of relationships between nodes that satisfy given sets of property constraints.

Constraint hash specification:

   { 
     _condition => <'only'|'none'>,
     _relationship_type => <relationship_typename>,
     _priority => <integer priority>,
     _descriptors => [{ property_constraint_tag => 
                        property_constraint_tag },...] }
   }

METHODS

new()
 $rc = $REST::Neo4p::Constraint::Relationship->new(
        $tag => $constraint_hash
      );
add_constraint()
 $rc->add_constraint( { 'star' => 'planet' });
remove_constraint()
 $rc->remove_constraint( { 'developer' => 'parole_officer' } );
tag()

Returns the constraint tag.

type()

Returns the constraint type ('relationship').

rtype()

The relationship type to which this constraint applies.

constraints()

Returns the internal constraint spec hashref.

priority()
set_priority()

Constraints with higher priority will be checked before constraints with lower priority by validate_relationship().

condition()
set_condition()
 $r->set_condition('only');

Get/set 'only' or 'none' for a given relationship constraint. See REST::Neo4p::Constrain.

validate()
 $c->validate( $relationship_object );
 $c->validate( $node_object1 => $node_object2, 
                         $reln_type );
 $c->validate( { name => 'Steve', instrument => 'banjo' } =>
               { name => 'Marcia', instrument => 'blunt' },
                 'avoids' );

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-2013 Mark A. Jensen. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.