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 String |
TIMEOUT_PROPERTY
Request timeout property.
|
| Constructor and Description |
|---|
WikibaseRepository(String scheme,
String host) |
WikibaseRepository(String scheme,
String host,
int port) |
WikibaseRepository(String scheme,
String host,
int port,
long[] entityNamespaces) |
| Modifier and Type | Method and Description |
|---|---|
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(Date 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(Date 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.
|
static DateFormat |
inputDateFormat()
Create a new DateFormat object that parses from and formats to the date
in the format that wikibase returns.
|
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.
|
static DateFormat |
outputDateFormat()
Create a new DateFormat object that parses from and formats to the date
in the format that wikibase wants as input.
|
String |
setLabel(String entityId,
String type,
String label,
String language)
Edits or creates a page by setting a label.
|
public static final String TIMEOUT_PROPERTY
public static final String INPUT_DATE_FORMAT
public RecentChangeResponse fetchRecentChangesByTime(Date 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(Date 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
entityId - RetryableException - thrown if there is an error communicating with
wikibasepublic boolean isEntityNamespace(long namespace)
namespace - the namespace indexpublic boolean isValidEntity(String name)
name - public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic static DateFormat outputDateFormat()
public static DateFormat inputDateFormat()
public Change getChangeFromContinue(Continue nextContinue) throws ParseException
nextContinue - ParseException - When data is in is wrong formatCopyright © 2018. All rights reserved.