protected void markStatementsForInsertion ( StatementDocument currentDocument , List < Statement > addStatements ) { for ( Statement statement : addStatements ) { addStatement ( statement , true ) ; } for ( StatementGroup sg : currentDocument . getStatementGroups ( ) ) { if ( this . toKeep . containsKey ( sg . getProperty ( ) ) ) { for ( Statement statement : sg ) { if ( ! this . toDelete . contains ( statement . getStatementId ( ) ) ) { addStatement ( statement , false ) ; } } } } }
Marks a given list of statements for insertion into the current document . Inserted statements can have an id if they should update an existing statement or use an empty string as id if they should be added . The method removes duplicates and avoids unnecessary modifications by checking the current content of the given document before marking statements for being written .