Use this mixin to wrap Neo4j Relationship Java object. This mixin is similar to Neo4j::NodeMixin which wraps Neo4j::Node Java objects.
relationships can also be indexed just like nodes
*
for declaration for keeping lucene index and neo4j property in sync
for declaration of convenience accessors of property
# File lib/neo4j/relationship_mixin/relationship_mixin.rb, line 62 def _java_entity @_java_rel end
Returns the org.neo4j.graphdb.Relationship wrapped object
# File lib/neo4j/relationship_mixin/relationship_mixin.rb, line 58 def _java_rel @_java_rel end
Deletes this relationship
# File lib/neo4j/relationship_mixin/relationship_mixin.rb, line 79 def del delete end
Returns the end node of this relationship
# File lib/neo4j/relationship_mixin/relationship_mixin.rb, line 67 def end_node id = getEndNode.getId Neo4j::Node.load(id) end
# File lib/neo4j/relationship_mixin/relationship_mixin.rb, line 83 def exist? Neo4j::Relationship.exist?(self) end
A convenience operation that, given a node that is attached to this relationship, returns the other node. For example if node is a start node, the end node will be returned, and vice versa. This is a very convenient operation when you’re manually traversing the node space by invoking one of the rels operations on node.
This operation will throw a runtime exception if node is neither this relationship’s start node nor its end node.
For example, to get the node “at the other end” of a relationship, use the following:
Node endNode = node.rel(:some_rel_type).other_node(node)
# File lib/neo4j/relationship_mixin/relationship_mixin.rb, line 97 def other_node(node) neo_node = node.respond_to?(:_java_node)? node._java_node : node id = getOtherNode(neo_node).getId Neo4j::Node.load(id) end
Returns the neo relationship type that this relationship is used in. (see java API org.neo4j.graphdb.Relationship#getType and org.neo4j.graphdb.RelationshipType)
the relationship type (of type Symbol)
# File lib/neo4j/relationship_mixin/relationship_mixin.rb, line 110 def relationship_type @_java_rel.getType.name.to_sym end
Returns the start node of this relationship
# File lib/neo4j/relationship_mixin/relationship_mixin.rb, line 73 def start_node id = getStartNode.getId Neo4j::Node.load(id) end