def METHOD_NAME(session, window):
    query = (
        session.query(models.Annotation)
        .filter(models.Annotation.updated.between(window.start, window.end))
        .order_by(models.Annotation.updated.asc())
    )
    ids = set()
    for annotation in query:
        normalized = uri.normalize(annotation.target_uri)
        if normalized != annotation.target_uri_normalized:
            annotation._target_uri_normalized = (  # pylint: disable=protected-access
                normalized
            )
            ids.add(annotation.id)
    return ids