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-10.4.0.rc2 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.4.0.rc1 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.3.4 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.3.3 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.3.2 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.3.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.2.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.1.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.0.2 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.0.1 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.0.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.0.0.beta4 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.0.0.beta3 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.0.0.beta2 app/models/concerns/hydra/content_negotiation.rb
hydra-core-10.0.0.beta1 app/models/concerns/hydra/content_negotiation.rb
hydra-core-9.10.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-9.9.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-9.8.1 app/models/concerns/hydra/content_negotiation.rb
hydra-core-9.8.0 app/models/concerns/hydra/content_negotiation.rb
hydra-core-9.7.1 app/models/concerns/hydra/content_negotiation.rb