protected void fixIntegerPrecisions(ItemIdValue itemIdValue,
			String propertyId) {

		String qid = itemIdValue.getId();

		try {
			// Fetch the online version of the item to make sure we edit the
			// current version:
			ItemDocument currentItemDocument = (ItemDocument) dataFetcher
					.getEntityDocument(qid);
			if (currentItemDocument == null) {
				System.out.println("*** " + qid
						+ " could not be fetched. Maybe it has been deleted.");
				return;
			}

			// Get the current statements for the property we want to fix:
			StatementGroup editPropertyStatements = currentItemDocument
					.findStatementGroup(propertyId);
			if (editPropertyStatements == null) {
				System.out.println("*** " + qid
						+ " no longer has any statements for " + propertyId);
				return;
			}

			PropertyIdValue property = Datamodel
					.makeWikidataPropertyIdValue(propertyId);
			List<Statement> updateStatements = new ArrayList<>();
			for (Statement s : editPropertyStatements) {
				QuantityValue qv = (QuantityValue) s.getValue();
				if (qv != null && isPlusMinusOneValue(qv)) {
					QuantityValue exactValue = Datamodel.makeQuantityValue(
							qv.getNumericValue(), qv.getNumericValue(),
							qv.getNumericValue());
					Statement exactStatement = StatementBuilder
							.forSubjectAndProperty(itemIdValue, property)
							.withValue(exactValue).withId(s.getStatementId())
							.withQualifiers(s.getQualifiers())
							.withReferences(s.getReferences())
							.withRank(s.getRank()).build();
					updateStatements.add(exactStatement);
				}
			}

			if (updateStatements.size() == 0) {
				System.out.println("*** " + qid + " quantity values for "
						+ propertyId + " already fixed");
				return;
			}

			logEntityModification(currentItemDocument.getEntityId(),
					updateStatements, propertyId);

			dataEditor.updateStatements(currentItemDocument, updateStatements,
					Collections.<Statement> emptyList(),
					"Set exact values for [[Property:" + propertyId + "|"
							+ propertyId + "]] integer quantities (Task MB2)");

		} catch (MediaWikiApiErrorException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
protected void fixIntegerPrecisions ( ItemIdValue itemIdValue , String propertyId ) { String qid = itemIdValue . getId ( ) ; try { ItemDocument currentItemDocument = ( ItemDocument ) dataFetcher . getEntityDocument ( qid ) ; if ( currentItemDocument == null ) { System . out . println ( "*** " + qid + " could not be fetched. Maybe it has been deleted." ) ; return ; } StatementGroup editPropertyStatements = currentItemDocument . findStatementGroup ( propertyId ) ; if ( editPropertyStatements == null ) { System . out . println ( "*** " + qid + " no longer has any statements for " + propertyId ) ; return ; } PropertyIdValue property = Datamodel . makeWikidataPropertyIdValue ( propertyId ) ; List < Statement > updateStatements = new ArrayList < > ( ) ; for ( Statement s : editPropertyStatements ) { QuantityValue qv = ( QuantityValue ) s . getValue ( ) ; if ( qv != null && isPlusMinusOneValue ( qv ) ) { QuantityValue exactValue = Datamodel . makeQuantityValue ( qv . getNumericValue ( ) , qv . getNumericValue ( ) , qv . getNumericValue ( ) ) ; Statement exactStatement = StatementBuilder . forSubjectAndProperty ( itemIdValue , property ) . withValue ( exactValue ) . withId ( s . getStatementId ( ) ) . withQualifiers ( s . getQualifiers ( ) ) . withReferences ( s . getReferences ( ) ) . withRank ( s . getRank ( ) ) . build ( ) ; updateStatements . add ( exactStatement ) ; } } if ( updateStatements . size ( ) == 0 ) { System . out . println ( "*** " + qid + " quantity values for " + propertyId + " already fixed" ) ; return ; } logEntityModification ( currentItemDocument . getEntityId ( ) , updateStatements , propertyId ) ; dataEditor . updateStatements ( currentItemDocument , updateStatements , Collections . < Statement > emptyList ( ) , "Set exact values for [[Property:" + propertyId + "|" + propertyId + "]] integer quantities (Task MB2)" ) ; } catch ( MediaWikiApiErrorException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Fetches the current online data for the given item, and fixes the
precision of integer quantities if necessary.

@param itemIdValue
the id of the document to inspect
@param propertyId
id of the property to consider