本文整理了Java中org.neo4j.graphdb.Relationship.getStartNode
方法的一些代码示例,展示了Relationship.getStartNode
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Relationship.getStartNode
方法的具体详情如下:
包路径:org.neo4j.graphdb.Relationship
类名称:Relationship
方法名:getStartNode
[英]Returns the start node of this relationship. For a definition of how start node relates to Direction as arguments to the Node#getRelationships() in Node, see the class documentation of Relationship.
[中]返回此关系的开始节点。有关开始节点如何作为节点中节点#getRelationships()的参数与方向关联的定义,请参阅Relationship的类文档。
代码示例来源:origin: neo4j/neo4j
static boolean matchDirection( Direction dir, Node start, Relationship rel )
{
switch ( dir )
{
case INCOMING:
return rel.getEndNode().equals( start );
case OUTGOING:
return rel.getStartNode().equals( start );
case BOTH:
return true;
default:
throw new IllegalArgumentException( "Unknown direction: " + dir );
}
}
代码示例来源:origin: neo4j/neo4j
private static String relToString( Relationship rel )
{
return rel.getStartNode() + "--" + rel.getType() + "-->"
+ rel.getEndNode();
}
代码示例来源:origin: neo4j/neo4j
private void appendRelationship( PrintWriter out, Relationship rel )
{
out.print( "create (" );
out.print( identifier( rel.getStartNode() ) );
out.print( ")-[:" );
out.print( quote( rel.getType().name() ) );
formatProperties( out, rel );
out.print( "]->(" );
out.print( identifier( rel.getEndNode() ) );
out.println( ")" );
}
代码示例来源:origin: neo4j/neo4j
private boolean isLoop( Relationship r )
{
return r.getStartNode().equals( r.getEndNode() );
}
代码示例来源:origin: neo4j/neo4j
startNode = endNode;
endNode = nodeIterator.next();
if ( rel.getStartNode().equals(startNode) && rel.getEndNode().equals(endNode) )
代码示例来源:origin: neo4j/neo4j
public void add( Relationship rel )
{
final long id = rel.getId();
if ( !relationships.containsKey( id ) )
{
addRel( id, rel );
add( rel.getStartNode() );
add( rel.getEndNode() );
}
}
代码示例来源:origin: neo4j/neo4j
nodes.add( relationship.getStartNode() );
nodes.add( relationship.getEndNode() );
代码示例来源:origin: neo4j/neo4j
private static Relationship createRelationship( long startNodeId, long endNodeId )
{
Relationship relationship = mock( Relationship.class );
Node startNode = createNode( startNodeId );
Node endNode = createNode( endNodeId );
when( relationship.getStartNode() ).thenReturn( startNode );
when( relationship.getEndNode() ).thenReturn( endNode );
return relationship;
}
代码示例来源:origin: neo4j/neo4j
private static Relationship mockRelationship( long id, Node start, String type, Node end, Properties properties )
{
Relationship relationship = mockPropertyContainer( Relationship.class, properties );
when( relationship.getId() ).thenReturn( id );
when( relationship.getStartNode() ).thenReturn( start );
when( relationship.getEndNode() ).thenReturn( end );
when( relationship.getType() ).thenReturn( RelationshipType.withName( type ) );
return relationship;
}
代码示例来源:origin: neo4j/neo4j
RelationshipData( Relationship relationship )
{
this.startNode = relationship.getStartNode();
this.type = relationship.getType().name();
this.endNode = relationship.getEndNode();
}
}
代码示例来源:origin: neo4j/neo4j
private Runnable getNodesFromRelationship()
{
return () ->
{
relationship.getEndNode();
relationship.getStartNode();
relationship.getNodes();
relationship.getOtherNode( node );
};
}
代码示例来源:origin: neo4j/neo4j
Integer i1 = nodeIndexes.get( relationship.getStartNode() );
Integer i2 = nodeIndexes.get( relationship.getEndNode() );
if ( i1 == null || i2 == null )
代码示例来源:origin: neo4j/neo4j
@Override
public String represent( Relationship item )
{
return nodes.represent( item.getStartNode() ) + " "
+ rel.represent( item ) + " "
+ nodes.represent( item.getEndNode() );
}
}
代码示例来源:origin: neo4j/neo4j
@Override
public String represent( Relationship item )
{
return nodes.represent( item.getStartNode() ) + " "
+ rel.represent( item ) + " "
+ nodes.represent( item.getEndNode() );
}
}
代码示例来源:origin: neo4j/neo4j
out.writeStringField( "startNode", Long.toString( relationship.getStartNode().getId() ) );
out.writeStringField( "endNode", Long.toString( relationship.getEndNode().getId() ) );
writeProperties( out, relationship );
代码示例来源:origin: neo4j/neo4j
public static Link link( Relationship relationship, Node node )
{
if ( relationship.getStartNode().getId() == node.getId() )
{
return new Link( node, relationship );
}
if ( relationship.getEndNode().getId() == node.getId() )
{
return new Link( relationship, node );
}
throw illegalArgument( "%s is neither the start node nor the end node of %s", node, relationship );
}
代码示例来源:origin: neo4j/neo4j
public Node checkNode( Node node )
{
if ( isStartNode )
{
if ( node.getId() != relationship.getEndNode().getId() )
{
throw illegalArgument( "%s is not the end node of %s", node, relationship );
}
}
else
{
if ( node.getId() != relationship.getStartNode().getId() )
{
throw illegalArgument( "%s is not the start node of %s", node, relationship );
}
}
return this.node;
}
代码示例来源:origin: neo4j/neo4j
if ( rel.getStartNode().equals( node2 ) && rel.getEndNode().equals( node2 ) )
else if ( rel.getStartNode().equals( node2 ) )
if ( rel.getStartNode().equals( node2 ) && rel.getEndNode().equals( node2 ) )
else if ( rel.getStartNode().equals( node2 ) )
if ( rel.getStartNode().equals( node2 ) && rel.getEndNode().equals( node2 ) )
代码示例来源:origin: neo4j/neo4j
@Test
public void shouldMapDirectRelationship()
{
// Given
Node start, end;
Relationship relationship;
try ( Transaction tx = db.beginTx() )
{
start = db.createNode();
end = db.createNode();
relationship = start.createRelationshipTo( end, RelationshipType.withName( "R" ) );
tx.success();
}
RelationshipValue relationshipValue =
VirtualValues.relationshipValue( relationship.getId(), nodeValue( start.getId(),
Values.EMPTY_TEXT_ARRAY, EMPTY_MAP ), nodeValue( start.getId(),
Values.EMPTY_TEXT_ARRAY, EMPTY_MAP ), stringValue( "R" ), EMPTY_MAP );
// When
Relationship coreAPIRelationship = mapper.mapRelationship( relationshipValue );
// Then
try ( Transaction ignore = db.beginTx() )
{
assertThat( coreAPIRelationship.getId(), equalTo( relationship.getId() ) );
assertThat( coreAPIRelationship.getStartNode(), equalTo( start ) );
assertThat( coreAPIRelationship.getEndNode(), equalTo( end ) );
}
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
public WeightedRelationshipResult(Relationship rel, double weight) {
this.rel = rel;
this.weight = weight;
this.start = rel.getStartNode();
this.end = rel.getEndNode();
}
}
内容来源于网络,如有侵权,请联系作者删除!