def insert_time_interval_bounds(skolem, derived_from):
    """
    Returns a prepared SPARQL INSERT statement that attaches maximum and minimum for a given PeriodCollection.
    :skolem:
    ::
    :returns: rdflib.plugins.sparql.preparedQuery object
    """

    return """
    INSERT {{
        <{skolem}> time:intervalStartedBy [
            time:hasDateTimeDescription [
                time:year ?minYear
            ]
        ] .
        <{skolem}> time:intervalFinishedBy [
            time:hasDateTimeDescription [
                time:year ?maxYear
            ]
        ] .
    }}
    WHERE {{
        SELECT (MIN(?startYear) AS ?minYear) (MAX(?endYear) AS ?maxYear)
        WHERE {{
            ?subject a skos:Concept ;
                time:intervalStartBy [
                    time:hasDateTimeDescription [
                        time:year ?startYear
                    ] 
                ];
                time:intervalFinishedBy [
                    time:hasDateTimeDescription [
                       time:year ?maxYear
                    ]
                ] .
            FILTER( ?subject IN( <{filters}> ) )
        }}
    }}
    """.format(

        filters=">, <".join(derived_from),
        skolem=skolem

    )