本文整理了Java中org.neo4j.internal.kernel.api.Write.graphRemoveProperty()
方法的一些代码示例,展示了Write.graphRemoveProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Write.graphRemoveProperty()
方法的具体详情如下:
包路径:org.neo4j.internal.kernel.api.Write
类名称:Write
方法名:graphRemoveProperty
[英]Remove a property from the graph
[中]从图形中删除属性
代码示例来源:origin: neo4j/neo4j
@Override
public Object removeProperty( String key )
{
KernelTransaction transaction = safeAcquireTransaction();
int propertyKeyId;
try
{
propertyKeyId = transaction.tokenWrite().propertyKeyGetOrCreateForName( key );
}
catch ( IllegalTokenNameException e )
{
throw new IllegalArgumentException( format( "Invalid property key '%s'.", key ), e );
}
try ( Statement ignore = transaction.acquireStatement() )
{
return transaction.dataWrite().graphRemoveProperty( propertyKeyId ).asObjectCopy();
}
catch ( InvalidTransactionTypeKernelException e )
{
throw new ConstraintViolationException( e.getMessage(), e );
}
}
代码示例来源:origin: neo4j/neo4j
@Test
public void shouldNotSeeRemovedGraphPropertyInTransaction() throws Exception
{
int prop;
try ( Transaction tx = beginTransaction() )
{
prop = tx.tokenWrite().propertyKeyGetOrCreateForName( "prop" );
assertThat( tx.dataWrite().graphSetProperty( prop, stringValue( "hello" ) ), equalTo( NO_VALUE ) );
tx.success();
}
try ( Transaction tx = beginTransaction();
PropertyCursor cursor = tx.cursors().allocatePropertyCursor() )
{
assertThat( tx.dataWrite().graphRemoveProperty( prop ), equalTo( stringValue( "hello" ) ) );
tx.dataRead().graphProperties( cursor );
assertFalse( cursor.next() );
}
}
代码示例来源:origin: neo4j/neo4j
@Test
public void shouldBeAbleToRemoveExistingGraphProperty() throws Exception
{
int prop;
try ( Transaction tx = beginTransaction() )
{
prop = tx.tokenWrite().propertyKeyGetOrCreateForName( "prop" );
assertThat( tx.dataWrite().graphSetProperty( prop, stringValue( "hello" ) ), equalTo( NO_VALUE ) );
tx.success();
}
try ( Transaction tx = beginTransaction() )
{
assertThat( tx.dataWrite().graphRemoveProperty( prop ), equalTo( stringValue("hello") ) );
tx.success();
}
try ( org.neo4j.graphdb.Transaction ignore = graphDb.beginTx() )
{
assertFalse( testSupport.graphProperties().hasProperty( "prop" ) );
}
}
代码示例来源:origin: org.neo4j/neo4j-kernel
@Override
public Object removeProperty( String key )
{
KernelTransaction transaction = safeAcquireTransaction();
int propertyKeyId;
try
{
propertyKeyId = transaction.tokenWrite().propertyKeyGetOrCreateForName( key );
}
catch ( IllegalTokenNameException e )
{
throw new IllegalArgumentException( format( "Invalid property key '%s'.", key ), e );
}
try ( Statement ignore = transaction.acquireStatement() )
{
return transaction.dataWrite().graphRemoveProperty( propertyKeyId ).asObjectCopy();
}
catch ( InvalidTransactionTypeKernelException e )
{
throw new ConstraintViolationException( e.getMessage(), e );
}
}
内容来源于网络,如有侵权,请联系作者删除!