Method: PublishMyData::DatasetsHelper#vocabulary_class

Defined in:
app/helpers/publish_my_data/datasets_helper.rb

#vocabulary_class(dataset, uri) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/publish_my_data/datasets_helper.rb', line 11

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