Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.Node


    }

    @Override
    public Movie getExactMovie( final String title )
    {
        Node movieNode = getExactMovieNode( title );
        Movie movie = null;
        if ( movieNode != null )
        {
            movie = new MovieImpl( movieNode );
        }
View Full Code Here


    @Override
    @Transactional
    public void setupReferenceRelationship()
    {
        Node baconNode = getSingleNode( "name", "Bacon, Kevin" );
        if ( baconNode == null )
        {
            throw new NoSuchElementException(
                "Unable to find Kevin Bacon actor" );
        }
        Node referenceNode = graphDbService.getReferenceNode();
        referenceNode.createRelationshipTo( baconNode, RelTypes.IMDB );
    }
View Full Code Here

    }

    @Override
    public List<?> getBaconPath( final Actor actor )
    {
        final Node baconNode;
        if ( actor == null )
        {
            throw new IllegalArgumentException( "Null actor" );
        }
        try
        {
            baconNode = graphDbService.getReferenceNode().getSingleRelationship(
                RelTypes.IMDB, Direction.OUTGOING ).getEndNode();
        }
        catch ( NoSuchElementException e )
        {
            throw new NoSuchElementException(
                "Unable to find Kevin Bacon actor" );
        }
        final Node actorNode = ((ActorImpl) actor).getUnderlyingNode();
        final List<Node> list = pathFinder.shortestPath( actorNode, baconNode,
            RelTypes.ACTS_IN );
        return convertNodesToActorsAndMovies( list );
    }
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 = neo4jCRUD.findNode( key, ENTITY );
    if ( entityNode == null ) {
      return null;
    }
    return createTuple( entityNode );
  }
View Full Code Here

    return createTuple( entityNode );
  }

  @Override
  public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    Node node = neo4jCRUD.createNodeUnlessExists( key, ENTITY );
    GraphLogger.log( "Created node: %1$s", node );
    return createTuple( node );
  }
View Full Code Here

  }

  @Override
  public void updateTuple(Tuple tuple, EntityKey key, TupleContext tupleContext) {
    Neo4jTupleSnapshot snapshot = (Neo4jTupleSnapshot) tuple.getSnapshot();
    Node node = snapshot.getNode();
    applyTupleOperations( node, tuple.getOperations() );
    GraphLogger.log( "Updated node: %1$s", node );
  }
View Full Code Here

        throw new AssertionFailure( "Unrecognized associationKind: " + associationKey.getAssociationKind() );
    }
  }

  private Relationship createRelationshipWithEmbeddedNode(AssociationKey associationKey, RowKey rowKey) {
    Node embeddedNode = neo4jCRUD.createNode( rowKey.getEntityKey(), EMBEDDED );
    Relationship relationship = createRelationshipWithTargetNode( associationKey, rowKey, embeddedNode );
    applyProperties( associationKey, rowKey, relationship );
    return relationship;
  }
View Full Code Here

    Relationship relationship = neo4jCRUD.findRelationship( associationKey, rowKey );
    if ( relationship != null ) {
      return relationship;
    }

    Node targetNode = neo4jCRUD.findNode( targetKey, ENTITY );
    return createRelationshipWithTargetNode( associationKey, rowKey, targetNode );
  }
View Full Code Here

      relationship.setProperty( propertyName, propertyValue );
    }
  }

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

    return relationship;
  }

  @Override
  public Association getAssociation(AssociationKey associationKey, AssociationContext associationContext) {
    Node entityNode = neo4jCRUD.findNode( associationKey.getEntityKey(), ENTITY );
    GraphLogger.log( "Found owner node: %1$s", entityNode );
    if ( entityNode == null ) {
      return null;
    }
    return new Association( new Neo4jAssociationSnapshot( entityNode, associationKey ) );
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.