本文整理了Java中org.neo4j.graphdb.Relationship.getType
方法的一些代码示例,展示了Relationship.getType
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Relationship.getType
方法的具体详情如下:
包路径:org.neo4j.graphdb.Relationship
类名称:Relationship
方法名:getType
[英]Returns the type of this relationship. A relationship's type is an immutable attribute that is specified at Relationship Node#createRelationshipTo. Remember that relationship types are semantically equivalent if their RelationshipType#name() are Object#equals(Object). This is NOT the same as checking for identity equality using the == operator. If you want to know whether this relationship is of a certain type, use the #isType(RelationshipType)operation.
[中]返回此关系的类型。关系的类型是在关系节点#createRelationshipTo指定的不可变属性。记住,如果关系类型的RelationshipType#name()是Object#equals(Object),那么它们在语义上是等价的。这与使用==运算符检查标识相等不同。如果想知道此关系是否属于某种类型,请使用#isType(RelationshipType)操作。
代码示例来源:origin: neo4j/neo4j
@Mapping( "type" )
public ValueRepresentation getType()
{
return ValueRepresentation.relationshipType( rel.getType() );
}
代码示例来源: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
@Override
public TextValue type()
{
TextValue t = type;
if ( t == null )
{
synchronized ( this )
{
t = type;
if ( t == null )
{
t = type = Values.stringValue( relationship.getType().name() );
}
}
}
return t;
}
代码示例来源:origin: neo4j/neo4j
@Override
public String relationshipRepresentation( Path path,
Node from, Relationship relationship )
{
String prefix = "-";
String suffix = "-";
if ( from.equals( relationship.getEndNode() ) )
{
prefix = "<-";
}
else
{
suffix = "->";
}
return prefix + "[" + relationship.getType().name() + "," +
relationship.getId() + "]" + suffix;
}
}
代码示例来源:origin: neo4j/neo4j
@Override
ResourceIterator<Relationship> doExpand( Path path, BranchState state )
{
final Node node = path.endNode();
ResourceIterator<Relationship> resourceIterator = asResourceIterator( node.getRelationships().iterator() );
return newResourceIterator( new FilteringIterator<>( resourceIterator, rel ->
{
Exclusion exclude = exclusion.get( rel.getType().name() );
exclude = (exclude == null) ? defaultExclusion : exclude;
return exclude.accept( node, rel );
} ), resourceIterator );
}
代码示例来源: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 void assertRelationshipEquals( InputEntity input, Relationship relationship )
{
// properties
assertPropertiesEquals( input, relationship );
// type
assertEquals( input.stringType, relationship.getType().name() );
}
代码示例来源:origin: neo4j/neo4j
@Mapping( "metadata" )
public MapRepresentation metadata()
{
if ( isDeleted() )
{
return new MapRepresentation( map( "id", rel.getId(), "deleted", Boolean.TRUE ) );
}
else
{
return new MapRepresentation( map( "id", rel.getId(), "type", rel.getType().name() ) );
}
}
代码示例来源:origin: neo4j/neo4j
out.writeStringField( "type", relationship.getType().name() );
out.writeStringField( "startNode", Long.toString( relationship.getStartNode().getId() ) );
out.writeStringField( "endNode", Long.toString( relationship.getEndNode().getId() ) );
代码示例来源:origin: neo4j/neo4j
oldRelationship.getType() );
代码示例来源:origin: neo4j/neo4j
@Graph( value = { "I know you" }, nodes = { @NODE( name = "I", properties = { @PROP( key = "name", value = "me" ) } ) } )
private void verifyIKnowYou( String type, String myName )
{
try ( Transaction ignored = graphdb.beginTx() )
{
Map<String, Node> graph = data.get();
assertEquals( "Wrong graph size.", 2, graph.size() );
Node iNode = graph.get( "I" );
assertNotNull( "The node 'I' was not defined", iNode );
Node you = graph.get( "you" );
assertNotNull( "The node 'you' was not defined", you );
assertEquals( "'I' has wrong 'name'.", myName, iNode.getProperty( "name" ) );
assertEquals( "'you' has wrong 'name'.", "you",
you.getProperty( "name" ) );
Iterator<Relationship> rels = iNode.getRelationships().iterator();
assertTrue( "'I' has too few relationships", rels.hasNext() );
Relationship rel = rels.next();
assertEquals( "'I' is not related to 'you'", you, rel.getOtherNode( iNode ) );
assertEquals( "Wrong relationship type.", type, rel.getType().name() );
assertFalse( "'I' has too many relationships", rels.hasNext() );
rels = you.getRelationships().iterator();
assertTrue( "'you' has too few relationships", rels.hasNext() );
rel = rels.next();
assertEquals( "'you' is not related to 'i'", iNode, rel.getOtherNode( you ) );
assertEquals( "Wrong relationship type.", type, rel.getType().name() );
assertFalse( "'you' has too many relationships", rels.hasNext() );
assertEquals( "wrong direction", iNode, rel.getStartNode() );
}
}
代码示例来源:origin: neo4j/neo4j
String endNodeName = (String) relationship.getEndNode().getProperty( "name" );
Map<String, AtomicInteger> innerInner = inner.get( endNodeName );
String type = relationship.getType().name();
int countAfterwards = innerInner.get( type ).decrementAndGet();
assertThat( countAfterwards, greaterThanOrEqualTo( 0 ) );
代码示例来源:origin: neo4j/neo4j
LinkedList<Relationship> relationships = (LinkedList<Relationship>) next[1];
assertEquals( 1, relationships.size() );
assertEquals( "LIVES_IN", relationships.get( 0 ).getType().name() );
assertThat( relationships.get( 0 ).getStartNode().getLabels(),
contains( equalTo( Label.label( "Person" ) ) ) );
代码示例来源:origin: neo4j/neo4j
relationship.getEndNode(), relationship.getType().name(), properties );
UniqueEntity<Relationship> entity = factory.getOrCreateWithOutcome( key, value );
代码示例来源:origin: neo4j/neo4j
fail( relationship + " didn't have either type, it has " + relationship.getType().name() );
代码示例来源:origin: neo4j/neo4j
rel = firstNode.createRelationshipTo( secondNode, MyRelTypes.TEST );
assertNotNull( "Relationship is null", rel );
RelationshipType relType = rel.getType();
assertNotNull( "Relationship's type is is null", relType );
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
@Test
public void testFilterRelationshipsInclude() throws Exception {
db.execute("CREATE (u:User {name:'Joe',gender:'male'})-[:KNOWS]->(u), (u)-[:LOVES]->(u)").close();
ResourceIterator<Relationship> it = db.execute("CALL apoc.nodes.group(['User'],['gender'],null,{includeRels:'KNOWS'})").columnAs("relationship");
assertEquals("KNOWS",(it.next()).getType().name());
assertFalse(it.hasNext());
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
@Test
public void testFilterRelationshipsExclude() throws Exception {
db.execute("CREATE (u:User {name:'Joe',gender:'male'})-[:KNOWS]->(u), (u)-[:LOVES]->(u)").close();
ResourceIterator<Relationship> it = db.execute("CALL apoc.nodes.group(['User'],['gender'],null,{excludeRels:'LOVES'})").columnAs("relationship");
assertEquals("KNOWS",(it.next()).getType().name());
assertFalse(it.hasNext());
}
内容来源于网络,如有侵权,请联系作者删除!