Parses query string parameters into a blank tree object. Used for updating
tree meta data.
@param query The HTTP query to work with
@return A tree object filled in with changes
@throws BadRequestException if some of the data was invalid
429245
private Tree parseTree(HttpQuery query) {
    final Tree tree = new Tree(parseTreeId(query, false));
    if (query.hasQueryStringParam("name")) {
      tree.setName(query.getQueryStringParam("name"));
    }
    if (query.hasQueryStringParam("description")) {
      tree.setDescription(query.getQueryStringParam("description"));
    }
    if (query.hasQueryStringParam("notes")) {
      tree.setNotes(query.getQueryStringParam("notes"));
    }
    if (query.hasQueryStringParam("strict_match")) {
      if (query.getQueryStringParam("strict_match").toLowerCase()
          .equals("true")) {
        tree.setStrictMatch(true);
      } else {
        tree.setStrictMatch(false);
      }
    }
    if (query.hasQueryStringParam("enabled")) {
      final String enabled = query.getQueryStringParam("enabled");
      if (enabled.toLowerCase().equals("true")) {
        tree.setEnabled(true);
      } else {
        tree.setEnabled(false);
      }
    }
    if (query.hasQueryStringParam("store_failures")) {
      if (query.getQueryStringParam("store_failures").toLowerCase()
          .equals("true")) {
        tree.setStoreFailures(true);
      } else {
        tree.setStoreFailures(false);
      }
    }
    return tree;
  }
416692
public UrlBuilder withQuery(String query) {
        if (query == null || query.isEmpty()) {
            this.query.clear();
        } else {
            with(query, UrlTokenizerState.QUERY);
        }
        return this;
    }
1323183
protected boolean isValidQuery(String query) {
        if (query == null) {
            return true;
        }
        
        return QUERY_PATTERN.matcher(query).matches();
    }
259855
private QueryBuilderKraken parseMap(QueryBuilderKraken query)
  {
    boolean distinct = false;

    Token token = scanToken();

    if (token == Token.DISTINCT)
      distinct = true;
    else
      _token = token;

    ArrayList<ExprKraken> resultItems = new ArrayList<>();

    Token startToken = scanToken();
    String startLexeme = _lexeme;
    int startOffset = _parseIndex;

    while ((token = scanToken()) != null
        && token != Token.EOF 
        && token != Token.FROM) {
    }

    if (token != Token.FROM) { 
      throw error("expected FROM at '{0}'", token);
    }

    _query = query;

    String tableName = parseFrom();

    query.setTableName(tableName);
    
    token = scanToken();
    
    Token tailToken = token;
    int tailOffset = _parseIndex;

    _token = startToken;
    _parseIndex = startOffset;
    _lexeme = startLexeme;

    ExprKraken expr = parseSelectExpr();

    resultItems.add(expr);

    while ((token = scanToken()) == Token.COMMA) {
      expr = parseSelectExpr();

      resultItems.add(expr);
    }

    _token = tailToken;
    _parseIndex = tailOffset;

    token = scanToken();
    
    ExprKraken whereExpr = null;

    if (token == Token.WHERE) {
      // _andExpr.add(parseExpr());
      whereExpr = parseExpr();
    }
    else {
      _token = token;
    }

    ParamExpr []params = _params.toArray(new ParamExpr[_params.size()]);
    
    query.setWhereExpr(whereExpr);
    // query.setKelpExpr(whereKelp);
    query.setParams(params);

    for (int i = resultItems.size() - 1; i >= 0; i--) {
      ExprKraken subExpr = resultItems.get(i);
    }

    ExprKraken []resultArray
      = resultItems.toArray(new ExprKraken[resultItems.size()]);

    query.setResults(resultArray);
    
    token = scanToken();
    
    if (token != null 
        && token != Token.EOF
        && token != Token.LIMIT 
        && token != Token.OFFSET) {
      throw error("unexpected token at end '{0}'", token);
    }

    return query;
  }
