Sha256: ef86f0fdb2b260d02541596d98347f07ba39347776d329faf18eed2183875a6d

Contents?: true

Size: 955 Bytes

Versions: 31

Compression:

Stored size: 955 Bytes

Contents

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

      # if there's no data graph set, return the graph uri
      def data_graph_uri
        super || self.graph_uri
      end

      # 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::Ontology.new(self.uri, graph_uri: self.data_graph_uri)
        @data_resource.hydrate!
        @data_resource
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
publish_my_data-1.3.25 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.24 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.23 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.22 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.21 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.20 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.19 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.18 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.17 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.16 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.15 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.14 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.13 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.12 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.11 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.10 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.9 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.8 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.7 app/models/publish_my_data/third_party/ontology.rb
publish_my_data-1.3.6 app/models/publish_my_data/third_party/ontology.rb