Class: PublishMyData::ConceptScheme

Inherits:
Object
  • Object
show all
Includes:
AllFeatures, Tripod::Resource
Defined in:
app/models/publish_my_data/concept_scheme.rb

Direct Known Subclasses

ThirdParty::ConceptScheme

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AllFeatures

#deprecated?, #download_prefix, #resource_type, #slug

Class Method Details

.uri_from_slug(slug) ⇒ Object



9
10
11
# File 'app/models/publish_my_data/concept_scheme.rb', line 9

def self.uri_from_slug(slug)
  "http://#{PublishMyData.local_domain}/def/#{slug}"
end

Instance Method Details

#conceptsObject



13
14
15
16
17
18
19
20
21
22
23
# File 'app/models/publish_my_data/concept_scheme.rb', line 13

def concepts
  @concepts ||= Concept.find_by_sparql(
    "SELECT DISTINCT ?uri ?graph
      WHERE {
        GRAPH ?graph {
          ?uri <#{RDF::SKOS.inScheme.to_s}> <#{self.uri}> .
          ?uri a <#{RDF::SKOS.Concept.to_s}> .
      }
    }"
  )
end

#concepts_sortedObject



25
26
27
# File 'app/models/publish_my_data/concept_scheme.rb', line 25

def concepts_sorted
  ConceptScheme.sort_by_label_or_uri(concepts)
end

#eager_load!Object



33
34
35
36
# File 'app/models/publish_my_data/concept_scheme.rb', line 33

def eager_load!
  super
  self.concepts.each{|c| c.eager_load!}
end

#local?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'app/models/publish_my_data/concept_scheme.rb', line 29

def local?
  true
end