publish_my_data 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/helpers/publish_my_data/datasets_helper.rb +0 -4
- data/app/models/publish_my_data/third_party/concept_scheme.rb +5 -0
- data/app/models/publish_my_data/third_party/ontology.rb +5 -0
- data/app/views/publish_my_data/datasets/_example_resources.html.haml +2 -2
- data/app/views/publish_my_data/sparql/_form.html.haml +17 -15
- data/app/views/publish_my_data/sparql/endpoint.html.haml +2 -2
- data/lib/publish_my_data/version.rb +1 -1
- data/spec/dummy/log/test.log +70072 -0
- metadata +25 -25
@@ -4,10 +4,6 @@ module PublishMyData
|
|
4
4
|
DateTime.parse(date_string).to_s(:long)
|
5
5
|
end
|
6
6
|
|
7
|
-
def link_to_resource_uri_or_label(resource, term)
|
8
|
-
link_to resource_uri_or_label(resource, term), resource_path_from_uri(term)
|
9
|
-
end
|
10
|
-
|
11
7
|
def vocabulary_class(dataset, uri)
|
12
8
|
dataset.ontologies.each_with_index do |ontology, index|
|
13
9
|
uris = ontology.classes.map(&:uri) + ontology.properties.map(&:uri)
|
@@ -3,6 +3,11 @@ module PublishMyData
|
|
3
3
|
class ConceptScheme < PublishMyData::ConceptScheme
|
4
4
|
delegate :comment, :description, :license, :publisher, :contact_email, to: :data_resource
|
5
5
|
|
6
|
+
# if there's no data graph set, return the graph uri
|
7
|
+
def data_graph_uri
|
8
|
+
super || self.graph_uri
|
9
|
+
end
|
10
|
+
|
6
11
|
# Overrides
|
7
12
|
['to_rdf', 'to_ttl', 'to_nt', 'to_json'].each do |method_name|
|
8
13
|
define_method method_name do |opts={}|
|
@@ -3,6 +3,11 @@ module PublishMyData
|
|
3
3
|
class Ontology < PublishMyData::Ontology
|
4
4
|
delegate :comment, :description, :license, :publisher, :contact_email, to: :data_resource
|
5
5
|
|
6
|
+
# if there's no data graph set, return the graph uri
|
7
|
+
def data_graph_uri
|
8
|
+
super || self.graph_uri
|
9
|
+
end
|
10
|
+
|
6
11
|
# Overrides
|
7
12
|
['to_rdf', 'to_ttl', 'to_nt', 'to_json'].each do |method_name|
|
8
13
|
define_method method_name do |opts={}|
|
@@ -21,11 +21,11 @@
|
|
21
21
|
- resource.predicates.each do |pred|
|
22
22
|
%tr
|
23
23
|
%td
|
24
|
-
%span(class="#{ vocabulary_class(dataset, pred) }")=
|
24
|
+
%span(class="#{ vocabulary_class(dataset, pred) }")= resource_uri_or_label(resource, pred)
|
25
25
|
%td
|
26
26
|
%ul
|
27
27
|
- resource.read_predicate(pred).each do |obj|
|
28
|
-
%li(class="#{ vocabulary_class(dataset, obj) }")=
|
28
|
+
%li(class="#{ vocabulary_class(dataset, obj) }")= resource_uri_or_label(resource, obj)
|
29
29
|
|
30
30
|
%tfoot
|
31
31
|
%tr
|
@@ -7,22 +7,24 @@
|
|
7
7
|
%fieldset.sparql-parameters
|
8
8
|
%legend Parameters
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
.fields
|
11
|
+
- @expected_variables.each do |v|
|
12
12
|
|
13
|
-
|
13
|
+
:ruby
|
14
|
+
field_options = {:class => 'field'}
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
if @missing_variables && @missing_variables.include?(v)
|
17
|
+
field_options.merge!(:class => 'field has-error')
|
18
|
+
end
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
- unless @reserved_variables_used && @reserved_variables_used.include?(v)
|
21
|
+
- # don't include reserved ones
|
22
|
+
= content_tag :div, field_options do
|
23
|
+
%label=v
|
24
|
+
= text_field_tag v, @interpolations[v]
|
25
|
+
.notes
|
26
|
+
:markdown
|
27
|
+
Values supplied will be substituted into the query in place of the <code>%{tokens}</code>. See the [developer docs](/docs) for more details.
|
21
28
|
|
22
|
-
|
23
|
-
|
24
|
-
= content_tag :div, field_options do
|
25
|
-
%label=v
|
26
|
-
= text_field_tag v, @interpolations[v]
|
27
|
-
|
28
|
-
= submit_tag "Run Query", id: 'run-sparql-query'
|
29
|
+
.run
|
30
|
+
= submit_tag "Run Query", id: 'run-sparql-query'
|
@@ -13,7 +13,7 @@
|
|
13
13
|
%h1 Run a SPARQL Query
|
14
14
|
|
15
15
|
- if @sparql_query || @error_message
|
16
|
-
%section
|
16
|
+
%section.results
|
17
17
|
- if @error_message
|
18
18
|
#error-message
|
19
19
|
%h3 Sorry, your query failed to run.</h3>
|
@@ -62,7 +62,7 @@
|
|
62
62
|
new Swirrl.SparqlResultsGrid(encodedQuery);
|
63
63
|
});
|
64
64
|
|
65
|
-
%section
|
65
|
+
%section.query
|
66
66
|
- if @sparql_query
|
67
67
|
%h3 Edit the query
|
68
68
|
- else
|