Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.Relationship


    return relationship;
  }

  private PropertyContainer createRelationshipWithEntity(AssociationKey associationKey, RowKey rowKey, Node node) {
    Node ownerNode = neo4jCRUD.findNode( associationKey.getEntityKey(), ENTITY );
    Relationship relationship = ownerNode.createRelationshipTo( node, relationshipType( associationKey ) );
    applyColumnValues( rowKey, relationship );
    return relationship;
  }
View Full Code Here


      break;
    }
  }

  private void putAssociationOperation(AssociationKey associationKey, AssociationOperation action) {
    Relationship relationship = neo4jCRUD.findRelationship( associationKey, action.getKey() );
    if ( relationship != null ) {
      applyTupleOperations( relationship, action.getValue().getOperations() );
    }
  }
View Full Code Here

    query.append( " - " );
    query.append( relationshipCypher( associationKey, rowKey, parameters, entityKey.getColumnNames().length ) );
    query.append( " - () RETURN r" );
    ExecutionResult result = engine.execute( query.toString(), parameters );
    ResourceIterator<Relationship> column = result.columnAs( "r" );
    Relationship relationship = null;
    if ( column.hasNext() ) {
      relationship = column.next();
    }
    column.close();
    return relationship;
View Full Code Here

        UniqueFactory<Relationship> factory = new UniqueFactory.UniqueRelationshipFactory(graph, PROP_INDEX_REL) {

            @Override
            protected Relationship create(Map<String, Object> properties) {
                Relationship rel = source.createRelationshipTo(target, type);
                rel.setProperty(PROP_ID, properties.get(PROP_ID));
                return rel;
            }

            @Override
            protected void initialize(Relationship rel, Map<String, Object> properties) {
                rel.setProperty(PROP_CREATED, System.currentTimeMillis());
            }
        };
        return factory.getOrCreate(PROP_ID, key);
    }
View Full Code Here

    }
  }

  private void putAssociationOperation(AssociationKey associationKey, AssociationOperation action) {
    RowKey rowKey = action.getKey();
    Relationship relationship = createRelationshipUnlessExists( findNode( associationKey.getEntityKey() ), associationKey, rowKey );
    applyTupleOperations( relationship.getEndNode(), action.getValue().getOperations() );
  }
View Full Code Here

    Relationship relationship = createRelationshipUnlessExists( findNode( associationKey.getEntityKey() ), associationKey, rowKey );
    applyTupleOperations( relationship.getEndNode(), action.getValue().getOperations() );
  }

  private Relationship createRelationshipUnlessExists(Node startNode, AssociationKey associationKey, RowKey rowKey) {
    Relationship relationship = indexer.findRelationship( relationshipType( associationKey ), rowKey );
    if ( relationship == null ) {
      return createRelationship( startNode, associationKey, rowKey );
    }
    return relationship;
  }
View Full Code Here

    return indexer.findNode( entityKey );
  }

  private void removeAssociationOperation(AssociationKey associationKey, AssociationOperation action) {
    RowKey rowKey = action.getKey();
    Relationship relationship = indexer.findRelationship( relationshipType( associationKey ), rowKey );
    removeRelationship( relationship );
  }
View Full Code Here

    indexer.remove( entityNode );
    entityNode.delete();
  }

  private Relationship createRelationship(Node startNode, AssociationKey associationKey, RowKey rowKey) {
    Relationship relationship = startNode.createRelationshipTo( provider.createNode(), relationshipType( associationKey ) );
    for ( int i = 0; i < rowKey.getColumnNames().length; i++ ) {
      Object value = rowKey.getColumnValues()[i];
      if ( value != null ) {
        relationship.setProperty( rowKey.getColumnNames()[i], value );
      }
    }
    indexer.index( relationship );
    return relationship;
  }
View Full Code Here

  }

  private Relationship createRelationshipWithEmbeddedNode(AssociationKey associationKey, Tuple associationRow, AssociatedEntityKeyMetadata associatedEntityKeyMetadata) {
    EntityKey entityKey = getEntityKey( associationRow, associatedEntityKeyMetadata );
    Node embeddedNode = entityQueries.get( entityKey.getMetadata() ).createEmbedded( executionEngine, entityKey.getColumnValues() );
    Relationship relationship = createRelationshipWithTargetNode( associationKey, associationRow, embeddedNode );
    applyProperties( associationKey, associationRow, relationship );
    return relationship;
  }
View Full Code Here

  }

  private Relationship createRelationshipWithTargetNode(AssociationKey associationKey, Tuple associationRow, Node targetNode) {
    EntityKey entityKey = associationKey.getEntityKey();
    Node ownerNode = entityQueries.get( entityKey.getMetadata() ).findEntity( executionEngine, entityKey.getColumnValues() );
    Relationship relationship = ownerNode.createRelationshipTo( targetNode, withName( associationKey.getMetadata().getCollectionRole() ) );
    applyProperties( associationKey, associationRow, relationship );
    return relationship;
  }
View Full Code Here

TOP

Related Classes of org.neo4j.graphdb.Relationship

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.