Class: PublishMyData::Ontology
- Inherits:
-
Object
- Object
- PublishMyData::Ontology
show all
- Includes:
- AllFeatures, Tripod::Resource
- Defined in:
- app/models/publish_my_data/ontology.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#deprecated?, #download_prefix, #resource_type, #slug
Class Method Details
.uri_from_slug(slug) ⇒ Object
9
10
11
|
# File 'app/models/publish_my_data/ontology.rb', line 9
def self.uri_from_slug(slug)
"http://#{PublishMyData.local_domain}/def/#{slug}"
end
|
Instance Method Details
#classes ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/models/publish_my_data/ontology.rb', line 13
def classes
@classes ||= OntologyClass.find_by_sparql("
SELECT DISTINCT ?uri ?graph
WHERE {
GRAPH ?graph {
{
?uri <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <#{self.uri}> .
?uri a <http://www.w3.org/2002/07/owl#Class> .
}
UNION
{
?uri <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <#{self.uri}> .
?uri a <http://www.w3.org/2000/01/rdf-schema#Class>
}
}
}"
)
end
|
#classes_sorted ⇒ Object
32
33
34
|
# File 'app/models/publish_my_data/ontology.rb', line 32
def classes_sorted
Ontology.sort_by_label_or_uri(classes)
end
|
#eager_load! ⇒ Object
56
57
58
59
60
|
# File 'app/models/publish_my_data/ontology.rb', line 56
def eager_load!
super
classes.each{|c| c.eager_load!}
properties.each{|p| p.eager_load!}
end
|
#local? ⇒ Boolean
52
53
54
|
# File 'app/models/publish_my_data/ontology.rb', line 52
def local?
true
end
|
#properties ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/models/publish_my_data/ontology.rb', line 36
def properties
@properties ||= Property.find_by_sparql("
SELECT DISTINCT ?uri ?graph
WHERE {
GRAPH ?graph {
?uri <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <#{self.uri}> .
?uri a <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> .
}
}"
)
end
|
#properties_sorted ⇒ Object
48
49
50
|
# File 'app/models/publish_my_data/ontology.rb', line 48
def properties_sorted
Ontology.sort_by_label_or_uri(properties)
end
|