@Test public void testDeleteStatements() throws MediaWikiApiErrorException, IOException { String guid1 = "8372EF7A-B72C-7DE2-98D0-DFB4-8EC8392AC28E"; String guid2 = "4311895D-9091-4BC9-9B34-DFB4-1B00EE8CFA62"; WikibaseDataEditor wde = new WikibaseDataEditor(this.con, Datamodel.SITE_WIKIDATA); ItemIdValue id = Datamodel.makeWikidataItemIdValue("Q1234"); Statement s1 = StatementBuilder.forSubjectAndProperty(id, P31) .withValue(Q5).withId("Q1234$"+guid1).build(); Statement s2 = StatementBuilder.forSubjectAndProperty(id, P31) .withValue(Q5).withId("Q1234$"+guid2).build(); ItemDocument itemDocument = ItemDocumentBuilder.forItemId(id) .withRevisionId(1234) .withStatement(s1) .withStatement(s2) .build(); ItemDocument expectedDocument = ItemDocumentBuilder.forItemId(id) .withRevisionId(1235) .build(); List<String> statementIds = Arrays.asList("Q1234$"+guid1, "Q1234$"+guid2); String statementsList = String.join("|", statementIds); Map<String, String> params = new HashMap<>(); params.put("action", "wbremoveclaims"); params.put("summary", "Removing claims"); params.put("token", "42307b93c79b0cb558d2dfb4c3c92e0955e06041+\\"); params.put("format", "json"); params.put("baserevid", "1234"); params.put("maxlag", "5"); params.put("claim", statementsList); String expectedResult = "{\"pageinfo\":{\"lastrevid\":1235},\"success\":1,\"claims\":[\""+statementIds.get(0)+"\",\""+statementIds.get(1)+"\"]}"; con.setWebResource(params, expectedResult); ItemDocument editedDocument = wde.updateTermsStatements(itemDocument, Collections.<MonolingualTextValue>emptyList(), Collections.<MonolingualTextValue>emptyList(), Collections.<MonolingualTextValue>emptyList(), Collections.<MonolingualTextValue>emptyList(), Collections.<Statement>emptyList(), Arrays.asList(s1,s2), "Removing claims", null); assertEquals(expectedDocument, editedDocument); }
public ItemDocument updateTermsStatements(ItemIdValue itemIdValue, List<MonolingualTextValue> addLabels, List<MonolingualTextValue> addDescriptions, List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases, List<Statement> addStatements, List<Statement> deleteStatements, String summary, List<String> tags) throws MediaWikiApiErrorException, IOException { ItemDocument currentDocument = (ItemDocument) this.wikibaseDataFetcher .getEntityDocument(itemIdValue.getId()); return updateTermsStatements(currentDocument, addLabels, addDescriptions, addAliases, deleteAliases, addStatements, deleteStatements, summary, tags); }
WikibaseDataEditor { public ItemDocument updateTermsStatements(ItemIdValue itemIdValue, List<MonolingualTextValue> addLabels, List<MonolingualTextValue> addDescriptions, List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases, List<Statement> addStatements, List<Statement> deleteStatements, String summary, List<String> tags) throws MediaWikiApiErrorException, IOException { ItemDocument currentDocument = (ItemDocument) this.wikibaseDataFetcher .getEntityDocument(itemIdValue.getId()); return updateTermsStatements(currentDocument, addLabels, addDescriptions, addAliases, deleteAliases, addStatements, deleteStatements, summary, tags); } }
WikibaseDataEditor { public ItemDocument updateTermsStatements(ItemIdValue itemIdValue, List<MonolingualTextValue> addLabels, List<MonolingualTextValue> addDescriptions, List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases, List<Statement> addStatements, List<Statement> deleteStatements, String summary, List<String> tags) throws MediaWikiApiErrorException, IOException { ItemDocument currentDocument = (ItemDocument) this.wikibaseDataFetcher .getEntityDocument(itemIdValue.getId()); return updateTermsStatements(currentDocument, addLabels, addDescriptions, addAliases, deleteAliases, addStatements, deleteStatements, summary, tags); } WikibaseDataEditor(ApiConnection connection, String siteUri);  WikibaseDataEditor(ApiConnection connection, String siteUri, GuidGenerator generator); }
WikibaseDataEditor { public ItemDocument updateTermsStatements(ItemIdValue itemIdValue, List<MonolingualTextValue> addLabels, List<MonolingualTextValue> addDescriptions, List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases, List<Statement> addStatements, List<Statement> deleteStatements, String summary, List<String> tags) throws MediaWikiApiErrorException, IOException { ItemDocument currentDocument = (ItemDocument) this.wikibaseDataFetcher .getEntityDocument(itemIdValue.getId()); return updateTermsStatements(currentDocument, addLabels, addDescriptions, addAliases, deleteAliases, addStatements, deleteStatements, summary, tags); } WikibaseDataEditor(ApiConnection connection, String siteUri);  WikibaseDataEditor(ApiConnection connection, String siteUri, GuidGenerator generator); boolean editAsBot(); void setEditAsBot(boolean editAsBot); int getMaxLag(); void setMaxLag(int maxLag); int getMaxLagMaxRetries(); void setMaxLagMaxRetries(int retries); int getMaxLagFirstWaitTime(); void setMaxLagFirstWaitTime(int time); double getMaxLagBackOffFactor(); void setMaxLagBackOffFactor(double value); int getAverageTimePerEdit(); void setAverageTimePerEdit(int milliseconds); int getRemainingEdits(); void setRemainingEdits(int remainingEdits); void disableEditing(); ItemDocument createItemDocument(ItemDocument itemDocument,
			String summary, List<String> tags); PropertyDocument createPropertyDocument(
			PropertyDocument propertyDocument, String summary, List<String> tags); ItemDocument editItemDocument(ItemDocument itemDocument,
			boolean clear, String summary, List<String> tags); PropertyDocument editPropertyDocument(
			PropertyDocument propertyDocument, boolean clear, String summary,
			List<String> tags); MediaInfoDocument editMediaInfoDocument(
			MediaInfoDocument mediaInfoDocument, boolean clear, String summary,
			List<String> tags); ItemDocument updateStatements(ItemIdValue itemIdValue,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); ItemDocument updateTermsStatements(ItemIdValue itemIdValue,
			List<MonolingualTextValue> addLabels,
			List<MonolingualTextValue> addDescriptions,
			List<MonolingualTextValue> addAliases,
			List<MonolingualTextValue> deleteAliases,
			List<Statement> addStatements,
			List<Statement> deleteStatements,
			String summary,
			List<String> tags); PropertyDocument updateStatements(PropertyIdValue propertyIdValue,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); @SuppressWarnings("unchecked") T updateStatements(T currentDocument,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); @SuppressWarnings("unchecked") T updateTermsStatements(T currentDocument,
			List<MonolingualTextValue> addLabels,
			List<MonolingualTextValue> addDescriptions,
			List<MonolingualTextValue> addAliases,
			List<MonolingualTextValue> deleteAliases,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); void nullEdit(ItemIdValue itemId); void nullEdit(PropertyIdValue propertyId); @SuppressWarnings("unchecked") T nullEdit(T currentDocument); }
