Sha256: bcd5745152fd0cabfdfe5b90bf9a95c8ad87e49c2485d950f3cf3a4d676cf7b8

Contents?: true

Size: 976 Bytes

Versions: 31

Compression:

Stored size: 976 Bytes

Contents

module PublishMyData
  module DatasetsHelper
    def formatted_date(date_string)
      unless date_string.blank?
        DateTime.parse(date_string).to_s(:long)
      else 
        date_string
      end
    end

    def vocabulary_class(dataset, uri)
      dataset.ontologies.each_with_index do |ontology, index|
        uris = ontology.classes.map(&:uri) + ontology.properties.map(&:uri)
        return "ontology_#{index}" if uris.any?{|u| uri == u}
      end
      dataset.concept_schemes.each_with_index do |concept_scheme, index|
        uris = concept_scheme.concepts.map(&:uri)
        return "concept_scheme_#{index}" if uris.any?{|u| uri == u}
      end
      return ''
    end

    def example_resource_for_type(dataset, type)
      dataset.example_resources.detect {|r| r.rdf_type.include?(type.uri) }
    end

    def types_for_example_resource(dataset, example_resource)
      dataset.types.select {|t| example_resource.rdf_type.include?(t.uri) }
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

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