Class: Hyrax::GraphExporter
- Inherits:
-
Object
- Object
- Hyrax::GraphExporter
- Defined in:
- app/services/hyrax/graph_exporter.rb
Overview
Retrieves the graph for an object with the internal triples removed and the uris translated to external uris.
Defined Under Namespace
Classes: ListSourceExporter
Instance Attribute Summary collapse
- #additional_resources ⇒ Array<RDF::Graph> readonly
- #hostname ⇒ Object readonly
-
#request ⇒ ActionDispatch::Request
readonly
deprecated
Deprecated.
use #hostname to access the host
- #solr_document ⇒ #id readonly
Instance Method Summary collapse
- #fetch ⇒ RDF::Graph
-
#initialize(solr_document, request = nil, hostname: nil) ⇒ GraphExporter
constructor
A new instance of GraphExporter.
Constructor Details
#initialize(solr_document, request = nil, hostname: nil) ⇒ GraphExporter
Returns a new instance of GraphExporter.
13 14 15 16 17 18 19 20 |
# File 'app/services/hyrax/graph_exporter.rb', line 13 def initialize(solr_document, request = nil, hostname: nil) Deprecation.warn('passing `request` is deprecated; pass a host as `hostname:` instead.') if request @solr_document = solr_document @request = request @hostname = hostname || request.host @additional_resources = [] @visited_subresources = Set.new end |
Instance Attribute Details
#additional_resources ⇒ Array<RDF::Graph> (readonly)
32 |
# File 'app/services/hyrax/graph_exporter.rb', line 32 attr_reader :solr_document, :request, :additional_resources, :hostname |
#hostname ⇒ Object (readonly)
32 |
# File 'app/services/hyrax/graph_exporter.rb', line 32 attr_reader :solr_document, :request, :additional_resources, :hostname |
#request ⇒ ActionDispatch::Request (readonly)
Deprecated.
use #hostname to access the host
32 |
# File 'app/services/hyrax/graph_exporter.rb', line 32 attr_reader :solr_document, :request, :additional_resources, :hostname |
#solr_document ⇒ #id (readonly)
32 33 34 |
# File 'app/services/hyrax/graph_exporter.rb', line 32 def solr_document @solr_document end |
Instance Method Details
#fetch ⇒ RDF::Graph
37 38 39 40 41 42 43 44 |
# File 'app/services/hyrax/graph_exporter.rb', line 37 def fetch clean_graph_repository.find(solr_document.id).tap do |g| additional_resources.each { |subgraph| g << subgraph } end rescue Ldp::NotFound # this error is handled with a 404 page. raise Hyrax::ObjectNotFoundError end |