Example #1
0
  /**
   * Returns the fullclubreference of a club given a clubID
   *
   * @param clubID
   * @return
   */
  public String getClubRef(final String clubID) {
    String reference = "";
    final long clubId = Long.parseLong(clubID);

    try (Transaction tx = DataControl_Neo4j_Singleton.getTx()) {
      final Map<String, Object> properties = new HashMap<>();
      properties.put("clubId", clubId);

      final Query query = QueryBuilder.newQuery().match().clubHasId().complete("club AS n");

      final Node node = DataControl_Neo4j_Singleton.getNodeForQuery(query.get(), properties);

      if (node != null) {
        reference = (String) node.getProperty("fullclubref", -1L);
      }

      tx.success();
    }

    return reference;
  }
Example #2
0
  /**
   * Returns the id of a club given a fullclubreference
   *
   * @param clubID
   * @return
   */
  public String getClubID(final String fullclubref) {
    long _id = -1l;

    try (Transaction tx = DataControl_Neo4j_Singleton.getTx()) {
      final Map<String, Object> properties = new HashMap<>();
      properties.put("reference", fullclubref);

      final Query query =
          QueryBuilder.newQuery()
              .append("MATCH (club:Club{fullclubref: {reference}})")
              .complete("club AS n");

      final Node node = DataControl_Neo4j_Singleton.getNodeForQuery(query.get(), properties);

      if (node != null) {
        _id = (long) node.getProperty("_id", -1L);
      }

      tx.success();
    }

    return "" + _id;
  }