public class EditOnlineDataExample extends Object
IMPORTANT: Running this program will perform edits on test.wikidata.org. These edits are permanent and public. When running this program as is, the edits will be performed without logging in. This means that your current IP address will be recorded in the edit history of the page. If you prefer to use a login, please comment-in the respective line in the source code and modify it to use your credentials.
Note that all modification operations can throw an
MediaWikiApiErrorException
(if there was an API error) or
IOException
(if there was a network error, etc.). We do not handle
this here. In real applications, you may want to handle some subclasses of
MediaWikiApiErrorException
in special ways, e.g.,
EditConflictErrorException
(you tried to edit an entity that has been
modified by someone else since) and NoSuchEntityErrorException
(you
tried to modify an entity that meanwhile was deleted).
Constructor and Description |
---|
EditOnlineDataExample() |
Modifier and Type | Method and Description |
---|---|
static void |
findSomeStringProperties(ApiConnection connection)
Finds properties of datatype string on test.wikidata.org.
|
protected static StatementGroup |
findStatementGroup(PropertyIdValue pid,
StatementDocument document)
Finds the
StatementGroup for the given property in a document. |
static void |
main(String[] args) |
static void |
printDocumentation()
Prints some basic documentation about this program.
|
public static void main(String[] args) throws IOException, MediaWikiApiErrorException
public static void findSomeStringProperties(ApiConnection connection) throws MediaWikiApiErrorException, IOException
connection
- MediaWikiApiErrorException
IOException
public static void printDocumentation()
protected static StatementGroup findStatementGroup(PropertyIdValue pid, StatementDocument document)
StatementGroup
for the given property in a document.pid
- the property to look fordocument
- the document to searchStatementGroup
with this property, or null if there
is noneCopyright © 2014–2024 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage