public class WikibaseRepository extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
WikibaseRepository.Uris
URIs used for accessing wikibase.
|
| 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 |
delete(String entityId)
Delete entity from repository.
|
Collection<org.openrdf.model.Statement> |
fetchRdfForEntity(String entityId)
Fetch the RDF for some entity.
|
org.json.simple.JSONObject |
fetchRecentChanges(Date nextStartTime,
org.json.simple.JSONObject lastContinue,
int batchSize)
Fetch recent changes starting from nextStartTime or continuing from
lastContinue depending on the contents of lastContinue way to use
MediaWiki.
|
org.json.simple.JSONObject |
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(Map<String,Object> nextContinue)
Extract timestamp from continue JSON object.
|
org.json.simple.JSONObject |
getContinueObject(Change lastChange)
Create JSON change description for continuing.
|
static org.apache.http.client.HttpRequestRetryHandler |
getRetryHandler(int max)
Create retry handler.
|
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 org.apache.http.client.HttpRequestRetryHandler getRetryHandler(int max)
max - Maximum retries number.public org.json.simple.JSONObject 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 org.json.simple.JSONObject fetchRecentChanges(Date nextStartTime, org.json.simple.JSONObject 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 static DateFormat outputDateFormat()
public static DateFormat inputDateFormat()
public org.json.simple.JSONObject getContinueObject(Change lastChange)
lastChange - public Change getChangeFromContinue(Map<String,Object> nextContinue) throws ParseException
nextContinue - ParseException - When data is in is wrong formatCopyright © 2017. All rights reserved.