WikibaseDataEditor { public ItemDocument updateTermsStatements(ItemIdValue itemIdValue, List<MonolingualTextValue> addLabels, List<MonolingualTextValue> addDescriptions, List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases, List<Statement> addStatements, List<Statement> deleteStatements, String summary, List<String> tags) throws MediaWikiApiErrorException, IOException { ItemDocument currentDocument = (ItemDocument) this.wikibaseDataFetcher .getEntityDocument(itemIdValue.getId()); return updateTermsStatements(currentDocument, addLabels, addDescriptions, addAliases, deleteAliases, addStatements, deleteStatements, summary, tags); } WikibaseDataEditor(ApiConnection connection, String siteUri);  WikibaseDataEditor(ApiConnection connection, String siteUri, GuidGenerator generator); boolean editAsBot(); void setEditAsBot(boolean editAsBot); int getMaxLag(); void setMaxLag(int maxLag); int getMaxLagMaxRetries(); void setMaxLagMaxRetries(int retries); int getMaxLagFirstWaitTime(); void setMaxLagFirstWaitTime(int time); double getMaxLagBackOffFactor(); void setMaxLagBackOffFactor(double value); int getAverageTimePerEdit(); void setAverageTimePerEdit(int milliseconds); int getRemainingEdits(); void setRemainingEdits(int remainingEdits); void disableEditing(); ItemDocument createItemDocument(ItemDocument itemDocument,
			String summary, List<String> tags); PropertyDocument createPropertyDocument(
			PropertyDocument propertyDocument, String summary, List<String> tags); ItemDocument editItemDocument(ItemDocument itemDocument,
			boolean clear, String summary, List<String> tags); PropertyDocument editPropertyDocument(
			PropertyDocument propertyDocument, boolean clear, String summary,
			List<String> tags); MediaInfoDocument editMediaInfoDocument(
			MediaInfoDocument mediaInfoDocument, boolean clear, String summary,
			List<String> tags); ItemDocument updateStatements(ItemIdValue itemIdValue,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); ItemDocument updateTermsStatements(ItemIdValue itemIdValue,
			List<MonolingualTextValue> addLabels,
			List<MonolingualTextValue> addDescriptions,
			List<MonolingualTextValue> addAliases,
			List<MonolingualTextValue> deleteAliases,
			List<Statement> addStatements,
			List<Statement> deleteStatements,
			String summary,
			List<String> tags); PropertyDocument updateStatements(PropertyIdValue propertyIdValue,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); @SuppressWarnings("unchecked") T updateStatements(T currentDocument,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); @SuppressWarnings("unchecked") T updateTermsStatements(T currentDocument,
			List<MonolingualTextValue> addLabels,
			List<MonolingualTextValue> addDescriptions,
			List<MonolingualTextValue> addAliases,
			List<MonolingualTextValue> deleteAliases,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); void nullEdit(ItemIdValue itemId); void nullEdit(PropertyIdValue propertyId); @SuppressWarnings("unchecked") T nullEdit(T currentDocument);  }