def values_for_predicate(predicates, provider_uri = nil)
      raise ArgumentError, 'provider_uri must be an RDF::URI' unless
        provider_uri.respond_to? :to_uri

      optional_patterns = build_optional_patterns(predicates)

      optional_patterns << [TYPE, RDF::EDM.isShownAt, :isShownAt]

      SPARQL_CLIENT.select(TYPE, VALUE, :isShownAt)
        .where(*where_patterns(provider_uri))
        .optional(*optional_patterns)
        .order_by(TYPE)
    end
def values_for_predicate(predicates, provider_uri = nil)
      raise ArgumentError, 'provider_uri must be an RDF::URI' unless
        provider_uri.respond_to? :to_uri

      optional_patterns = build_optional_patterns(predicates)

      optional_patterns << [TYPE, RDF::EDM.isShownAt, :isShownAt]

      SPARQL_CLIENT.select(TYPE, VALUE, :isShownAt)
        .where(*where_patterns(provider_uri))
        .optional(*optional_patterns)
        .order_by(TYPE)
    end
Writes a {SPARQL::Client::Query} against the Repository for values
 matching at the end of a chain of predicates.

 @example
   QAQueryClient.values_for_predicate(RDF::EDM.hasView,
     RDF::URI('http://example.org/moomin'))
   => #<SPARQL::Client::Query:0x3fb814e241e8(
        SELECT ?aggregation ?value ?isShownAt WHERE {
          ?aggregation <http://www.europeana.eu/schemas/edm/provider>
            <http://example.org/moomin> .
          ?aggregation a
            <http://www.openarchives.org/ore/terms/Aggregation> .
          OPTIONAL {
            ?aggregation <http://www.europeana.eu/schemas/edm/hasView>
              ?value .
            ?aggregation <http://www.europeana.eu/schemas/edm/isShownAt>
              ?isShownAt .
          }
        } ORDER BY ?aggregation)>

 @example
   QAQueryClient.values_for_predicate([RDF::EDM.aggregatedCHO,
                                       RDF::DC.title],
     RDF::URI('http://example.org/moomin').execute.first.value
   => #<SPARQL::Client::Query:0x3fb814e8379c(
        SELECT ?aggregation ?value ?isShownAt WHERE {
          ?aggregation <http://www.europeana.eu/schemas/edm/provider>
            <http://example.org/moomin> .
          ?aggregation a
            <http://www.openarchives.org/ore/terms/Aggregation> .
          OPTIONAL {
            ?aggregation
              <http://www.europeana.eu/schemas/edm/aggregatedCHO> ?obj0 .
            ?obj0 <http://purl.org/dc/terms/title> ?value .
            ?aggregation <http://www.europeana.eu/schemas/edm/isShownAt>
              ?isShownAt .
          }
        } ORDER BY ?aggregation)>

 @example
   QAQueryClient.values_for_predicate([RDF::EDM.aggregatedCHO,
                                       RDF::DC.title],
     RDF::URI('http://example.org/moomin').execute.first.value
   # => "Stonewall Inn [2]"

 @param predicates [#to_uri, Array<#to_uri>] a predicate or list of
   predicates to query
 @param provider_uri [#to_uri] a URI for an edm:provider value. Results
   will be filtered to Resources that have this provider.

 @return [SPARQL::Client::Query] a query object that will give solutions
   with `:value`, `:aggregation`, and `:isShownAt` variables.