Sha256: ea91ca6a7221980428193eb49a9f536c1789b15458b47afdc3c7ea2c7d1402a9
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
module PublishMyData module DatasetsHelper def formatted_date(date_string) DateTime.parse(date_string).to_s(:long) end def link_to_resource_uri_or_label(resource, term) link_to resource_uri_or_label(resource, term), resource_path_from_uri(term) 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
4 entries across 4 versions & 1 rubygems