public class SPARQLPrefixResolver extends Object
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
SPARQLPrefixResolver.TwoStagePrefixMapping
Consists of two, a local and a global request mapping.
|
| Modifier and Type | Field and Description |
|---|---|
private static Properties |
globalPrefixes
Refers to resource "prefixes.properties".
|
private static org.apache.jena.shared.PrefixMapping |
globalPrefixMapping
This mapping will be used to refer to, if the local mapping (e.g.PREFIX declarations in the query itself) cannot resolve a prefix.
|
private static org.slf4j.Logger |
LOGGER |
| Constructor and Description |
|---|
SPARQLPrefixResolver() |
| Modifier and Type | Method and Description |
|---|---|
static String |
addMissingPrefixes(String sparqlQuery)
Adds the declaration of a prefix, if its used in the sparql query, but not declared.
|
static org.apache.jena.shared.PrefixMapping |
getGlobalPrefixMapping()
If you want to add/remove a prefix, this is your best bet.
|
private static org.slf4j.Logger LOGGER
private static Properties globalPrefixes
Prefixes will be loaded during loading of enclosing class, via static constructor.
private static org.apache.jena.shared.PrefixMapping globalPrefixMapping
globalPrefixespublic static org.apache.jena.shared.PrefixMapping getGlobalPrefixMapping()
public static String addMissingPrefixes(String sparqlQuery)
globalPrefixMapping is used, which is initialized with data from resource
"prefixes.properties"
In query defined prefixes override.
If uris are given in the query body which can be represented with a prefix, the uris are replaced with a prefix and a prefix declaration will be added. E.g. "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" is present, it will be replaced with "rdf:type", and prefix declaration for "rdf" will be added.
This will not remove unused prefix declarations.
if you wonder why keyword "a" is replaced, this is correct behavior. This is, because mapping for rdf: is set in a PrefixMap(its default in global).
sparqlQuery - a sparql queryCopyright © 2016–2020. All rights reserved.