private boolean matches(Node node, String[] properties, Object[] values) {
   for (int i = 0; i < properties.length; i++) {
     if (node.hasProperty(properties[i]) && !node.getProperty(properties[i]).equals(values[i])) {
       return false;
     } else if (!node.hasProperty(properties[i]) && values[i] != null) {
       return false;
     }
   }
   return true;
 }
  @Test
  public void testAddProperty() {
    String key3 = "key3";

    Node node1 = getGraphDb().getNodeById(node1Id);
    Node node2 = getGraphDb().getNodeById(node2Id);
    Relationship rel = node1.getSingleRelationship(MyRelTypes.TEST, Direction.BOTH);
    // add new property
    node2.setProperty(key3, int1);
    rel.setProperty(key3, int2);
    assertTrue(node1.hasProperty(key1));
    assertTrue(node2.hasProperty(key1));
    assertTrue(node1.hasProperty(key2));
    assertTrue(node2.hasProperty(key2));
    assertTrue(node1.hasProperty(arrayKey));
    assertTrue(node2.hasProperty(arrayKey));
    assertTrue(rel.hasProperty(arrayKey));
    assertTrue(!node1.hasProperty(key3));
    assertTrue(node2.hasProperty(key3));
    assertEquals(int1, node1.getProperty(key1));
    assertEquals(int2, node2.getProperty(key1));
    assertEquals(string1, node1.getProperty(key2));
    assertEquals(string2, node2.getProperty(key2));
    assertEquals(int1, rel.getProperty(key1));
    assertEquals(string1, rel.getProperty(key2));
    assertEquals(int2, rel.getProperty(key3));
  }
  @Test
  public void testNodeGetProperties() {
    Node node1 = getGraphDb().getNodeById(node1Id);

    assertTrue(!node1.hasProperty(null));
    Iterator<Object> values = node1.getPropertyValues().iterator();
    values.next();
    values.next();
    Iterator<String> keys = node1.getPropertyKeys().iterator();
    keys.next();
    keys.next();
    assertTrue(node1.hasProperty(key1));
    assertTrue(node1.hasProperty(key2));
  }
Example #4
0
  @Test
  public void testRemoveUnloadedHeavyProperty() {
    /*
     * Checks a bug where removing non-cached heavy properties
     * would cause NPE in auto indexer.
     */
    graphDb.index().getNodeAutoIndexer().setEnabled(true);
    graphDb.index().getNodeAutoIndexer().startAutoIndexingProperty("nodeProp");

    newTransaction();

    Node node1 = graphDb.createNode();
    // Large array, needed for making sure this is a heavy property
    node1.setProperty("nodeProp", new int[] {-1, 2, 3, 4, 5, 6, 1, 1, 1, 1});

    newTransaction();

    // clear the caches
    NeoStoreXaDataSource dataSource =
        graphDb.getDependencyResolver().resolveDependency(NeoStoreXaDataSource.class);
    dataSource.getNodeCache().clear();
    dataSource.getRelationshipCache().clear();

    node1.removeProperty("nodeProp");
    newTransaction();
    assertFalse(node1.hasProperty("nodeProp"));
  }
 private boolean isNewlyCreatedPageNode(Node node) {
   // Default isolation level is READ_COMMITTED, so the graph keeps keeps
   // write locks on the node until the
   // end of the transaction. Threads reusing a node should never see a
   // half-constructed node.
   return !node.hasProperty(PageNode.DOMAIN_KEY);
 }
 private String getNodeSuperClass(Node n) {
   if (n.hasProperty(Constants.NODE_SUPER_CLASS_KEY)) {
     return (String) n.getProperty(Constants.NODE_SUPER_CLASS_KEY);
   } else {
     return "";
   }
 }