298826
private InputQuery parseQueryString(String queryString) throws OntopOWLException {
		try {
			return inputQueryFactory.createSPARQLQuery(queryString);
		} catch (OntopInvalidInputQueryException | OntopUnsupportedInputQueryException e) {
			throw new OntopOWLException(e);
		}
	}
815540
public QueryResponse executeQueryPost(Query query) throws ApiException {
        ApiResponse<QueryResponse> resp = executeQueryPostWithHttpInfo(query);
        return resp.getData();
    }
872623
function querystring(query) {
      var parser = /([^=?&]+)=([^&]*)/g
        , result = {}
        , part;

      //
      // Little nifty parsing hack, leverage the fact that RegExp.exec increments
      // the lastIndex property so we can continue executing this loop until we've
      // parsed all results.
      //
      for (;
        part = parser.exec(query);
        result[decodeURIComponent(part[1])] = decodeURIComponent(part[2])
      );

      return result;
    }
682463
private final SearchQuery parseQueryString(final HttpQuery query, 
      final SearchType type) {
    final SearchQuery search_query = new SearchQuery();
    
    if (type == SearchType.LOOKUP) {
      final String query_string = query.getRequiredQueryStringParam("m");
      search_query.setTags(new ArrayList<Pair<String, String>>());
      
      try {
      search_query.setMetric(Tags.parseWithMetric(query_string, 
          search_query.getTags()));
      } catch (IllegalArgumentException e) {
        throw new BadRequestException("Unable to parse query", e);
      }
      if (query.hasQueryStringParam("limit")) {
        final String limit = query.getQueryStringParam("limit");
        try {
          search_query.setLimit(Integer.parseInt(limit));
        } catch (NumberFormatException e) {
          throw new BadRequestException(
                  "Unable to convert 'limit' to a valid number");
        }
      }
      return search_query;
    }
    
    // process a regular search query
    search_query.setQuery(query.getRequiredQueryStringParam("query"));
    
    if (query.hasQueryStringParam("limit")) {
      final String limit = query.getQueryStringParam("limit");
      try {
        search_query.setLimit(Integer.parseInt(limit));
      } catch (NumberFormatException e) {
        throw new BadRequestException(
            "Unable to convert 'limit' to a valid number");
      }
    }
    
    if (query.hasQueryStringParam("start_index")) {
      final String idx = query.getQueryStringParam("start_index");
      try {
        search_query.setStartIndex(Integer.parseInt(idx));
      } catch (NumberFormatException e) {
        throw new BadRequestException(
            "Unable to convert 'start_index' to a valid number");
      }
    }
    
    if (query.hasQueryStringParam("use_meta")) {
      search_query.setUseMeta(Boolean.parseBoolean(
          query.getQueryStringParam("use_meta")));
    }
    
    return search_query;
  }
1091990
private String extractQueryParam(HttpServletRequest request, Map<String, String> restParams) {
        String query = request.getQueryString();
        if (Utils.isEmpty(query)) {
            return "";
        }
        StringBuilder buffer = new StringBuilder(query);
        
        // Split query component into decoded, &-separate components.
        String[] parts = Utils.splitURIQuery(buffer.toString());
        List<Pair<String, String>> unusedList = new ArrayList<Pair<String,String>>();
        boolean bRewrite = false;
        for (String part : parts) {
            Pair<String, String> param = extractParam(part);
            switch (param.firstItemInPair.toLowerCase()) {
            case "api":
                bRewrite = true;
                restParams.put("api", param.secondItemInPair);
                break;
            case "format":
                bRewrite = true;
                if (param.secondItemInPair.equalsIgnoreCase("xml")) {
                    restParams.put("format", "text/xml");
                } else if (param.secondItemInPair.equalsIgnoreCase("json")) {
                    restParams.put("format", "application/json");
                }
                break;
            case "tenant":
                bRewrite = true;
                restParams.put("tenant", param.secondItemInPair);
                break;
            default:
                unusedList.add(param);
            }
        }
        
        // If we extracted any fixed params, rewrite the query parameter.
        if (bRewrite) {
            buffer.setLength(0);
            for (Pair<String, String> pair : unusedList) {
                if (buffer.length() > 0) {
                    buffer.append("&");
                }
                buffer.append(Utils.urlEncode(pair.firstItemInPair));
                if (pair.secondItemInPair != null) {
                    buffer.append("=");
                    buffer.append(Utils.urlEncode(pair.secondItemInPair));
                }
            }
        }
        return buffer.toString();
    }
