public class TcManager extends TcProviderMultiplexer implements GraphStore
TcProviderMultiplexer, delegating the actual provision and creation of
Graphs or MGraphs to registered WeightedTcProviders. The class attempts to satisfy the
request using the registered WeightedTcProvider in decreasing order of weight. If multiple
providers have the same weight the lexicographical order of the fully qualified class name determines
which one is used, namely the one that occurs earlier. If a call to a registered provider causes an
IllegalArgumentException,
NoSuchEntityException or
UnsupportedOperationException then the call is delegated to the
next provider.
Only one instance of this class should exist in a system, the public no
argument constructor is meant for initialization by dependency injection
systems such as OSGi-DS. Applications should use the static
getInstance() method if they aren't using a framework that
injects them the instance.
This class returns
Graphs a subtype of
Graph that allows read/write locks.
This class also registers all Graphs as services with the property
'name' indicating there name.
Security checks are done when a Graph is retrieved. The returned
Graph will do no further security checks. Because of this it
should not be passed to a context where different access control applies. If
an Graph is retrieved without having write permission the returned graph
will be read-only.
If a Graphs needs to passed around across different security
contexts the one retrieved from the OSGi service whiteboard should be used as
this performs access control on every access.| Modifier and Type | Field and Description |
|---|---|
static String |
GENERAL_PURPOSE_TC |
static String |
Graph_SERVICES_ENABLED |
static String |
MGRAPH_CACHE_ENABLED |
protected QueryEngine |
queryEngine |
protected SortedSet<WeightedTcProvider> |
tempProviderList |
providerList| Constructor and Description |
|---|
TcManager()
the constructor sets the singleton instance to allow instantiation by
OSGi-DS.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate(org.osgi.service.component.ComponentContext componentContext) |
protected void |
bindGpWeightedTcProvider(WeightedTcProvider provider)
Registers a provider
|
protected void |
bindQueryEngine(QueryEngine queryEngine) |
protected void |
bindWeightedTcProvider(WeightedTcProvider provider)
Registers a provider
|
Graph |
createGraph(IRI name)
Creates an initially empty
Graph with a specified name |
ImmutableGraph |
createImmutableGraph(IRI name,
Graph triples)
Creates a
ImmutableGraph with a specified name |
protected void |
deactivate(org.osgi.service.component.ComponentContext componentContext) |
void |
deleteGraph(IRI name)
Deletes the
ImmutableGraph or Graph of a specified name. |
boolean |
executeSparqlQuery(AskQuery query,
Graph defaultGraph)
Deprecated.
Query is discontinued
|
ImmutableGraph |
executeSparqlQuery(ConstructQuery query,
Graph defaultGraph)
Deprecated.
Query is discontinued
|
ImmutableGraph |
executeSparqlQuery(DescribeQuery query,
Graph defaultGraph)
Deprecated.
Query is discontinued
|
Object |
executeSparqlQuery(Query query,
Graph defaultGraph)
Deprecated.
Query is discontinued
|
ResultSet |
executeSparqlQuery(SelectQuery query,
Graph defaultGraph)
Deprecated.
Query is discontinued
|
Object |
executeSparqlQuery(String query,
boolean forceFastlane)
Executes any sparql query.
|
Object |
executeSparqlQuery(String query,
Graph defaultGraph)
Executes any sparql query.
|
Object |
executeSparqlQuery(String query,
IRI defaultGraphName)
Executes any sparql query.
|
Object |
executeSparqlQuery(String query,
IRI defaultGraphName,
boolean forceFastlane)
Executes any sparql query.
|
Graph |
getGraph(IRI name)
This method is used to get a
Graph indifferently
whether it's a ImmutableGraph or not. |
ImmutableGraph |
getImmutableGraph(IRI name)
Get a
ImmutableGraph by its name |
static TcManager |
getInstance()
This returns the singleton instance.
|
Graph |
getMGraph(IRI name)
Get an
Graph taht is not ImmutableGrah. |
Set<IRI> |
getNames(ImmutableGraph ImmutableGraph)
get a set of the names of a
ImmutableGraph |
TcAccessController |
getTcAccessController() |
protected void |
graphAppears(IRI name)
subclasses overwrite this method to be notified when a new
ImmutableGraph is available (either because it has been created or being
provided by a newly added WeightedTcProvider).
|
boolean |
isTcServicesEnabled() |
Set<IRI> |
listGraphs()
Lists the name of the
Graphs available through this
TcProvider indifferently whether they are mutables or
immutables, implementations may take into account the security context and
omit Graphs for which access is not allowed. |
Set<IRI> |
listImmutableGraphs()
Lists the name of the
ImmutableGraphs available through this
TcProvider, implementations may take into account the
security context and omit ImmutableGraphs for which access is not
allowed. |
Set<IRI> |
listMGraphs()
Lists the name of the
Graphs available through this
TcProvider that are not ImmutableGraph, implementations may take into account the
security context and omit Graphs for which access is not
allowed. |
Set<IRI> |
listNamedGraphs()
Lists the name of the named
Graphs available through this GraphStore. |
protected void |
mGraphAppears(IRI name)
subclasses overwrite this method to be notified when a new
Graph is available (either because it has been created or being
provided by a newly added WeightedTcProvider).
|
protected void |
tcDisappears(IRI name)
subclasses overwrite this method to be notified whenGraph is
no longer available (either because it has been deleted or bacause its
WeightedTcProvider was removed).
|
protected void |
unbindGpWeightedTcProvider(WeightedTcProvider provider)
Unregister a provider
|
protected void |
unbindQueryEngine(QueryEngine queryEngine) |
protected void |
unbindWeightedTcProvider(WeightedTcProvider provider)
Unregister a provider
|
addWeightedTcProvider, getProviderList, isCachingEnabled, removeWeightedTcProvider, setCachingEnabledpublic static final String GENERAL_PURPOSE_TC
public static final String Graph_SERVICES_ENABLED
public static final String MGRAPH_CACHE_ENABLED
protected QueryEngine queryEngine
protected SortedSet<WeightedTcProvider> tempProviderList
public TcManager()
getInstance method should be used.public static TcManager getInstance()
protected void activate(org.osgi.service.component.ComponentContext componentContext)
protected void deactivate(org.osgi.service.component.ComponentContext componentContext)
public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException
TcProviderImmutableGraph by its namegetImmutableGraph in interface TcProvidergetImmutableGraph in class TcProviderMultiplexername - the name of the ImmutableGraphImmutableGraph with the specified nameNoSuchEntityException - if there is no ImmutableGraph
with the specified namepublic Graph getMGraph(IRI name)
TcProviderGraph taht is not ImmutableGrah. The instances
returned in different invocations are equals.getMGraph in interface TcProvidergetMGraph in class TcProviderMultiplexername - the name of the GraphGraph with the specified namepublic Graph getGraph(IRI name)
TcProviderGraph indifferently
whether it's a ImmutableGraph or not. If the name names an
Graph the result is the same as when invoking
getMGraph with that argument, analogously for
ImmutableGraphS the method returns an instance equals to what
getImmutableGraph would return.getGraph in interface TcProvidergetGraph in class TcProviderMultiplexername - the name of the ImmutableGraph or GraphImmutableGraph or Graphpublic Graph createGraph(IRI name) throws UnsupportedOperationException
TcProviderGraph with a specified namecreateGraph in interface TcProvidercreateGraph in class TcProviderMultiplexername - names the new GraphGraphUnsupportedOperationException - if this provider doesn't support
creating GraphSpublic ImmutableGraph createImmutableGraph(IRI name, Graph triples)
TcProviderImmutableGraph with a specified namecreateImmutableGraph in interface TcProvidercreateImmutableGraph in class TcProviderMultiplexername - the name of the ImmutableGraph to be createdtriples - the triples of the new ImmutableGraphImmutableGraphpublic void deleteGraph(IRI name)
TcProviderImmutableGraph or Graph of a specified name.
If name references a ImmutableGraph and the ImmutableGraph has other names, it
will still be available with those other names.deleteGraph in interface TcProviderdeleteGraph in class TcProviderMultiplexername - the entity to be removedpublic Set<IRI> getNames(ImmutableGraph ImmutableGraph)
TcProviderImmutableGraphgetNames in interface TcProvidergetNames in class TcProviderMultiplexerImmutableGraph, the set is empty if
ImmutableGraph is unknownpublic Set<IRI> listNamedGraphs()
GraphStoreGraphs available through this GraphStore.listNamedGraphs in interface GraphStoreGraphspublic Set<IRI> listGraphs()
TcProviderGraphs available through this
TcProvider indifferently whether they are mutables or
immutables, implementations may take into account the security context and
omit Graphs for which access is not allowed.listGraphs in interface TcProviderlistGraphs in interface GraphStorelistGraphs in class TcProviderMultiplexerGraphspublic Set<IRI> listMGraphs()
TcProviderGraphs available through this
TcProvider that are not ImmutableGraph, implementations may take into account the
security context and omit Graphs for which access is not
allowed.listMGraphs in interface TcProviderlistMGraphs in class TcProviderMultiplexerGraphspublic Set<IRI> listImmutableGraphs()
TcProviderImmutableGraphs available through this
TcProvider, implementations may take into account the
security context and omit ImmutableGraphs for which access is not
allowed.listImmutableGraphs in interface TcProviderlistImmutableGraphs in class TcProviderMultiplexerImmutableGraphspublic Object executeSparqlQuery(String query, Graph defaultGraph) throws ParseException
query - the sparql query to executedefaultGraph - the default ImmutableGraph against which to execute the query
if no FROM clause is presentParseExceptionpublic Object executeSparqlQuery(String query, boolean forceFastlane) throws ParseException
query - the sparql query to executeforceFastlane - indicate whether to force fastlane usage.ParseExceptionpublic Object executeSparqlQuery(String query, IRI defaultGraphName) throws ParseException
query - the sparql query to executedefaultGraphName - the ImmutableGraph to be used as default ImmutableGraph in the Sparql ImmutableGraph StoreParseExceptionpublic Object executeSparqlQuery(String query, IRI defaultGraphName, boolean forceFastlane) throws ParseException
query - the sparql query to executedefaultGraphName - the ImmutableGraph to be used as default ImmutableGraph in the Sparql ImmutableGraph StoreforceFastlane - indicate whether to force fastlane usage.ParseException@Deprecated public Object executeSparqlQuery(Query query, Graph defaultGraph)
query - the sparql query to executedefaultGraph - the default ImmutableGraph against which to execute the query
if no FROM clause is present@Deprecated public ResultSet executeSparqlQuery(SelectQuery query, Graph defaultGraph)
query - the sparql SELECT query to executedefaultGraph - the default ImmutableGraph against which to execute the query
if not FROM clause is present@Deprecated public boolean executeSparqlQuery(AskQuery query, Graph defaultGraph)
query - the sparql ASK query to executedefaultGraph - the default ImmutableGraph against which to execute the query
if not FROM clause is present@Deprecated public ImmutableGraph executeSparqlQuery(DescribeQuery query, Graph defaultGraph)
query - the sparql DESCRIBE query to executedefaultGraph - the default ImmutableGraph against which to execute the query
if not FROM clause is present@Deprecated public ImmutableGraph executeSparqlQuery(ConstructQuery query, Graph defaultGraph)
query - the sparql CONSTRUCT query to executedefaultGraph - the default ImmutableGraph against which to execute the query
if not FROM clause is presentpublic TcAccessController getTcAccessController()
protected void bindWeightedTcProvider(WeightedTcProvider provider)
provider - the provider to be registeredprotected void unbindWeightedTcProvider(WeightedTcProvider provider)
provider - the provider to be deregisteredprotected void bindGpWeightedTcProvider(WeightedTcProvider provider)
provider - the provider to be registeredprotected void unbindGpWeightedTcProvider(WeightedTcProvider provider)
provider - the provider to be deregisteredprotected void bindQueryEngine(QueryEngine queryEngine)
protected void unbindQueryEngine(QueryEngine queryEngine)
protected void mGraphAppears(IRI name)
TcProviderMultiplexermGraphAppears in class TcProviderMultiplexerprotected void graphAppears(IRI name)
TcProviderMultiplexergraphAppears in class TcProviderMultiplexerprotected void tcDisappears(IRI name)
TcProviderMultiplexertcDisappears in class TcProviderMultiplexerpublic boolean isTcServicesEnabled()
Copyright © 2015–2022 The Apache Software Foundation. All rights reserved.