Sha256: d621dcd4417ba367401617a614908402663f9d8d69ffce84a942b04a22084beb

Contents?: true

Size: 832 Bytes

Versions: 7

Compression:

Stored size: 832 Bytes

Contents

module PublishMyData
  module ThirdParty
    class ConceptScheme < PublishMyData::ConceptScheme
      delegate :comment, :description, :license, :publisher, :contact_email, to: :data_resource

      # Overrides
      ['to_rdf', 'to_ttl', 'to_nt', 'to_json'].each do |method_name|
        define_method method_name do |opts={}|
          resources = Resource.find_by_sparql("
            SELECT DISTINCT ?uri
            WHERE { GRAPH <#{self.data_graph_uri}> {?uri ?p ?o} }
          ")
          Tripod::ResourceCollection.new(resources).send(method_name)
        end
      end

      def local?
        false
      end

      private

      def data_resource
        @data_resource = PublishMyData::ConceptScheme.new(self.uri, self.data_graph_uri)
        @data_resource.hydrate!
        @data_resource
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
publish_my_data-1.0.3 app/models/publish_my_data/third_party/concept_scheme.rb
publish_my_data-1.0.2 app/models/publish_my_data/third_party/concept_scheme.rb
publish_my_data-1.0.1 app/models/publish_my_data/third_party/concept_scheme.rb
publish_my_data-1.0.0 app/models/publish_my_data/third_party/concept_scheme.rb
publish_my_data-0.0.32 app/models/publish_my_data/third_party/concept_scheme.rb
publish_my_data-0.0.31 app/models/publish_my_data/third_party/concept_scheme.rb
publish_my_data-0.0.30 app/models/publish_my_data/third_party/concept_scheme.rb