441356
public WaybackRequest parse(HttpServletRequest httpRequest, 
			AccessPoint wbContext) throws BadQueryException, BetterRequestException {

		WaybackRequest wbRequest = null;

		for(int i = 0; i < parsers.length; i++) {
			wbRequest = parsers[i].parse(httpRequest, wbContext);
			if(wbRequest != null) {
				break;
			}
		}
		return wbRequest;
	}
536991
public SearchQuery parseSearchQueryV1() {
    final String json = query.getContent();
    if (json == null || json.isEmpty()) {
      throw new BadRequestException(HttpResponseStatus.BAD_REQUEST,
          "Missing message content",
          "Supply valid JSON formatted data in the body of your request");
    }
    
    return JSON.parseToObject(json, SearchQuery.class);
  }
1067941
public Map<String, List<String>> getQueryString() {
    if (querystring == null) {
      try {
        querystring = new QueryStringDecoder(request.getUri()).getParameters();
      } catch (IllegalArgumentException e) {
        throw new BadRequestException("Bad query string: " + e.getMessage());
      }
    }
    return querystring;
  }
844084
public ApiResponse<Integer> executeDeletePostWithHttpInfo(Query query) throws ApiException {
        com.squareup.okhttp.Call call = executeDeletePostValidateBeforeCall(query, null, null);
        Type localVarReturnType = new TypeToken<Integer>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
663105
public static Map<String, Object> parseQuerystring(String query) {
        String[] params = query.split("&");
        Map<String, Object> map = new HashMap<String, Object>();
        for (String param : params) {
            String[] nameValue = param.split("=");
            map.put(nameValue[0], nameValue[1]);
        }
        return map;
    }
125385
public static List<String> findParamsInQuery(String query, boolean changeToLower) {
		List<String> result = new ArrayList<>();

		Matcher matcher = PARAM_PATTERN.matcher(query);

		while (matcher.find()) {
			if (matcher.group("PARAM") != null) {
				String param;
				if (changeToLower) {
					param = matcher.group("PARAM").toLowerCase();
				} else {
					param = matcher.group("PARAM");
				}

				if (!result.contains(param)) {
					result.add(param);
				}
			}
		}

		return result;
	}
85855
private void printQueryStats(final HttpQuery query) {
    switch (query.apiVersion()) {
    case 0:
    case 1:
      query.sendReply(query.serializer().formatQueryStatsV1(
          QueryStats.getRunningAndCompleteStats()));
      break;
    default: 
      throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, 
          "Requested API version not implemented", "Version " + 
          query.apiVersion() + " is not implemented");
    }
  }
1053404
private UIDMeta parseUIDMetaQS(final HttpQuery query) {
    final String uid = query.getRequiredQueryStringParam("uid");
    final String type = query.getRequiredQueryStringParam("type");
    final UIDMeta meta = new UIDMeta(UniqueId.stringToUniqueIdType(type), uid);
    final String display_name = query.getQueryStringParam("display_name");
    if (display_name != null) {
      meta.setDisplayName(display_name);
    }
    
    final String description = query.getQueryStringParam("description");
    if (description != null) {
      meta.setDescription(description);
    }
    
    final String notes = query.getQueryStringParam("notes");
    if (notes != null) {
      meta.setNotes(notes);
    }
    
    return meta;
  }