use of org.wikidata.wdtk.datamodel.helpers.StatementUpdateBuilder in project OpenRefine by OpenRefine.
the class TermedStatementEntityEdit method toStatementUpdate.
/**
* Generates the statement update given the current statement groups on the entity.
* @param currentDocument
* @return
*/
protected StatementUpdate toStatementUpdate(StatementDocument currentDocument) {
Map<PropertyIdValue, List<StatementEdit>> groupedEdits = statements.stream().collect(Collectors.groupingBy(StatementEdit::getPropertyId));
StatementUpdateBuilder builder = StatementUpdateBuilder.create(currentDocument.getEntityId());
for (Entry<PropertyIdValue, List<StatementEdit>> entry : groupedEdits.entrySet()) {
StatementGroupEdit statementGroupEdit = new StatementGroupEdit(entry.getValue());
StatementGroup statementGroup = currentDocument.findStatementGroup(entry.getKey().getId());
statementGroupEdit.contributeToStatementUpdate(builder, statementGroup);
}
return builder.build();
}
Aggregations