Example #7
0
  @Test
  public void testFloatArray() {
    float[] array1 = new float[] {1.0f, 2.0f, 3.0f, 4.0f, 5.0f};
    Float[] array2 = new Float[] {6.0f, 7.0f, 8.0f};
    String key = "testfloatarray";
    node1.setProperty(key, array1);
    newTransaction();

    clearCache();
    float propertyValue[] = null;
    propertyValue = (float[]) node1.getProperty(key);
    assertEquals(array1.length, propertyValue.length);
    for (int i = 0; i < array1.length; i++) {
      assertEquals(array1[i], propertyValue[i], 0.0);
    }

    node1.setProperty(key, array2);
    newTransaction();

    clearCache();
    propertyValue = (float[]) node1.getProperty(key);
    assertEquals(array2.length, propertyValue.length);
    for (int i = 0; i < array2.length; i++) {
      assertEquals(array2[i], new Float(propertyValue[i]));
    }

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
Example #8
0
  @Test
  public void testStringArray() {
    String[] array1 = new String[] {"a", "b", "c", "d", "e"};
    String[] array2 = new String[] {"ff", "gg", "hh"};
    String key = "teststringarray";
    node1.setProperty(key, array1);
    newTransaction();

    clearCache();
    String propertyValue[] = null;
    propertyValue = (String[]) node1.getProperty(key);
    assertEquals(array1.length, propertyValue.length);
    for (int i = 0; i < array1.length; i++) {
      assertEquals(array1[i], propertyValue[i]);
    }

    node1.setProperty(key, array2);
    newTransaction();

    clearCache();
    propertyValue = (String[]) node1.getProperty(key);
    assertEquals(array2.length, propertyValue.length);
    for (int i = 0; i < array2.length; i++) {
      assertEquals(array2[i], propertyValue[i]);
    }

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
Example #9
0
  @Test
  public void testBooleanType() {
    boolean value = true;
    Boolean bValue = new Boolean(value);
    String key = "testbool";
    node1.setProperty(key, bValue);
    newTransaction();

    clearCache();
    Boolean propertyValue = null;
    propertyValue = (Boolean) node1.getProperty(key);
    assertEquals(bValue, propertyValue);

    bValue = new Boolean(false);
    node1.setProperty(key, bValue);
    newTransaction();

    clearCache();
    propertyValue = (Boolean) node1.getProperty(key);
    assertEquals(bValue, propertyValue);

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
Example #10
0
  @Test
  public void testCharType() {
    char c = 'c';
    Character cValue = new Character(c);
    String key = "testchar";
    node1.setProperty(key, cValue);
    newTransaction();

    clearCache();
    Character propertyValue = null;
    propertyValue = (Character) node1.getProperty(key);
    assertEquals(cValue, propertyValue);

    cValue = new Character('d');
    node1.setProperty(key, cValue);
    newTransaction();

    clearCache();
    propertyValue = (Character) node1.getProperty(key);
    assertEquals(cValue, propertyValue);

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
Example #11
0
  @Test
  public void testShortType() {
    short value = 453;
    Short sValue = new Short(value);
    String key = "testshort";
    node1.setProperty(key, sValue);
    newTransaction();

    clearCache();
    Short propertyValue = null;
    propertyValue = (Short) node1.getProperty(key);
    assertEquals(sValue, propertyValue);

    sValue = new Short((short) 5335);
    node1.setProperty(key, sValue);
    newTransaction();

    clearCache();
    propertyValue = (Short) node1.getProperty(key);
    assertEquals(sValue, propertyValue);

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
Example #12
0
  @Test
  public void testByteType() {
    byte b = (byte) 177;
    Byte bValue = new Byte(b);
    String key = "testbyte";
    node1.setProperty(key, bValue);
    newTransaction();

    clearCache();
    Byte propertyValue = null;
    propertyValue = (Byte) node1.getProperty(key);
    assertEquals(bValue, propertyValue);

    bValue = new Byte((byte) 200);
    node1.setProperty(key, bValue);
    newTransaction();

    clearCache();
    propertyValue = (Byte) node1.getProperty(key);
    assertEquals(bValue, propertyValue);

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
Example #13
0
  @Test
  public void testIntArray() {
    int[] array1 = new int[] {1, 2, 3, 4, 5};
    Integer[] array2 = new Integer[] {6, 7, 8};
    String key = "testintarray";
    node1.setProperty(key, array1);
    newTransaction();

    clearCache();
    int propertyValue[] = null;
    propertyValue = (int[]) node1.getProperty(key);
    assertEquals(array1.length, propertyValue.length);
    for (int i = 0; i < array1.length; i++) {
      assertEquals(array1[i], propertyValue[i]);
    }

    node1.setProperty(key, array2);
    newTransaction();

    clearCache();
    propertyValue = (int[]) node1.getProperty(key);
    assertEquals(array2.length, propertyValue.length);
    for (int i = 0; i < array2.length; i++) {
      assertEquals(array2[i], new Integer(propertyValue[i]));
    }

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
Example #14
0
  @Test
  public void testDoubleArray() {
    double[] array1 = new double[] {1.0, 2.0, 3.0, 4.0, 5.0};
    Double[] array2 = new Double[] {6.0, 7.0, 8.0};
    String key = "testdoublearray";
    node1.setProperty(key, array1);
    newTransaction();

    clearCache();
    double propertyValue[] = null;
    propertyValue = (double[]) node1.getProperty(key);
    assertEquals(array1.length, propertyValue.length);
    for (int i = 0; i < array1.length; i++) {
      assertEquals(array1[i], propertyValue[i], 0.0);
    }

    node1.setProperty(key, array2);
    newTransaction();

    clearCache();
    propertyValue = (double[]) node1.getProperty(key);
    assertEquals(array2.length, propertyValue.length);
    for (int i = 0; i < array2.length; i++) {
      assertEquals(array2[i], new Double(propertyValue[i]));
    }

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
 /*
  * It will remove a property from an embedded node if it exists.
  * After deleting the property, if the node does not have any more properties and relationships (except for an incoming one),
  * it will delete the embedded node as well.
  */
 private void removePropertyForEmbedded(Node embeddedNode, String[] embeddedColumnSplit, int i) {
   if (i == embeddedColumnSplit.length - 1) {
     // Property
     String property = embeddedColumnSplit[embeddedColumnSplit.length - 1];
     if (embeddedNode.hasProperty(property)) {
       embeddedNode.removeProperty(property);
     }
   } else {
     Iterator<Relationship> iterator =
         embeddedNode
             .getRelationships(Direction.OUTGOING, withName(embeddedColumnSplit[i]))
             .iterator();
     if (iterator.hasNext()) {
       removePropertyForEmbedded(iterator.next().getEndNode(), embeddedColumnSplit, i + 1);
     }
   }
   if (!embeddedNode.getPropertyKeys().iterator().hasNext()) {
     // Node without properties
     Iterator<Relationship> iterator = embeddedNode.getRelationships().iterator();
     if (iterator.hasNext()) {
       Relationship relationship = iterator.next();
       if (!iterator.hasNext()) {
         // Node with only one relationship and no properties,
         // we can remove it:
         // It means we have removed all the properties from the embedded node
         // and it is NOT an intermediate node like
         // (entity) --> (embedded1) --> (embedded2)
         relationship.delete();
         embeddedNode.delete();
       }
     }
   }
 }
Example #16
0
  @Test
  public void testLongArray() {
    long[] array1 = new long[] {1, 2, 3, 4, 5};
    Long[] array2 = new Long[] {6l, 7l, 8l};
    String key = "testlongarray";
    node1.setProperty(key, array1);
    newTransaction();

    clearCache();
    long[] propertyValue = null;
    propertyValue = (long[]) node1.getProperty(key);
    assertEquals(array1.length, propertyValue.length);
    for (int i = 0; i < array1.length; i++) {
      assertEquals(array1[i], propertyValue[i]);
    }

    node1.setProperty(key, array2);
    newTransaction();

    clearCache();
    propertyValue = (long[]) node1.getProperty(key);
    assertEquals(array2.length, propertyValue.length);
    for (int i = 0; i < array2.length; i++) {
      assertEquals(array2[i], new Long(propertyValue[i]));
    }

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
Example #17
0
  @Test
  public void testFloatType() {
    Float fValue = new Float(45.678f);
    String key = "testfloat";
    node1.setProperty(key, fValue);
    newTransaction();

    clearCache();
    Float propertyValue = null;
    propertyValue = (Float) node1.getProperty(key);
    assertEquals(fValue, propertyValue);

    fValue = new Float(5684.3243f);
    node1.setProperty(key, fValue);
    newTransaction();

    clearCache();
    propertyValue = (Float) node1.getProperty(key);
    assertEquals(fValue, propertyValue);

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
  private void removeTupleOperation(
      EntityKey entityKey,
      Node node,
      TupleOperation operation,
      TupleContext tupleContext,
      Set<String> processedAssociationRoles) {
    if (!tupleContext.getTupleTypeContext().isPartOfAssociation(operation.getColumn())) {
      if (isPartOfRegularEmbedded(entityKey.getColumnNames(), operation.getColumn())) {
        // Embedded node
        String[] split = split(operation.getColumn());
        removePropertyForEmbedded(node, split, 0);
      } else if (node.hasProperty(operation.getColumn())) {
        node.removeProperty(operation.getColumn());
      }
    }
    // if the column represents a to-one association, remove the relationship
    else {
      String associationRole = tupleContext.getTupleTypeContext().getRole(operation.getColumn());
      if (!processedAssociationRoles.contains(associationRole)) {

        Iterator<Relationship> relationships =
            node.getRelationships(withName(associationRole)).iterator();

        if (relationships.hasNext()) {
          relationships.next().delete();
        }
      }
    }
  }
Example #19
0
  @Test
  public void testLongType() {
    long time = System.currentTimeMillis();
    Long lValue = new Long(time);
    String key = "testlong";
    node1.setProperty(key, lValue);
    newTransaction();

    clearCache();
    Long propertyValue = null;
    propertyValue = (Long) node1.getProperty(key);
    assertEquals(lValue, propertyValue);

    lValue = new Long(System.currentTimeMillis());
    node1.setProperty(key, lValue);
    newTransaction();

    clearCache();
    propertyValue = (Long) node1.getProperty(key);
    assertEquals(lValue, propertyValue);

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));

    node1.setProperty("other", 123L);
    assertEquals(123L, node1.getProperty("other"));
    newTransaction();
    clearCache();
    assertEquals(123L, node1.getProperty("other"));
  }
Example #20
0
  @Test
  public void testByteArray() {
    byte[] array1 = new byte[] {1, 2, 3, 4, 5};
    Byte[] array2 = new Byte[] {6, 7, 8};
    String key = "testbytearray";
    node1.setProperty(key, array1);
    newTransaction();

    clearCache();
    byte[] propertyValue = null;
    propertyValue = (byte[]) node1.getProperty(key);
    assertEquals(array1.length, propertyValue.length);
    for (int i = 0; i < array1.length; i++) {
      assertEquals(array1[i], propertyValue[i]);
    }

    node1.setProperty(key, array2);
    newTransaction();

    clearCache();
    propertyValue = (byte[]) node1.getProperty(key);
    assertEquals(array2.length, propertyValue.length);
    for (int i = 0; i < array2.length; i++) {
      assertEquals(array2[i], new Byte(propertyValue[i]));
    }

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
Example #21
0
  @Test
  public void testCharArray() {
    char[] array1 = new char[] {'1', '2', '3', '4', '5'};
    Character[] array2 = new Character[] {'6', '7', '8'};
    String key = "testchararray";
    node1.setProperty(key, array1);
    newTransaction();

    clearCache();
    char[] propertyValue = null;
    propertyValue = (char[]) node1.getProperty(key);
    assertEquals(array1.length, propertyValue.length);
    for (int i = 0; i < array1.length; i++) {
      assertEquals(array1[i], propertyValue[i]);
    }

    node1.setProperty(key, array2);
    newTransaction();

    clearCache();
    propertyValue = (char[]) node1.getProperty(key);
    assertEquals(array2.length, propertyValue.length);
    for (int i = 0; i < array2.length; i++) {
      assertEquals(array2[i], new Character(propertyValue[i]));
    }

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
Example #22
0
  @Test
  public void testIntType() {
    int time = (int) System.currentTimeMillis();
    Integer iValue = new Integer(time);
    String key = "testing";
    node1.setProperty(key, iValue);
    newTransaction();

    clearCache();
    Integer propertyValue = null;
    propertyValue = (Integer) node1.getProperty(key);
    assertEquals(iValue, propertyValue);

    iValue = new Integer((int) System.currentTimeMillis());
    node1.setProperty(key, iValue);
    newTransaction();

    clearCache();
    propertyValue = (Integer) node1.getProperty(key);
    assertEquals(iValue, propertyValue);

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));

    node1.setProperty("other", 123L);
    assertEquals(123L, node1.getProperty("other"));
    newTransaction();
    clearCache();
    assertEquals(123L, node1.getProperty("other"));
  }
  /**
   * Removes all nodes with non-valid resource classes from the graph.
   *
   * @param docGraph
   * @param validResourceClasses
   */
  private void preProcessGraph(DocGraph docGraph, Set<String> validResourceClasses) {
    log.info(String.format("Preprocessing DocGraph[%d]", docGraph.getId()));
    Node n;
    int cnt = 0;
    try (Transaction tx = graphDB.beginTx()) {
      for (Long nodeId : docGraph.getNodes()) {
        n = graphDB.getNodeById(nodeId);
        // node's class is resource class and it's not in the valid set
        if (n.hasProperty(Constants.NODE_SUPER_CLASS_KEY)
            && n.getProperty(Constants.NODE_SUPER_CLASS_KEY)
                .equals(Constants.NODE_SUPER_CLASS_RESOURCE_VALUE)
            && !validResourceClasses.contains(getNodeClass(n))) {
          try (Transaction innerTx = graphDB.beginTx()) {

            log.info("Deleting " + n);
            for (Relationship e : n.getRelationships()) {
              e.delete();
            }
            n.delete();
            innerTx.success();
            cnt++;
          }
        }
      }
      tx.success();
    }

    log.info(
        String.format("Preprocessing removed %d nodes from DocGraph[%d]", cnt, docGraph.getId()));
  }
Example #24
0
  @Test
  public void testBooleanArray() {
    boolean[] array1 = new boolean[] {true, false, true, false, true};
    Boolean[] array2 = new Boolean[] {false, true, false};
    String key = "testboolarray";
    node1.setProperty(key, array1);
    newTransaction();

    clearCache();
    boolean propertyValue[] = null;
    propertyValue = (boolean[]) node1.getProperty(key);
    assertEquals(array1.length, propertyValue.length);
    for (int i = 0; i < array1.length; i++) {
      assertEquals(array1[i], propertyValue[i]);
    }

    node1.setProperty(key, array2);
    newTransaction();

    clearCache();
    propertyValue = (boolean[]) node1.getProperty(key);
    assertEquals(array2.length, propertyValue.length);
    for (int i = 0; i < array2.length; i++) {
      assertEquals(array2[i], new Boolean(propertyValue[i]));
    }

    node1.removeProperty(key);
    newTransaction();

    clearCache();
    assertTrue(!node1.hasProperty(key));
  }
  @Test
  public void testTxCacheLoadIsolation() throws Exception {
    Node node = getGraphDb().createNode();
    node.setProperty("someproptest", "testing");
    Node node1 = getGraphDb().createNode();
    node1.setProperty("someotherproptest", 2);
    commit();
    EmbeddedGraphDatabase graphDb = (EmbeddedGraphDatabase) getGraphDb();
    TransactionManager txManager = graphDb.getConfig().getTxModule().getTxManager();
    NodeManager nodeManager = graphDb.getConfig().getGraphDbModule().getNodeManager();

    txManager.begin();
    node.setProperty("someotherproptest", "testing2");
    Relationship rel = node.createRelationshipTo(node1, MyRelTypes.TEST);
    javax.transaction.Transaction txA = txManager.suspend();
    txManager.begin();
    assertEquals("testing", node.getProperty("someproptest"));
    assertTrue(!node.hasProperty("someotherproptest"));
    assertTrue(!node.hasRelationship());
    nodeManager.clearCache();
    assertEquals("testing", node.getProperty("someproptest"));
    assertTrue(!node.hasProperty("someotherproptest"));
    javax.transaction.Transaction txB = txManager.suspend();
    txManager.resume(txA);
    assertEquals("testing", node.getProperty("someproptest"));
    assertTrue(node.hasProperty("someotherproptest"));
    assertTrue(node.hasRelationship());
    nodeManager.clearCache();
    assertEquals("testing", node.getProperty("someproptest"));
    assertTrue(node.hasProperty("someotherproptest"));
    assertTrue(node.hasRelationship());
    txManager.suspend();
    txManager.resume(txB);
    assertEquals("testing", node.getProperty("someproptest"));
    assertTrue(!node.hasProperty("someotherproptest"));
    assertTrue(!node.hasRelationship());
    txManager.rollback();
    txManager.resume(txA);
    node.delete();
    node1.delete();
    rel.delete();
    txManager.commit();
    newTransaction();
  }
  protected boolean hasPropertyValue(Node node, PropertyKey propertyKey, Object propertyValue) {

    if (node != null && node.hasProperty(propertyKey.dbName())) {

      Object value = node.getProperty(propertyKey.dbName());
      return value.equals(propertyValue);
    }

    return false;
  }
Example #27
0
  @Override
  public QName getName() {
    if (node.hasProperty(AbstractNode.TYPE_KEY)) {

      String name = (String) node.getProperty(AbstractNode.TYPE_KEY);

      // do some encoding
      //            name = XPathEncoder.encode(name);

      return (new QName(name));
    }

    return (new QName(""));
  }
  /**
   * Called when a relationship of this combinedType is instatiated. Please note that a relationship
   * can (and will) be instantiated several times during a normal rendering turn.
   */
  @Override
  public void onRelationshipInstantiation() {

    try {

      if (dbRelationship != null) {

        Node startNode = dbRelationship.getStartNode();
        Node endNode = dbRelationship.getEndNode();

        if ((startNode != null)
            && (endNode != null)
            && startNode.hasProperty(GraphObject.id.dbName())
            && endNode.hasProperty(GraphObject.id.dbName())) {

          cachedStartNodeId = (String) startNode.getProperty(GraphObject.id.dbName());
          cachedEndNodeId = (String) endNode.getProperty(GraphObject.id.dbName());
        }
      }

    } catch (Throwable t) {
    }
  }
Example #29
0
  /**
   * The index nodes do NOT belong to the domain model, and as such need to use the indexes internal
   * knowledge of the index tree and node structure for decoding the envelope.
   */
  protected Envelope getIndexNodeEnvelope(Node indexNode) {
    if (indexNode == null) {
      indexNode = getIndexRoot();
    }
    try (Transaction tx = database.beginTx()) {
      if (!indexNode.hasProperty(INDEX_PROP_BBOX)) {
        // this is ok after an index node split
        tx.success();
        return null;
      }

      double[] bbox = (double[]) indexNode.getProperty(INDEX_PROP_BBOX);
      tx.success();
      // Envelope parameters: xmin, xmax, ymin, ymax
      return new Envelope(bbox[0], bbox[2], bbox[1], bbox[3]);
    }
  }
  @Test
  public void shouldBeAbleToRemoveNodeProperty() throws Exception {
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put("foo", "bar");
    properties.put("number", 15);
    long nodeId = createNode(properties);
    actions.removeNodeProperty(nodeId, "foo");

    Transaction tx = database.getGraph().beginTx();
    try {
      Node node = database.getGraph().getNodeById(nodeId);
      assertEquals(15, node.getProperty("number"));
      assertEquals(false, node.hasProperty("foo"));
      tx.success();
    } finally {
      tx.finish();
    }
  }