@Service(value={WeightedTcProvider.class,TcProvider.class,QueryableTcProvider.class}) @Properties(value={@Property(name="password",description="User password"),@Property(name="host",description="The host running the Virtuoso server"),@Property(name="port",description="The port number"),@Property(name="user",description="User name"),@Property(name="weight",intValue=110,description="Weight assigned to this provider"),@Property(name="general.purpose.tc",boolValue=true)}) public class VirtuosoWeightedProvider extends Object implements WeightedTcProvider, QueryableTcProvider
WeightedTcProvider
for
Virtuoso.Modifier and Type | Field and Description |
---|---|
static String |
ACTIVE_GRAPHS_GRAPH |
static int |
DEFAULT_WEIGHT |
static String |
DRIVER |
static String |
HOST |
static String |
PASSWORD |
static String |
PORT |
static String |
USER |
static String |
WEIGHT |
Constructor and Description |
---|
VirtuosoWeightedProvider()
Creates a new
VirtuosoWeightedProvider . |
VirtuosoWeightedProvider(String host,
Integer port,
String jdbcUser,
String jdbcPassword) |
Modifier and Type | Method and Description |
---|---|
void |
activate(org.osgi.service.component.ComponentContext cCtx)
Activates this component.
|
boolean |
canModify(UriRef graph) |
boolean |
canRead(UriRef graph) |
DataAccess |
createDataAccess() |
Graph |
createGraph(UriRef name,
TripleCollection triples)
Creates a new graph with the given triples, then returns the readable
(not modifiable) version of the graph
|
MGraph |
createMGraph(UriRef name)
Creates an initially empty MGraph.
|
void |
deactivate(org.osgi.service.component.ComponentContext cCtx)
Deactivates this component.
|
void |
deleteTripleCollection(UriRef name)
Clears the given graph and removes it from the loaded graphs.
|
Object |
executeSparqlQuery(String query,
UriRef defaultGraphUri)
Executes a SPARQL query
|
Connection |
getConnection() |
static String |
getConnectionString(String hostName,
Integer portNumber) |
Graph |
getGraph(UriRef name)
Retrieves the Graph (unmodifiable) with the given UriRef If no graph
exists with such name, throws a NoSuchEntityException
|
MGraph |
getMGraph(UriRef name)
Retrieves the MGraph (modifiable) with the given UriRef.
|
Set<UriRef> |
getNames(Graph graph)
Returns the names of a graph.
|
TripleCollection |
getTriples(UriRef name)
Generic implementation of the get(M)Graph method.
|
int |
getWeight()
Returns the weight of this provider.
|
Set<UriRef> |
listGraphs()
Returns the list of graphs in the virtuoso quad store.
|
Set<UriRef> |
listMGraphs()
Lists the name of the
MGraph s available through this
TcProvider , implementations may take into account the
security context and omit MGraph s for which access is not
allowed. |
Set<UriRef> |
listTripleCollections()
Lists the name of the
TripleCollection s available through this
TcProvider indifferently whether they are Graphs or an
MGraphs, implementations may take into account the security context and
omit TripleCollection s for which access is not allowed. |
void |
setWeight(int weight)
Sets the weight
|
public static final String DRIVER
public static final int DEFAULT_WEIGHT
public static final String HOST
public static final String PORT
public static final String USER
public static final String PASSWORD
public static final String WEIGHT
public static final String ACTIVE_GRAPHS_GRAPH
public VirtuosoWeightedProvider()
VirtuosoWeightedProvider
.
Before the weighted provider can be used, the method
activate
has to be called.@Activate public void activate(org.osgi.service.component.ComponentContext cCtx)
cCtx
- Execution context of this component. A value of null is
acceptable when you set the property connectionorg.osgi.service.cm.ConfigurationException
IllegalArgumentException
- No component context given and connection was not set.public static final String getConnectionString(String hostName, Integer portNumber)
@Deactivate public void deactivate(org.osgi.service.component.ComponentContext cCtx)
cCtx
- component context provided by OSGipublic Connection getConnection() throws SQLException
SQLException
public Graph getGraph(UriRef name) throws NoSuchEntityException
getGraph
in interface TcProvider
name
- the name of the GraphGraph
with the specified nameNoSuchEntityException
- if there is no Graph
with the specified namepublic MGraph getMGraph(UriRef name) throws NoSuchEntityException
getMGraph
in interface TcProvider
NoSuchEntityException
- if there is no MGraph
with the specified namepublic DataAccess createDataAccess()
public TripleCollection getTriples(UriRef name) throws NoSuchEntityException
getTriples
in interface TcProvider
name
- the name of the Graph
or MGraph
Graph
or MGraph
NoSuchEntityException
- if there is no Graph
or MGraph
with the specified namepublic Set<UriRef> listGraphs()
listGraphs
in interface TcProvider
public Set<UriRef> listMGraphs()
TcProvider
MGraph
s available through this
TcProvider
, implementations may take into account the
security context and omit MGraph
s for which access is not
allowed.listMGraphs
in interface TcProvider
MGraph
spublic boolean canRead(UriRef graph)
public boolean canModify(UriRef graph)
public Set<UriRef> listTripleCollections()
TcProvider
TripleCollection
s available through this
TcProvider
indifferently whether they are Graphs or an
MGraphs, implementations may take into account the security context and
omit TripleCollection
s for which access is not allowed.listTripleCollections
in interface TcProvider
TripleCollection
spublic MGraph createMGraph(UriRef name) throws UnsupportedOperationException, EntityAlreadyExistsException
EntityAlreadyExistsException
createMGraph
in interface TcProvider
name
- names the new MGraph
MGraph
UnsupportedOperationException
- if this provider doesn't support
creating MGraph
SEntityAlreadyExistsException
- if an MGraph with the specified name
already existspublic Graph createGraph(UriRef name, TripleCollection triples) throws UnsupportedOperationException, EntityAlreadyExistsException
createGraph
in interface TcProvider
name
- the name of the Graph
to be createdtriples
- the triples of the new Graph
Graph
UnsupportedOperationException
- if this provider doesn't support
creating Graph
SEntityAlreadyExistsException
- if a Graph with the specified name
already existspublic void deleteTripleCollection(UriRef name) throws UnsupportedOperationException, NoSuchEntityException, EntityUndeletableException
deleteTripleCollection
in interface TcProvider
name
- the entity to be removedUnsupportedOperationException
- if this provider doesn't support
entities deletion.NoSuchEntityException
- if name
doesn't refer to a
Graph
or an MGraph
.EntityUndeletableException
- if the specified Graph is undeletablepublic Set<UriRef> getNames(Graph graph)
getNames
in interface TcProvider
public int getWeight()
getWeight
in interface WeightedTcProvider
public void setWeight(int weight)
weight
- public Object executeSparqlQuery(String query, UriRef defaultGraphUri)
executeSparqlQuery
in interface QueryableTcProvider
query
- the sparql query to executeCopyright © 2014 The Apache Software Foundation. All Rights Reserved.