Sha256: 1136c05ea3512b34223a2040760a973b00cd638859784e7c829d735ea208b2de

Contents?: true

Size: 753 Bytes

Versions: 4

Compression:

Stored size: 753 Bytes

Contents

module PublishMyData
  # A theme for datasets
  class Theme

    include Tripod::Resource
    include PublishMyData::ResourceModule #some common methods for resources.

    class << self
      def theme_graph
        RDF::URI.new("http://#{PublishMyData.local_domain}/graph/concept-scheme/themes")
      end

      def by_slug(slug)
        Theme.where("?uri <#{RDF::SKOS.notation}> '#{slug}'").first
      end
    end

    rdf_type RDF::SITE.Theme
    graph_uri Theme.theme_graph

    field :label, RDF::RDFS.label
    field :slug, RDF::SKOS.notation
    field :description, RDF::RDFS.description

    def datasets_criteria
      Dataset.where("?uri <#{RDF::DCAT.theme}> <#{self.uri.to_s}>")
    end

    def to_param
      self.slug
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
publish_my_data-0.0.10 app/models/publish_my_data/theme.rb
publish_my_data-0.0.9 app/models/publish_my_data/theme.rb
publish_my_data-0.0.8 app/models/publish_my_data/theme.rb
publish_my_data-0.0.7 app/models/publish_my_data/theme.rb