Method: Valkyrie::Persistence::Fedora::QueryService#find_parents
- Defined in:
- lib/valkyrie/persistence/fedora/query_service.rb
#find_parents(resource:) ⇒ Array<Valkyrie::Resource>
Find all parents of a given resource.
41 42 43 44 45 46 47 48 |
# File 'lib/valkyrie/persistence/fedora/query_service.rb', line 41 def find_parents(resource:) content = content_with_inbound(id: resource.id) parent_ids = content.graph.query([nil, RDF::Vocab::ORE.proxyFor, nil]).map(&:subject).map { |x| x.to_s.gsub(/#.*/, '') }.map { |x| adapter.uri_to_id(x) } parent_ids.uniq! parent_ids.lazy.map do |id| find_by(id: id) end end |