private boolean uriMatchesComparison(URI actual, ComparisonTerm comparison) {
   String actualString = actual.toString();
   Value value = comparison.operand();
   if (!(value instanceof UriRefValue)) {
     throw HttpResponses.status(HttpServletResponse.SC_BAD_REQUEST);
   }
   UriRefValue uriRef = (UriRefValue) value;
   String uri = uriRef.value();
   switch (comparison.operator()) {
     case EQUALS:
       return actualString.equals(uri);
     case NOT_EQUALS:
       return !actualString.equals(uri);
     default:
       throw HttpResponses.status(HttpServletResponse.SC_BAD_REQUEST);
   }
 }
  private boolean uriMatchesInTerm(URI actual, InTerm in) {
    String actualString = actual.toString();

    for (Object element : in.values()) {
      Value value = (Value) element;
      if (!(value instanceof UriRefValue)) {
        throw HttpResponses.status(HttpServletResponse.SC_BAD_REQUEST);
      }

      UriRefValue uriRef = (UriRefValue) value;
      String uri = uriRef.value();
      if (uri.equals(actualString)) {
        return true;
      }
    }

    return false;
  }