public void addTypedIdResource(TypedIdResource typedIdResource) throws FrameworkException {

    logger.log(Level.FINE, "Adding id {0} to id set", typedIdResource.getIdResource().getUriPart());

    // we need to differentiate between UuidResource and UuidResource
    UuidResource idResource = typedIdResource.getIdResource();

    if (idResource instanceof UuidResource) {

      // add uuid from TypedIdResource to idSet
      if (!idSet.add(((UuidResource) idResource).getUriPart())) {

        // id alread in set, this is an illegal path!
        throw new IllegalPathException();
      }
    } else {

      // add id from TypedIdResource to idSet
      if (!idSet.add(idResource.getUuid())) {

        // id alread in set, this is an illegal path!
        throw new IllegalPathException();
      }
    }

    // add id from TypedIdResource to idSet

    uriParts.add(typedIdResource.getUriPart());

    // find static relationship between the two types
    PropertyKey key = findPropertyKey(lastResource, typedIdResource.getTypeResource());
    if (key != null && key instanceof AbstractRelationProperty) {

      AbstractRelationProperty rel = (AbstractRelationProperty) key;

      if (!visitedRelationships.contains(rel)) {

        traversalDescription =
            traversalDescription.relationships(rel.getRelType(), rel.getDirection());
        visitedRelationships.add(rel);
      }

    } else {

      String rawType1 = lastResource.getTypeResource().getRawType();
      String rawType2 = typedIdResource.getTypeResource().getRawType();

      logger.log(
          Level.INFO,
          "No relationship defined between {0} and {1}, illegal path",
          new Object[] {rawType1, rawType2});

      // no relationship defined, illegal path
      throw new IllegalPathException();
    }

    // store last constraint separately
    lastResource = typedIdResource;
  }
  @Override
  public TraversalDescription getTraversalDescription(final SecurityContext securityContext) {

    TraversalDescription description =
        StructrApp.getInstance(securityContext)
            .getGraphDatabaseService()
            .traversalDescription()
            .breadthFirst()
            .uniqueness(getUniqueness());

    // set evaluators
    for (Evaluator evaluator : getEvaluators()) {
      description = description.evaluator(evaluator);
    }

    // add predicates as evaluators
    for (final Predicate<Node> predicate : predicates) {
      description =
          description.evaluator(
              new Evaluator() {

                @Override
                public Evaluation evaluate(Path path) {
                  Node endNode = path.endNode();
                  if (predicate.evaluate(securityContext, endNode)) {
                    return Evaluation.EXCLUDE_AND_PRUNE;
                  }

                  return Evaluation.INCLUDE_AND_CONTINUE;
                }
              });
    }

    // set rel type and direction
    int numRels = relTypes.size();
    for (int i = 0; i < numRels; i++) {
      RelationshipType relType = relTypes.get(i);
      Direction direction = directions.get(i);
      description = description.relationships(relType, direction);
    }

    return description;
  }