Module: ActiveFedora::Aggregation::BaseExtension

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_fedora/aggregation/base_extension.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#aggregated_byArray

Queries the RDF graph to find all records that include this object in their aggregations Since any class may be the target of an aggregation, this must be on every class extending from ActiveFedora::Base

Returns:

  • (Array)

    records that include this object in their aggregations



9
10
11
12
13
14
15
16
17
# File 'lib/active_fedora/aggregation/base_extension.rb', line 9

def aggregated_by
  # In theory you should be able to find the aggregation predicate (ie ore:aggregates)
  # but Fedora does not return that predicate due to this bug in FCREPO:
  #   https://jira.duraspace.org/browse/FCREPO-1497
  # so we have to look up the proxies asserting RDF::Vocab::ORE.proxyFor
  # and return their containers.
  return [] unless id
  proxy_class.where(proxyFor_ssim: id).map(&:container)
end

#ordered_byObject



19
20
21
# File 'lib/active_fedora/aggregation/base_extension.rb', line 19

def ordered_by
  ordered_by_ids.lazy.map{ |x| ActiveFedora::Base.find(x) }
end