示例#1
0
  private void findAndCreateSuggestions(final Node node) {
    if (!node.hasRelationship(ConnectionType.KNOWS)) {
      return;
    }

    final Traverser traverser = friendToSuggestionTraversalDescription().traverse(node);
    for (final Node suggestionNode : traverser.nodes()) {
      if (!this.isSuggestionRelationshipPresent(node, suggestionNode)) {
        node.createRelationshipTo(suggestionNode, ConnectionType.SUGGESTED);
        if (logger.isInfoEnabled()) {
          logger.info(
              "New Suggestion Between {} and {}",
              node.getPropertyValues(),
              suggestionNode.getPropertyValues());
        }
      }
    }
  }
  @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));
  }