public final class RewritingTripleStore extends ForwardingTripleStore
TripleStore
wrapper that rewrites URIs, adapting a prefix used externally in the KS
to a prefix used internally to the wrapped triple.
The wrapper intercepts calls to an underlying TripleStore
and to the
TripleTransaction
s it creates. It rewrites any incoming URI starting with a configured
external prefix, replacing that prefix with an internal replacement. At the same
time, the wrapper rewrites every outgoing URI starting with the internal prefix,
replacing that prefix with the external one. Rewrite occurs on every input / output data
item exchanged at the level of the TripleStore
API, including RDF values, statements,
binding sets and SPARQL queries (query rewriting is done by manipulating their algebraic form).
Constructor and Description |
---|
RewritingTripleStore(TripleStore delegate,
String internalPrefix,
String externalPrefix)
Creates a new instance for the wrapped
TripleStore specified. |
Modifier and Type | Method and Description |
---|---|
TripleTransaction |
begin(boolean readOnly)
Begins a new read-only / read-write triple store transaction.
|
protected TripleStore |
delegate() |
close, init, reset
toString
public RewritingTripleStore(TripleStore delegate, String internalPrefix, String externalPrefix)
TripleStore
specified.delegate
- the wrapped TripleStore
internalPrefix
- the internal (i.e., in the TripleStore) prefix of the URIs to rewriteexternalPrefix
- the external (i.e., in the KS API) prefix of the URIs to rewritepublic TripleTransaction begin(boolean readOnly) throws IOException
TripleStore
begin
in interface TripleStore
begin
in class ForwardingTripleStore
readOnly
- true if the transaction is not allowed to modify the contents of the
triple store (this allows for optimizing the access to the triple store).DataCorruptedException
- in case a transaction cannot be started due to triple store files being damaged
or non-existing; a TripleStore.reset()
call followed by a full triple store
re-population should be attempted to recover this situationIOException
- if another IO error occurs while starting the transaction, not implying a data
corruption situationprotected TripleStore delegate()
delegate
in class ForwardingTripleStore
Copyright © 2015–2016 FBK-irst. All rights reserved.