/** * Removes SPARQL prefix and base declarations, if any, from the supplied SPARQL query string. The * supplied query string is assumed to be syntactically legal. * * @param queryString * a syntactically legal SPARQL query string * @return a substring of queryString, with prefix and base declarations removed. */ public static String removeSPARQLQueryProlog(String queryString) { final Token t = QueryPrologLexer.getRestOfQueryToken(queryString); if (t != null) { return t.getStringValue(); } else { return queryString; } }
switch (c) { case '#': String comment = readComment(input, i); i += comment.length() + 1; // 1 for hash break; case 'P': String prefix = readPrefix(input, i); i = i + prefix.length() + 7; // 6 for prefix keyword, 1 for ':' break; case '<': String iri = readIRI(input, i); i += iri.length() + 2; // 2 for opening and closing brackets break;
switch (c) { case '#': String comment = readComment(input, i); i += comment.length() + 1; // 1 for hash break; case 'P': String prefix = readPrefix(input, i); i = i + prefix.length() + 7; // 6 for prefix keyword, 1 for ':' break; case '<': String iri = readIRI(input, i); i += iri.length() + 2; // 2 for opening and closing brackets break;
/** * Removes SPARQL prefix and base declarations, if any, from the supplied SPARQL query string. The * supplied query string is assumed to be syntactically legal. * * @param queryString * a syntactically legal SPARQL query string * @return a substring of queryString, with prefix and base declarations removed. */ public static String removeSPARQLQueryProlog(String queryString) { final Token t = QueryPrologLexer.getRestOfQueryToken(queryString); if (t != null) { return t.getStringValue(); } else { return queryString; } }
switch (c) { case '#': String comment = readComment(input, i); i += comment.length() + 1; // 1 for hash break; case 'P': String prefix = readPrefix(input, i); i = i + prefix.length() + 7; // 6 for prefix keyword, 1 for ':' break; case '<': String iri = readIRI(input, i); i += iri.length() + 2; // 2 for opening and closing brackets break;
/** * Removes SPARQL prefix and base declarations, if any, from the supplied SPARQL query string. The * supplied query string is assumed to be syntactically legal. * * @param queryString * a syntactically legal SPARQL query string * @return a substring of queryString, with prefix and base declarations removed. */ public static String removeSPARQLQueryProlog(String queryString) { final Token t = QueryPrologLexer.getRestOfQueryToken(queryString); if (t != null) { return t.getStringValue(); } else { return queryString; } }
case '#': result.add(HASH_TOKEN); String comment = readComment(input, i); i += comment.length() + 1; // 1 for hash result.add(new Token(TokenType.COMMENT, comment)); result.add(PREFIX_KEYWORD_TOKEN); String prefix = readPrefix(input, i); result.add(new Token(TokenType.PREFIX, prefix.trim())); i = i + prefix.length() + 7; // 6 for prefix keyword, 1 for ':' String iri = readIRI(input, i); result.add(new Token(TokenType.IRI, iri)); result.add(RBRACKET_TOKEN);
case '#': result.add(HASH_TOKEN); String comment = readComment(input, i); i += comment.length() + 1; // 1 for hash result.add(new Token(TokenType.COMMENT, comment)); result.add(PREFIX_KEYWORD_TOKEN); String prefix = readPrefix(input, i); result.add(new Token(TokenType.PREFIX, prefix.trim())); i = i + prefix.length() + 7; // 6 for prefix keyword, 1 for ':' String iri = readIRI(input, i); result.add(new Token(TokenType.IRI, iri)); result.add(RBRACKET_TOKEN);
case '#': result.add(HASH_TOKEN); String comment = readComment(input, i); i += comment.length() + 1; // 1 for hash result.add(new Token(TokenType.COMMENT, comment)); result.add(PREFIX_KEYWORD_TOKEN); String prefix = readPrefix(input, i); result.add(new Token(TokenType.PREFIX, prefix.trim())); i = i + prefix.length() + 7; // 6 for prefix keyword, 1 for ':' String iri = readIRI(input, i); result.add(new Token(TokenType.IRI, iri)); result.add(RBRACKET_TOKEN);