public class WikibaseRepository extends Object implements Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
WikibaseRepository.Uris
URIs used for accessing wikibase.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
INPUT_DATE_FORMAT
Standard representation of dates in Mediawiki API (ISO 8601).
|
static DateTimeFormatter |
INPUT_DATE_FORMATTER
DateTimeFormatter object that parses from and formats to the date
in the format that wikibase returns, i.e.
|
static DateTimeFormatter |
OUTPUT_DATE_FORMATTER
DateTimeFormatter object that parses from and formats to the date
in the format that wikibase wants as input, i.e.
|
| Constructor and Description |
|---|
WikibaseRepository(String baseUrl,
com.codahale.metrics.MetricRegistry metricRegistry) |
WikibaseRepository(URI baseUrl,
com.codahale.metrics.MetricRegistry metricRegistry) |
WikibaseRepository(URI baseUrl,
Set<Long> entityNamespaces,
com.codahale.metrics.MetricRegistry metricRegistry) |
WikibaseRepository(WikibaseRepository.Uris uris,
boolean collectConstraints,
com.codahale.metrics.MetricRegistry metricRegistry,
StreamDumper streamDumper) |
| Modifier and Type | Method and Description |
|---|---|
void |
batchDone()
Notifies repository that a batch of changes has been processed.
|
void |
close() |
void |
delete(String entityId)
Delete entity from repository.
|
Collection<org.openrdf.model.Statement> |
fetchRdfForEntity(String entityId)
Fetch the RDF for some entity.
|
RecentChangeResponse |
fetchRecentChanges(Instant nextStartTime,
Continue lastContinue,
int batchSize)
Fetch recent changes starting from nextStartTime or continuing from
lastContinue depending on the contents of lastContinue way to use
MediaWiki.
|
RecentChangeResponse |
fetchRecentChangesByTime(Instant nextStartTime,
int batchSize)
Fetch recent changes starting from nextStartTime or continuing from
lastContinue depending on the contents of lastContinue way to use
MediaWiki.
|
String |
firstEntityIdForLabelStartingWith(String label,
String language,
String type)
Get the first id with the provided label in the provided language.
|
Change |
getChangeFromContinue(Continue nextContinue)
Extract timestamp from continue JSON object.
|
WikibaseRepository.Uris |
getUris()
Get repository URI setup.
|
boolean |
isEntityNamespace(long namespace)
Check that a namespace is valid wikibase entity namespace.
|
boolean |
isValidEntity(String name)
Check if the entity ID is a valid entity ID.
|
void |
setCollectConstraints(boolean collectConstraints)
Should we collect constraints?
|
String |
setLabel(String entityId,
String type,
String label,
String language)
Edits or creates a page by setting a label.
|
public static final String INPUT_DATE_FORMAT
public static final DateTimeFormatter INPUT_DATE_FORMATTER
public static final DateTimeFormatter OUTPUT_DATE_FORMATTER
public WikibaseRepository(URI baseUrl, com.codahale.metrics.MetricRegistry metricRegistry)
public WikibaseRepository(String baseUrl, com.codahale.metrics.MetricRegistry metricRegistry)
public WikibaseRepository(URI baseUrl, Set<Long> entityNamespaces, com.codahale.metrics.MetricRegistry metricRegistry)
public WikibaseRepository(WikibaseRepository.Uris uris, boolean collectConstraints, com.codahale.metrics.MetricRegistry metricRegistry, StreamDumper streamDumper)
public RecentChangeResponse fetchRecentChangesByTime(Instant nextStartTime, int batchSize) throws RetryableException
nextStartTime - if lastContinue is null then this is the start time
of the querybatchSize - the number of recent changes to fetchRetryableException - thrown if there is an error communicating with
wikibasepublic RecentChangeResponse fetchRecentChanges(Instant nextStartTime, Continue lastContinue, int batchSize) throws RetryableException
nextStartTime - if lastContinue is null then this is the start time
of the querybatchSize - the number of recent changes to fetchlastContinue - Continuation object from last batch, or null.RetryableException - thrown if there is an error communicating with
wikibasepublic Collection<org.openrdf.model.Statement> fetchRdfForEntity(String entityId) throws RetryableException
RetryableException - thrown if there is an error communicating with
wikibasepublic String firstEntityIdForLabelStartingWith(String label, String language, String type) throws RetryableException
RetryableException - thrown if there is an error communicating with
wikibasepublic String setLabel(String entityId, String type, String label, String language) throws RetryableException
entityId - id of the entity - if null then the entity will be
created newtype - type of entity to create or editlabel - label of the page to createlanguage - language of the label to addRetryableException - thrown if there is an error communicating with
wikibasepublic void delete(String entityId) throws RetryableException
RetryableException - thrown if there is an error communicating with
wikibasepublic boolean isEntityNamespace(long namespace)
namespace - the namespace indexpublic boolean isValidEntity(String name)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic Change getChangeFromContinue(Continue nextContinue)
DateTimeParseException - When data is in the wrong formatNumberFormatException - When data is in the wrong formatpublic WikibaseRepository.Uris getUris()
public void setCollectConstraints(boolean collectConstraints)
public void batchDone()
Copyright © 2019. All rights reserved.