[Neo4j] SpringDataNeo4j 2.0 & Supernode navigation

2012-01-12 Thread Agelos Pikoulas
Hello everyone, just watched Michael Hunger on the Spring Data Neo4j
webinar - thanks Michael.

Now to the question, its an old problem - the "supernode" relationship
navigation:

Assume a *Movie *node has N.000.000 incoming *LIKES *from *User *nodes, but
only a few incoming *ACTS_IN *from *Actor* nodes.

How would we navigate in SDN from *Movie *onto these *ACTS_IN *relationships
& *Actor *nodes via an indexed relationship (eg
IndexedRelationShipExpander), without stumping onto those 1M *LIKES
*relationships
that will put a huge delay on us ?

Regards

Agelos
___
NOTICE: THIS MAILING LIST IS BEING SWITCHED TO GOOGLE GROUPS, please register 
and consider posting at https://groups.google.com/forum/#!forum/neo4j

Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Copy all the Relationships to another Node

2012-01-12 Thread Mattias Persson
A straightforward:

  Node target = db.createNode();
  copyProperties( source, target );
  for ( Relationship sourceRel : source.getRelationships() ) {
  Relationship targetRel = source.equals( sourceRel.getStartNode() ) ?
  target.createRelationshipTo( sourceRel.getEndNode(),
sourceRel.getType() ) :
  sourceRel.getEndNode().createRelationshipTo( target,
sourceRel.getType() );
  copyProperties( sourceRel, targetRel );
  sourceRel.delete();
  }
  source.delete();
...
  private static void copyProperties( PropertyContainer source,
PropertyContainer target ) {
  for ( String key : source.getPropertyKeys() )
  target.setProperty( key, source.getProperty( key ) );
  }

would suffice, I'd guess.

2012/1/12 Emil Dombagolla 

> Hi All,
>
> I am using Java API with neo4j 1.4.2.
>
> I want to copy all the relationships(Income/Outgoing) of a node to another
> node and delete the original node. Can anyone suggest what will be the
> easiest way.
>
> Emil Dombagolla,
> Thank you so much.
> ___
> NOTICE: THIS MAILING LIST IS BEING SWITCHED TO GOOGLE GROUPS, please
> register and consider posting at
> https://groups.google.com/forum/#!forum/neo4j
>
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
NOTICE: THIS MAILING LIST IS BEING SWITCHED TO GOOGLE GROUPS, please register 
and consider posting at https://groups.google.com/forum/#!forum/neo4j

Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user