public class SPARQLQueries extends Object
Constructor and Description |
---|
SPARQLQueries() |
Modifier and Type | Method and Description |
---|---|
static String |
escape(String s)
Escape the supplied string with backslashes for any special characters, so it can be used as a string literal
value in a SPARQL query.
|
static String |
getPrefixClauses(Iterable<Namespace> namespaces)
Creates a string representing of the supplied
namespaces as SPARQL prefix declarations. |
static String |
unescape(String s)
Un-escapes a backslash-escaped SPARQL literal value string.
|
public static String getPrefixClauses(Iterable<Namespace> namespaces)
namespaces
as SPARQL prefix declarations. This
can be used when composing a SPARQL query string in code, for example:
String query = SPARQLQueries.getPrefixClauses(connection.getNamespaces()) + "SELECT * WHERE { ?s ex:myprop ?o }";
namespaces
- one or more Namespace
objects.public static String escape(String s)
https://www.w3.org/TR/sparql11-query/#grammarEscapes
public static String unescape(String s)
s
- An SPARQL literal string with backslash escapes.IllegalArgumentException
- If the supplied string is not a correctly escaped SPARQL string.https://www.w3.org/TR/sparql11-query/#grammarEscapes
Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.