public class RdfRepository extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
RdfRepository.UpdateCountResponse
Attempts to log update response information but very likely only works
for Blazegraph.
|
| Modifier and Type | Field and Description |
|---|---|
protected static org.wikidata.query.rdf.tool.rdf.RdfRepository.ResponseHandler<Boolean> |
ASK_QUERY_RESPONSE
Parse the response from an ask query into a boolean.
|
protected static org.wikidata.query.rdf.tool.rdf.RdfRepository.ResponseHandler<org.openrdf.query.TupleQueryResult> |
TUPLE_QUERY_RESPONSE
Parse the response from a regular query into a TupleQueryResult.
|
protected static org.wikidata.query.rdf.tool.rdf.RdfRepository.ResponseHandler<Integer> |
UPDATE_COUNT_RESPONSE
Count and log the number of updates.
|
| Constructor and Description |
|---|
RdfRepository(URI uri,
WikibaseUris uris) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
ask(String sparql)
Execute a SPARQL ask and parse the boolean result.
|
protected org.apache.http.impl.client.CloseableHttpClient |
client()
Allow subclass access to the HTTP client.
|
protected <T> T |
execute(String type,
org.wikidata.query.rdf.tool.rdf.RdfRepository.ResponseHandler<T> responseHandler,
String sparql)
Execute some raw SPARQL.
|
Date |
fetchLeftOffTime()
Fetch where we left off updating the repository.
|
int |
getDelay()
Get retry delay.
|
int |
getMaxRetries()
Get max retries count.
|
com.google.common.collect.Multimap<String,String> |
getRefs(Collection<String> entityIds)
Get list of reference subjects connected to entity.
|
String |
getSyncQuery(String entityId,
Collection<org.openrdf.model.Statement> statements,
Collection<String> valueList)
Provides the SPARQL needed to synchronize the data statements.
|
com.google.common.collect.Multimap<String,String> |
getValues(Collection<String> entityIds)
Get list of value subjects connected to entity.
|
boolean |
hasRevision(String entityId,
long revision)
Does the triple store have this revision or better.
|
Set<String> |
hasRevisions(Collection<Change> candidates)
Filter set of changes and see which of them really need to be updated.
|
org.openrdf.query.TupleQueryResult |
query(String sparql)
Execute some SPARQL which returns a results table.
|
protected String |
responseBodyAsString(org.apache.http.client.methods.CloseableHttpResponse response)
Fetch the body of the response as a string.
|
RdfRepository |
setDelay(int delay)
Set retry delay.
|
RdfRepository |
setMaxRetries(int maxRetries)
Set how many times we retry a failed HTTP call.
|
int |
sync(String entityId,
Collection<org.openrdf.model.Statement> statements)
Synchronizes the RDF repository's representation.
|
int |
sync(String entityId,
Collection<org.openrdf.model.Statement> statements,
Collection<String> valueList)
Synchronizes the RDF repository's representation of an entity to be
exactly the provided statements.
|
int |
syncFromChanges(Collection<Change> changes,
boolean verifyResult)
Sync repository from changes list.
|
int |
syncQuery(String query)
Synchronizes the RDF repository's representation of an entity to be
exactly the provided statements.
|
void |
updateLeftOffTime(Date leftOffTime)
Update where we left off so when fetchLeftOffTime is next called it
returns leftOffTime so we can continue from there after the updater is
restarted.
|
protected static final org.wikidata.query.rdf.tool.rdf.RdfRepository.ResponseHandler<Integer> UPDATE_COUNT_RESPONSE
protected static final org.wikidata.query.rdf.tool.rdf.RdfRepository.ResponseHandler<org.openrdf.query.TupleQueryResult> TUPLE_QUERY_RESPONSE
protected static final org.wikidata.query.rdf.tool.rdf.RdfRepository.ResponseHandler<Boolean> ASK_QUERY_RESPONSE
public RdfRepository(URI uri, WikibaseUris uris)
protected org.apache.http.impl.client.CloseableHttpClient client()
public int getMaxRetries()
public RdfRepository setMaxRetries(int maxRetries)
public int getDelay()
public RdfRepository setDelay(int delay)
public com.google.common.collect.Multimap<String,String> getValues(Collection<String> entityIds)
entityIds - public com.google.common.collect.Multimap<String,String> getRefs(Collection<String> entityIds)
entityIds - public String getSyncQuery(String entityId, Collection<org.openrdf.model.Statement> statements, Collection<String> valueList)
entityId - id of the entity to syncstatements - all known statements about the entityvalueList - list of used values, for cleanuppublic int syncFromChanges(Collection<Change> changes, boolean verifyResult)
changes - List of changes.public int sync(String entityId, Collection<org.openrdf.model.Statement> statements, Collection<String> valueList)
entityId - id of the entity to syncstatements - all known statements about the entityvalueList - list of used values, for cleanuppublic int syncQuery(String query)
query - Query textpublic int sync(String entityId, Collection<org.openrdf.model.Statement> statements)
entityId - id of the entity to syncstatements - all known statements about the entitypublic Set<String> hasRevisions(Collection<Change> candidates)
candidates - List of candidate changespublic boolean hasRevision(String entityId, long revision)
public Date fetchLeftOffTime()
public void updateLeftOffTime(Date leftOffTime)
public boolean ask(String sparql)
public org.openrdf.query.TupleQueryResult query(String sparql)
protected <T> T execute(String type, org.wikidata.query.rdf.tool.rdf.RdfRepository.ResponseHandler<T> responseHandler, String sparql)
type - name of the parameter in which to send sparqlprotected String responseBodyAsString(org.apache.http.client.methods.CloseableHttpResponse response) throws IOException
IOException - if there is an error reading the responseCopyright © 2016. All rights reserved.