Sha256: 197153f989135b410f1f7db6016134d191ebcb7640e5770049f9624c3468fac5

Contents?: true

Size: 733 Bytes

Versions: 47

Compression:

Stored size: 733 Bytes

Contents

module Hydra
  module ContentNegotiation
    def self.extended(document)
      document.will_export_as(:nt, "application/n-triples")
      document.will_export_as(:jsonld, "application/ld+json")
      document.will_export_as(:ttl, "text/turtle")
    end

    def export_as_nt
      clean_graph.dump(:ntriples)
    end

    def export_as_jsonld
      clean_graph.dump(:jsonld, :standard_prefixes => true)
    end

    def export_as_ttl
      clean_graph.dump(:ttl)
    end

    private

    def clean_graph
      @clean_graph ||= clean_graph_repository.find(id)
    end

    def clean_graph_repository
      CleanGraphRepository.new(connection)
    end

    def connection
      ActiveFedora.fedora.clean_connection
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
hydra-core-13.0.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-12.1.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-12.0.2 app/models/concerns/hydra/content_negotiation.rb
hydra-core-11.0.7 app/models/concerns/hydra/content_negotiation.rb
hydra-core-12.0.1 app/models/concerns/hydra/content_negotiation.rb
hydra-core-11.0.6 app/models/concerns/hydra/content_negotiation.rb
hydra-core-11.0.5 app/models/concerns/hydra/content_negotiation.rb
hydra-core-11.0.4 app/models/concerns/hydra/content_negotiation.rb
hydra-core-12.0.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-11.0.1 app/models/concerns/hydra/content_negotiation.rb
hydra-core-11.0.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-11.0.0.rc2 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.7.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.6.2 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.6.1 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.6.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.5.1 app/models/concerns/hydra/content_negotiation.rb
hydra-core-11.0.0.rc1 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.5.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.4.0 app/models/concerns/hydra/content_negotiation.rb