Class: PublishMyData::Theme
- Inherits:
-
Object
- Object
- PublishMyData::Theme
show all
- Includes:
- BasicFeatures, Tripod::Resource
- Defined in:
- app/models/publish_my_data/theme.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
#eager_load!, #in_domain?
Class Method Details
.by_slug(slug) ⇒ Object
13
14
15
|
# File 'app/models/publish_my_data/theme.rb', line 13
def by_slug(slug)
Theme.where("?uri <#{RDF::SKOS.notation}> '#{slug}'").first
end
|
.theme_graph ⇒ Object
9
10
11
|
# File 'app/models/publish_my_data/theme.rb', line 9
def theme_graph
RDF::URI.new("http://#{PublishMyData.local_domain}/graph/concept-scheme/themes")
end
|
Instance Method Details
#datasets_query_str ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'app/models/publish_my_data/theme.rb', line 27
def datasets_query_str
"
SELECT ?uri where {
# this bit is all the non-deprecated ones
{
SELECT * WHERE {
?uri a <http://publishmydata.com/def/dataset#Dataset> .
?uri <#{RDF::DCAT.theme}> <#{self.uri.to_s}> . # limit to this theme
?uri <#{RDF::DC.title}> ?title . # select title so we can order
MINUS {
?uri a <http://publishmydata.com/def/dataset#DeprecatedDataset>
}
}
ORDER BY ?title
}
UNION
# this bit is all the deprecated ones
{
SELECT * WHERE {
?uri a <http://publishmydata.com/def/dataset#DeprecatedDataset> .
?uri <#{RDF::DCAT.theme}> <#{self.uri.to_s}> . # limit to this theme
?uri <#{RDF::DC.title}> ?title . # select title so we can order
}
ORDER BY ?title
}
}
"
end
|
#to_param ⇒ Object
57
58
59
|
# File 'app/models/publish_my_data/theme.rb', line 57
def to_param
self.slug
end
|