Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.Node


        if ( relationships.hasNext() ) {
          relationships.next().delete();
        }

        // create a new relationship
        Node targetNode = entityQueries.get( targetKey.getMetadata() ).findEntity( executionEngine, targetKey.getColumnValues() );
        node.createRelationshipTo( targetNode, withName( associationRole ) );
      }
    }
  }
View Full Code Here


  public void forEachTuple(ModelConsumer consumer, EntityKeyMetadata... entityKeyMetadatas) {
    for ( EntityKeyMetadata entityKeyMetadata : entityKeyMetadatas ) {
      ResourceIterator<Node> queryNodes = entityQueries.get( entityKeyMetadata ).findEntities( executionEngine );
      try {
        while ( queryNodes.hasNext() ) {
          Node next = queryNodes.next();
          Tuple tuple = new Tuple( new Neo4jTupleSnapshot( next ) );
          consumer.consume( tuple );
        }
      }
      finally {
View Full Code Here

    throw new UnsupportedOperationException( "LockMode " + lockMode + " is not supported by the Neo4j GridDialect" );
  }

  @Override
  public Tuple getTuple(EntityKey key, TupleContext context) {
    Node entityNode = findNode( key );
    if ( entityNode == null ) {
      return null;
    }
    return createTuple( entityNode );
  }
View Full Code Here

    return new Tuple();
  }

  @Override
  public void updateTuple(Tuple tuple, EntityKey key) {
    Node node = createNodeUnlessExists( key );
    applyTupleOperations( node, tuple.getOperations() );
  }
View Full Code Here

    applyTupleOperations( node, tuple.getOperations() );
  }

  @Override
  public void removeTuple(EntityKey key) {
    Node entityNode = findNode( key );
    if ( entityNode != null ) {
      removeRelationships( entityNode );
      removeNode( entityNode );
    }
  }
View Full Code Here

    return new Tuple();
  }

  @Override
  public Association getAssociation(AssociationKey associationKey, AssociationContext associationContext) {
    Node entityNode = findNode( associationKey.getEntityKey() );
    if ( entityNode == null ) {
      return null;
    }
    return new Association( new Neo4jAssociationSnapshot( entityNode, relationshipType( associationKey ), associationKey ) );
  }
View Full Code Here

  }

  @Override
  public void removeAssociation(AssociationKey key, AssociationContext associationContext) {
    if ( key != null ) {
      Node node = findNode( key.getEntityKey() );
      Iterable<Relationship> relationships = node.getRelationships( Direction.OUTGOING, relationshipType( key ) );
      for ( Relationship rel : relationships ) {
        removeRelationship( rel );
      }
    }
  }
View Full Code Here

  private void putTupleOperation(Node node, TupleOperation operation) {
    node.setProperty( operation.getColumn(), operation.getValue() );
  }

  private Node createNodeUnlessExists(EntityKey key) {
    Node node = findNode( key );
    if ( node == null ) {
      node = createNode( key );
    }
    return node;
  }
View Full Code Here

    }
    return node;
  }

  private Node createNode(EntityKey key) {
    Node node = provider.createNode();
    node.setProperty( TABLE_PROPERTY, key.getTable() );
    for ( int i = 0; i < key.getColumnNames().length; i++ ) {
      node.setProperty( key.getColumnNames()[i], key.getColumnValues()[i] );
    }
    indexer.index( node, key );
    return node;
  }
View Full Code Here

   * @param formatVersion    the format version
   * @param <T>              the type
   * @throws IOException if there is an io problem
   */
  public <T> void serializeWithRelationship( @Nonnull T object, @Nonnull Class<T> type, @Nonnull Node node, @Nonnull RelationshipType relationshipType, @Nonnull Version formatVersion ) throws IOException {
    Node targetNode = node.getGraphDatabase().createNode();
    node.createRelationshipTo( targetNode, relationshipType );
    serialize( object, type, targetNode, formatVersion );
  }
View Full Code Here

TOP

Related Classes of org.neo4j.graphdb.Node

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.