publish_my_data 0.0.32 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/images/publish_my_data/small-spinner.gif +0 -0
- data/app/assets/images/publish_my_data/sort-asc.gif +0 -0
- data/app/assets/images/publish_my_data/sort-desc.gif +0 -0
- data/app/assets/javascripts/bootstrap/affix.js +126 -0
- data/app/assets/javascripts/bootstrap/alert.js +98 -0
- data/app/assets/javascripts/bootstrap/button.js +109 -0
- data/app/assets/javascripts/bootstrap/carousel.js +217 -0
- data/app/assets/javascripts/bootstrap/collapse.js +179 -0
- data/app/assets/javascripts/bootstrap/dropdown.js +154 -0
- data/app/assets/javascripts/bootstrap/modal.js +246 -0
- data/app/assets/javascripts/bootstrap/popover.js +117 -0
- data/app/assets/javascripts/bootstrap/scrollspy.js +158 -0
- data/app/assets/javascripts/bootstrap/tab.js +135 -0
- data/app/assets/javascripts/bootstrap/tooltip.js +386 -0
- data/app/assets/javascripts/bootstrap/transition.js +56 -0
- data/app/assets/javascripts/publish_my_data/grid/10_data-loader.js +142 -0
- data/app/assets/javascripts/publish_my_data/grid/20_cube-grid.js +512 -0
- data/app/assets/javascripts/publish_my_data/grid/30_cube-dimension.js +77 -0
- data/app/assets/javascripts/publish_my_data/grid/40_cube-dimension-dropdown.js +87 -0
- data/app/assets/javascripts/publish_my_data/grid/45_cube-dimension-label.js +58 -0
- data/app/assets/javascripts/publish_my_data/grid/50_cube-dimensions-controls.js +336 -0
- data/app/assets/javascripts/publish_my_data/grid/60_dataset_cube_grid.js +187 -0
- data/app/assets/javascripts/publish_my_data/grid/70_sparql_results_grid.js +135 -0
- data/app/assets/javascripts/publish_my_data/select_text.js +27 -0
- data/app/assets/javascripts/publish_my_data.js +3 -0
- data/app/assets/javascripts/slick_grid/10_event-drag.js +402 -0
- data/app/assets/javascripts/slick_grid/20_slick-core.js +458 -0
- data/app/assets/javascripts/slick_grid/30_slick-grid.js +3295 -0
- data/app/assets/stylesheets/bootstrap/_alerts.scss +67 -0
- data/app/assets/stylesheets/bootstrap/_badges.scss +51 -0
- data/app/assets/stylesheets/bootstrap/_breadcrumbs.scss +23 -0
- data/app/assets/stylesheets/bootstrap/_button-groups.scss +248 -0
- data/app/assets/stylesheets/bootstrap/_buttons.scss +160 -0
- data/app/assets/stylesheets/bootstrap/_carousel.scss +209 -0
- data/app/assets/stylesheets/bootstrap/_close.scss +33 -0
- data/app/assets/stylesheets/bootstrap/_code.scss +56 -0
- data/app/assets/stylesheets/bootstrap/_component-animations.scss +29 -0
- data/app/assets/stylesheets/bootstrap/_dropdowns.scss +194 -0
- data/app/assets/stylesheets/bootstrap/_forms.scss +350 -0
- data/app/assets/stylesheets/bootstrap/_glyphicons.scss +232 -0
- data/app/assets/stylesheets/bootstrap/_grid.scss +346 -0
- data/app/assets/stylesheets/bootstrap/_input-groups.scss +127 -0
- data/app/assets/stylesheets/bootstrap/_jumbotron.scss +40 -0
- data/app/assets/stylesheets/bootstrap/_labels.scss +58 -0
- data/app/assets/stylesheets/bootstrap/_list-group.scss +88 -0
- data/app/assets/stylesheets/bootstrap/_media.scss +56 -0
- data/app/assets/stylesheets/bootstrap/_mixins.scss +728 -0
- data/app/assets/stylesheets/bootstrap/_modals.scss +145 -0
- data/app/assets/stylesheets/bootstrap/_navbar.scss +625 -0
- data/app/assets/stylesheets/bootstrap/_navs.scss +229 -0
- data/app/assets/stylesheets/bootstrap/_normalize.scss +396 -0
- data/app/assets/stylesheets/bootstrap/_pager.scss +55 -0
- data/app/assets/stylesheets/bootstrap/_pagination.scss +83 -0
- data/app/assets/stylesheets/bootstrap/_panels.scss +148 -0
- data/app/assets/stylesheets/bootstrap/_popovers.scss +133 -0
- data/app/assets/stylesheets/bootstrap/_print.scss +100 -0
- data/app/assets/stylesheets/bootstrap/_progress-bars.scss +95 -0
- data/app/assets/stylesheets/bootstrap/_responsive-utilities.scss +209 -0
- data/app/assets/stylesheets/bootstrap/_scaffolding.scss +130 -0
- data/app/assets/stylesheets/bootstrap/_tables.scss +236 -0
- data/app/assets/stylesheets/bootstrap/_theme.scss +232 -0
- data/app/assets/stylesheets/bootstrap/_thumbnails.scss +31 -0
- data/app/assets/stylesheets/bootstrap/_tooltip.scss +95 -0
- data/app/assets/stylesheets/bootstrap/_type.scss +238 -0
- data/app/assets/stylesheets/bootstrap/_utilities.scss +42 -0
- data/app/assets/stylesheets/bootstrap/_variables.scss +620 -0
- data/app/assets/stylesheets/bootstrap/_wells.scss +29 -0
- data/app/assets/stylesheets/bootstrap/bootstrap.scss +59 -0
- data/app/assets/stylesheets/publish_my_data/core.scss +244 -0
- data/app/assets/stylesheets/publish_my_data/data_grid.scss +103 -0
- data/app/assets/stylesheets/publish_my_data/variables.scss +1 -0
- data/app/assets/stylesheets/{publish_my_data.css → publish_my_data.scss} +13 -2
- data/app/assets/stylesheets/slick_grid/slick_grid.scss +155 -0
- data/app/assets/stylesheets/slick_grid/slick_grid_default_theme.scss +97 -0
- data/app/controllers/concerns/publish_my_data/data_cube.rb +42 -0
- data/app/controllers/publish_my_data/data_cube/dimensions_controller.rb +58 -0
- data/app/controllers/publish_my_data/data_cube/observations_controller.rb +54 -0
- data/app/controllers/publish_my_data/datasets_controller.rb +0 -11
- data/app/controllers/publish_my_data/example_resources_controller.rb +11 -0
- data/app/controllers/publish_my_data/home_controller.rb +4 -0
- data/app/controllers/publish_my_data/information_resources_controller.rb +0 -13
- data/app/helpers/publish_my_data/application_helper.rb +66 -0
- data/app/helpers/publish_my_data/crumb_helper.rb +61 -0
- data/app/helpers/publish_my_data/datasets_helper.rb +31 -0
- data/app/helpers/publish_my_data/resources_helper.rb +24 -0
- data/app/models/concerns/publish_my_data/cube_results.rb +51 -0
- data/app/models/concerns/publish_my_data/dataset_powers.rb +13 -0
- data/app/models/publish_my_data/data_cube/cube.rb +358 -0
- data/app/models/publish_my_data/data_cube/dimension.rb +58 -0
- data/app/models/publish_my_data/vocabulary.rb +0 -4
- data/app/views/layouts/publish_my_data/application.html.haml +18 -0
- data/app/views/layouts/publish_my_data/error.html.haml +21 -0
- data/app/views/publish_my_data/classes/show.html.haml +28 -0
- data/app/views/publish_my_data/concept_schemes/show.html.haml +79 -0
- data/app/views/publish_my_data/concepts/show.html.haml +28 -0
- data/app/views/publish_my_data/data_cube/_controls.html.haml +19 -0
- data/app/views/publish_my_data/data_cube/_grid.html.haml +37 -0
- data/app/views/publish_my_data/datasets/_example_resources.html.haml +47 -0
- data/app/views/publish_my_data/datasets/_types_table.html.erb +33 -0
- data/app/views/publish_my_data/datasets/index.html.haml +32 -0
- data/app/views/publish_my_data/datasets/show.html.haml +186 -0
- data/app/views/publish_my_data/errors/not_found.html.haml +18 -0
- data/app/views/publish_my_data/errors/response_too_large.html.haml +16 -0
- data/app/views/publish_my_data/errors/timeout.html.haml +16 -0
- data/app/views/publish_my_data/errors/uncaught.html.haml +16 -0
- data/app/views/publish_my_data/example_resources/index.js.erb +1 -0
- data/app/views/publish_my_data/home/accessibility.html.haml +1 -0
- data/app/views/publish_my_data/home/docs.html.haml +1 -0
- data/app/views/publish_my_data/home/home.html.haml +5 -0
- data/app/views/publish_my_data/home/privacy.html.haml +1 -0
- data/app/views/publish_my_data/ontologies/show.html.haml +100 -0
- data/app/views/publish_my_data/properties/show.html.haml +28 -0
- data/app/views/publish_my_data/resources/_resource_data.html.haml +16 -0
- data/app/views/publish_my_data/resources/_sparql_section.html.haml +22 -0
- data/app/views/publish_my_data/resources/index.html.haml +37 -0
- data/app/views/publish_my_data/resources/show.html.haml +36 -0
- data/app/views/publish_my_data/shared/_browser_warning.html.haml +4 -0
- data/app/views/publish_my_data/shared/_deprecation_notice.html.haml +8 -0
- data/app/views/publish_my_data/shared/_footer.html.haml +11 -0
- data/app/views/publish_my_data/shared/_google_analytics.html.haml +11 -0
- data/app/views/publish_my_data/shared/_logo.html.haml +1 -0
- data/app/views/publish_my_data/shared/_meta_title.html.haml +2 -0
- data/app/views/publish_my_data/sparql/_form.html.haml +28 -0
- data/app/views/publish_my_data/sparql/_formats_dropdown.html.haml +11 -0
- data/app/views/publish_my_data/sparql/endpoint.html.haml +125 -0
- data/app/views/publish_my_data/sparql/formats_dropdowns/_ask.html.haml +7 -0
- data/app/views/publish_my_data/sparql/formats_dropdowns/_construct.html.haml +7 -0
- data/app/views/publish_my_data/sparql/formats_dropdowns/_describe.html.haml +1 -0
- data/app/views/publish_my_data/sparql/formats_dropdowns/_select.html.haml +9 -0
- data/app/views/publish_my_data/themes/index.html.haml +30 -0
- data/app/views/publish_my_data/themes/show.html.haml +43 -0
- data/config/routes.rb +20 -5
- data/lib/publish_my_data/version.rb +1 -1
- data/lib/publish_my_data.rb +7 -12
- data/spec/controllers/publish_my_data/datasets_controller_spec.rb +0 -75
- data/spec/controllers/publish_my_data/information_resources_controller_spec.rb +2 -11
- data/spec/dummy/config/environments/development.rb +0 -4
- data/spec/dummy/config/environments/test.rb +0 -4
- data/spec/dummy/log/test.log +62962 -0
- data/spec/dummy/tmp/cache/sass/e509ccd4d793d2c162d70125e9f3656b6c28f357/(__TEMPLATE__)c +0 -0
- data/spec/features/running_a_sparql_query_spec.rb +1 -1
- data/spec/features/uri_dereferencing_spec.rb +1 -1
- metadata +200 -58
- data/app/controllers/concerns/publish_my_data/data_download.rb +0 -22
- data/app/controllers/publish_my_data/vocabularies_controller.rb +0 -18
- data/app/views/layouts/publish_my_data/application.html.erb +0 -13
- data/app/views/layouts/publish_my_data/error.html.erb +0 -13
- data/app/views/publish_my_data/classes/show.html.erb +0 -3
- data/app/views/publish_my_data/concept_schemes/_concepts.html.erb +0 -18
- data/app/views/publish_my_data/concept_schemes/show.html.erb +0 -11
- data/app/views/publish_my_data/concepts/show.html.erb +0 -3
- data/app/views/publish_my_data/datasets/index.html.erb +0 -20
- data/app/views/publish_my_data/datasets/show.html.erb +0 -18
- data/app/views/publish_my_data/errors/not_found.html.erb +0 -1
- data/app/views/publish_my_data/errors/response_too_large.html.erb +0 -1
- data/app/views/publish_my_data/errors/timeout.html.erb +0 -1
- data/app/views/publish_my_data/errors/uncaught.html.erb +0 -6
- data/app/views/publish_my_data/ontologies/show.html.erb +0 -17
- data/app/views/publish_my_data/properties/show.html.erb +0 -3
- data/app/views/publish_my_data/resources/_predicates_table.html.erb +0 -30
- data/app/views/publish_my_data/resources/_predicates_table_head.html.erb +0 -6
- data/app/views/publish_my_data/resources/_resource_formats.html.erb +0 -4
- data/app/views/publish_my_data/resources/_summaries.html.erb +0 -18
- data/app/views/publish_my_data/resources/_uri_and_label.html.erb +0 -3
- data/app/views/publish_my_data/resources/index.html.erb +0 -40
- data/app/views/publish_my_data/resources/show.html.erb +0 -3
- data/app/views/publish_my_data/sparql/_ask_formats.html.erb +0 -3
- data/app/views/publish_my_data/sparql/_construct_formats.html.erb +0 -3
- data/app/views/publish_my_data/sparql/_describe_formats.html.erb +0 -1
- data/app/views/publish_my_data/sparql/_error_message.html.erb +0 -3
- data/app/views/publish_my_data/sparql/_form.html.erb +0 -4
- data/app/views/publish_my_data/sparql/_formats.html.erb +0 -6
- data/app/views/publish_my_data/sparql/_pagination.html.erb +0 -6
- data/app/views/publish_my_data/sparql/_results.html.erb +0 -5
- data/app/views/publish_my_data/sparql/_results_data.html.erb +0 -4
- data/app/views/publish_my_data/sparql/_select_formats.html.erb +0 -3
- data/app/views/publish_my_data/sparql/endpoint.html.erb +0 -10
- data/app/views/publish_my_data/themes/index.html.erb +0 -13
- data/app/views/publish_my_data/themes/show.html.erb +0 -15
- data/config/initializers/20_s3_setup.rb +0 -4
- data/spec/controllers/publish_my_data/vocabularies_controller_spec.rb +0 -14
- data/spec/support/data_download.rb +0 -60
@@ -0,0 +1,11 @@
|
|
1
|
+
- if true #Rails.env.to_s == 'production'
|
2
|
+
:javascript
|
3
|
+
var _gaq = _gaq || [];
|
4
|
+
_gaq.push(['_setAccount', 'UA-0000000-00']);
|
5
|
+
_gaq.push(['_trackPageview']);
|
6
|
+
|
7
|
+
(function() {
|
8
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
9
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
10
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
11
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
%h1 Your logo here.
|
@@ -0,0 +1,28 @@
|
|
1
|
+
= form_tag sparql_endpoint_path, method: :get do
|
2
|
+
.form-group
|
3
|
+
= text_area_tag :query, @query_text
|
4
|
+
|
5
|
+
- # this is the interpolation form:
|
6
|
+
- if @expected_variables && @expected_variables.any?
|
7
|
+
%fieldset.sparql-parameters
|
8
|
+
%legend Parameters
|
9
|
+
|
10
|
+
:markdown
|
11
|
+
Values supplied below will be substituted into the query in place of the <code>%{tokens}</code>. See the [developer docs](/docs) for more details.
|
12
|
+
|
13
|
+
- @expected_variables.each do |v|
|
14
|
+
|
15
|
+
:ruby
|
16
|
+
field_options = {:class => 'field'}
|
17
|
+
|
18
|
+
if @missing_variables && @missing_variables.include?(v)
|
19
|
+
field_options.merge!(:class => 'field has-error')
|
20
|
+
end
|
21
|
+
|
22
|
+
- unless @reserved_variables_used && @reserved_variables_used.include?(v)
|
23
|
+
- # don't include reserved ones
|
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'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
= render "publish_my_data/sparql/formats_dropdowns/#{@sparql_query.query_type.to_s}"
|
2
|
+
|
3
|
+
:javascript
|
4
|
+
$(function() {
|
5
|
+
var formatSelect = $('.api-links select.formats');
|
6
|
+
formatSelect.change(function() {
|
7
|
+
var newVal = formatSelect.val();
|
8
|
+
$('.api-links code').text(newVal);
|
9
|
+
});
|
10
|
+
formatSelect.change(); // trigger the change.
|
11
|
+
});
|
@@ -0,0 +1,125 @@
|
|
1
|
+
- page_title "SPARQL Endpoint"
|
2
|
+
|
3
|
+
- content_for :crumbs do
|
4
|
+
%ol.breadcrumb
|
5
|
+
%li= link_to_home
|
6
|
+
%li SPARQL
|
7
|
+
|
8
|
+
%article#sparql
|
9
|
+
%header
|
10
|
+
- if @sparql_query
|
11
|
+
%h1 SPARQL Query Results
|
12
|
+
- else
|
13
|
+
%h1 Run a SPARQL Query
|
14
|
+
|
15
|
+
- if @sparql_query || @error_message
|
16
|
+
%section#results
|
17
|
+
- if @error_message
|
18
|
+
#error-message
|
19
|
+
%h3 Sorry, your query failed to run.</h3>
|
20
|
+
%p= @error_message
|
21
|
+
|
22
|
+
- else
|
23
|
+
- unless @sparql_query.query_type == :select
|
24
|
+
- # not a select
|
25
|
+
#results.ascii
|
26
|
+
%pre~ @sparql_query_result.to_s
|
27
|
+
|
28
|
+
- else
|
29
|
+
- #selects
|
30
|
+
- #no script fallback is just the ascii-art version (paginated)
|
31
|
+
%noscript
|
32
|
+
:scss
|
33
|
+
#js-grid-results {
|
34
|
+
display:none;
|
35
|
+
}
|
36
|
+
|
37
|
+
%h3.results Results
|
38
|
+
#results.ascii.select
|
39
|
+
%pre~ @sparql_query_result.to_s
|
40
|
+
.pagination
|
41
|
+
= link_to("Previous #{@pagination_params.per_page} results".html_safe, params.merge({:page => (@pagination_params.page-1)}), class: 'previous' ) if @pagination_params.page > 1
|
42
|
+
= link_to("Next #{@pagination_params.per_page} results".html_safe, params.merge({:page => (@pagination_params.page+1)}), class: 'next' ) if @more_pages
|
43
|
+
|
44
|
+
- #js version here:
|
45
|
+
#js-grid-results
|
46
|
+
.grid-status
|
47
|
+
.status-value
|
48
|
+
= image_tag("publish_my_data/small-spinner.gif", alt: "busy", style: "display:none", class: "busy")
|
49
|
+
|
50
|
+
#results-grid.data-grid
|
51
|
+
- # results go in here.
|
52
|
+
.grid-footer
|
53
|
+
.footer-content
|
54
|
+
%a.download-csv{href: sparql_endpoint_url(format: 'csv', query: @sparql_query.query)}
|
55
|
+
%i.icon-download
|
56
|
+
Download Results as CSV
|
57
|
+
|
58
|
+
:javascript
|
59
|
+
// use this instead of $(function(){}) to fix slick grid stylesheet load issues.
|
60
|
+
$(window).load(function() {
|
61
|
+
var encodedQuery = "#{CGI.escape(@sparql_query.query)}"; // note that we encode on the server so we don't hit the multiline JS prob
|
62
|
+
new Swirrl.SparqlResultsGrid(encodedQuery);
|
63
|
+
});
|
64
|
+
|
65
|
+
%section#Query
|
66
|
+
- if @sparql_query
|
67
|
+
%h3 Edit the query
|
68
|
+
- else
|
69
|
+
%h3 Enter a query
|
70
|
+
|
71
|
+
= render 'publish_my_data/sparql/form'
|
72
|
+
|
73
|
+
%footer.api
|
74
|
+
- query_params = { :query => params[:query] }.merge(@interpolations||{})
|
75
|
+
%h3 Permalink
|
76
|
+
%code.click-to-select.permalink
|
77
|
+
= sparql_endpoint_url(query_params)
|
78
|
+
|
79
|
+
- if @sparql_query && !@error_message
|
80
|
+
|
81
|
+
%h3 API
|
82
|
+
%div.api-links
|
83
|
+
%p
|
84
|
+
%span
|
85
|
+
Request this
|
86
|
+
%strong complete set
|
87
|
+
of results as
|
88
|
+
= render 'publish_my_data/sparql/formats_dropdown', :query_params => query_params
|
89
|
+
%span
|
90
|
+
by issuing an HTTP GET request to the following URL:
|
91
|
+
|
92
|
+
%code.click-to-select
|
93
|
+
= sparql_endpoint_url(query_params.merge(:format => 'format'))
|
94
|
+
%p
|
95
|
+
Don't forget you can also use the links at the foot of the page.
|
96
|
+
|
97
|
+
%footer.alternative-formats
|
98
|
+
|
99
|
+
- if @error_message || (!@sparql_query) || @sparql_query.query_type == :unknown
|
100
|
+
:markdown
|
101
|
+
This **page** is available as:
|
102
|
+
%ul
|
103
|
+
%li HTML
|
104
|
+
|
105
|
+
- else
|
106
|
+
:markdown
|
107
|
+
The **complete set of results** is available as:
|
108
|
+
-if @sparql_query.query_type == :select
|
109
|
+
%ul
|
110
|
+
%li= link_to_sparql_results_format("XML", "xml", @sparql_query.query)
|
111
|
+
%li= link_to_sparql_results_format("JSON", "json", @sparql_query.query)
|
112
|
+
%li= link_to_sparql_results_format("CSV", "csv", @sparql_query.query)
|
113
|
+
%li= link_to_sparql_results_format("Text", "text", @sparql_query.query)
|
114
|
+
|
115
|
+
-elsif @sparql_query.query_type == :construct || @sparql_query.query_type == :describe
|
116
|
+
%ul
|
117
|
+
%li= link_to_sparql_results_format( "N-triples", "nt", @sparql_query.query )
|
118
|
+
%li= link_to_sparql_results_format( "Turtle", "ttl", @sparql_query.query )
|
119
|
+
%li= link_to_sparql_results_format( "RDF/XML", "rdf", @sparql_query.query )
|
120
|
+
|
121
|
+
-elsif @sparql_query.query_type == :ask
|
122
|
+
%ul
|
123
|
+
%li= link_to_sparql_results_format( "JSON", "json", @sparql_query.query )
|
124
|
+
%li= link_to_sparql_results_format( "XML", "xml", @sparql_query.query )
|
125
|
+
%li= link_to_sparql_results_format( "Text", "text", @sparql_query.query )
|
@@ -0,0 +1,7 @@
|
|
1
|
+
%select.formats{style:'display:inline;'}
|
2
|
+
%option{value: sparql_endpoint_url(:format => 'json', :query => @sparql_query.query)}
|
3
|
+
JSON
|
4
|
+
%option{value: sparql_endpoint_url(:format => 'xml', :query => @sparql_query.query)}
|
5
|
+
XML
|
6
|
+
%option{value: sparql_endpoint_url(:format => 'txt', :query => @sparql_query.query)}
|
7
|
+
Text
|
@@ -0,0 +1,7 @@
|
|
1
|
+
%select.formats{style:'display:inline;'}
|
2
|
+
%option{value: sparql_endpoint_url(:format => 'ttl', :query => @sparql_query.query)}
|
3
|
+
Turtle
|
4
|
+
%option{value: sparql_endpoint_url(:format => 'nt', :query => @sparql_query.query)}
|
5
|
+
N-triples
|
6
|
+
%option{value: sparql_endpoint_url(:format => 'rdf', :query => @sparql_query.query)}
|
7
|
+
RDF/XML
|
@@ -0,0 +1 @@
|
|
1
|
+
= render 'publish_my_data/sparql/formats_dropdowns/construct'
|
@@ -0,0 +1,9 @@
|
|
1
|
+
%select.formats{style:'display:inline;'}
|
2
|
+
%option{value: sparql_endpoint_url(:format => 'json', :query => @sparql_query.query)}
|
3
|
+
JSON
|
4
|
+
%option{value: sparql_endpoint_url(:format => 'xml', :query => @sparql_query.query)}
|
5
|
+
XML
|
6
|
+
%option{value: sparql_endpoint_url(:format => 'csv', :query => @sparql_query.query)}
|
7
|
+
CSV
|
8
|
+
%option{value: sparql_endpoint_url(:format => 'text', :query => @sparql_query.query)}
|
9
|
+
Text
|
@@ -0,0 +1,30 @@
|
|
1
|
+
- page_title "Themes"
|
2
|
+
|
3
|
+
- content_for :crumbs do
|
4
|
+
%ol.breadcrumb
|
5
|
+
%li= link_to_home
|
6
|
+
%li Themes
|
7
|
+
|
8
|
+
%section#themes
|
9
|
+
%header
|
10
|
+
%h1 Themes
|
11
|
+
%p The datasets in this site are collected into #{pluralize @themes.length, "broad themes"}.
|
12
|
+
|
13
|
+
%ul
|
14
|
+
- @themes.each do |theme|
|
15
|
+
%li
|
16
|
+
%h3= link_to (theme.label || theme.uri), theme
|
17
|
+
%p.comment= theme.comment
|
18
|
+
%p.dataset-count= pluralize( theme.datasets_count, "dataset" )
|
19
|
+
|
20
|
+
|
21
|
+
%footer.alternative-formats
|
22
|
+
:markdown
|
23
|
+
This **list of themes** is available as
|
24
|
+
|
25
|
+
%ul
|
26
|
+
%li HTML
|
27
|
+
%li= link_to 'N-triples', format: 'nt'
|
28
|
+
%li= link_to "Turtle", format: 'ttl'
|
29
|
+
%li= link_to "RDF/XML", format: 'rdf'
|
30
|
+
%li= link_to "JSON", format: 'json'
|
@@ -0,0 +1,43 @@
|
|
1
|
+
- page_title "Theme: #{@theme.label || @theme.uri}"
|
2
|
+
|
3
|
+
- content_for :crumbs do
|
4
|
+
%ol.breadcrumb
|
5
|
+
%li= link_to_home
|
6
|
+
%li= link_to "Themes", themes_path
|
7
|
+
%li Theme
|
8
|
+
|
9
|
+
%article#theme
|
10
|
+
%header
|
11
|
+
%h3 Theme
|
12
|
+
%h1= @theme.label || @theme.uri
|
13
|
+
%h3 Comment
|
14
|
+
%p
|
15
|
+
= @theme.comment
|
16
|
+
= link_to "Metadata for this theme", resource_path_from_uri(@theme.uri)
|
17
|
+
|
18
|
+
%section#datasets
|
19
|
+
%h3= pluralize(@datasets.length, "dataset")
|
20
|
+
|
21
|
+
%ul
|
22
|
+
- @datasets.each do |dataset|
|
23
|
+
%li
|
24
|
+
%h3= link_to dataset.title, dataset
|
25
|
+
%p
|
26
|
+
=dataset.comment
|
27
|
+
- if dataset.deprecated?
|
28
|
+
%span.discontinued
|
29
|
+
%i.icon.-warning
|
30
|
+
Discontinued
|
31
|
+
- if pagination_required?(@datasets, @pagination_params)
|
32
|
+
= paginate @datasets
|
33
|
+
|
34
|
+
%footer.alternative-formats
|
35
|
+
:markdown
|
36
|
+
This **page of datasets** is available as:
|
37
|
+
|
38
|
+
%ul
|
39
|
+
%li HTML
|
40
|
+
%li= link_to('N-triples', :format => 'nt', :page => @pagination_params.page, :per_page => @pagination_params.per_page)
|
41
|
+
%li= link_to("Turtle", :format => 'ttl', :page => @pagination_params.page, :per_page => @pagination_params.per_page)
|
42
|
+
%li= link_to("RDF/XML", :format => 'rdf', :page => @pagination_params.page, :per_page => @pagination_params.per_page)
|
43
|
+
%li= link_to("JSON", :format => 'json', :page => @pagination_params.page, :per_page => @pagination_params.per_page)
|
data/config/routes.rb
CHANGED
@@ -8,10 +8,23 @@ PublishMyData::Engine.routes.draw do
|
|
8
8
|
|
9
9
|
# datasets
|
10
10
|
|
11
|
+
# data cube stuff
|
12
|
+
match "/data/*id/cube/dimensions(.:format)" => "data_cube/dimensions#index" # list the dimensions for the cube
|
13
|
+
match "/data/*id/cube/measure(.:format)" => "data_cube/dimensions#measure" # the measure property for the cube
|
14
|
+
match "/data/*id/cube/dimension_values(.:format)" => "data_cube/dimensions#values" # all values for a single dimension in the cube. Useful for getting axes.
|
15
|
+
match "/data/*id/cube/dimension_size(.:format)" => "data_cube/dimensions#size" # number of values for a dimension in the cube.
|
16
|
+
match "/data/*id/cube/recommended_dimensions(.:format)" => "data_cube/dimensions#recommended" # recommended dimensions to use.
|
17
|
+
match "/data/*id/cube/observations(.:format)" => "data_cube/observations#index", as: :cube_observations # supply row, col and locked dimensions as query string parameters
|
18
|
+
|
19
|
+
# example resources for datasets
|
20
|
+
match "/data/*id/example-data" => "example_resources#index", as: :example_resources
|
21
|
+
|
22
|
+
# dataset resource
|
11
23
|
# note that the separate .:format and no-format verisons allow extensions like .json on the end of the uri not to be globbed as the *id
|
12
|
-
match "/data/*id/dump" => "datasets#dump", :as => 'dataset_dump'
|
13
24
|
match "/data/*id.:format" => "information_resources#data"
|
14
25
|
match "/data/*id" => "information_resources#data", :as => 'dataset'
|
26
|
+
|
27
|
+
#dataset list
|
15
28
|
match "/data(.:format)" => "datasets#index", :as => 'datasets'
|
16
29
|
|
17
30
|
# themes
|
@@ -22,10 +35,6 @@ PublishMyData::Engine.routes.draw do
|
|
22
35
|
match "/doc/*path.:format" => "resources#doc"
|
23
36
|
match "/doc/*path" => "resources#doc"
|
24
37
|
|
25
|
-
# download paths
|
26
|
-
match "/def/*id/dump" => "information_resources#dump"
|
27
|
-
match "/vocabularies/:id/dump" => "vocabularies#dump"
|
28
|
-
|
29
38
|
# def pages
|
30
39
|
match "/def/*id.:format" => "information_resources#def"
|
31
40
|
match "/def/*id" => "information_resources#def"
|
@@ -36,6 +45,12 @@ PublishMyData::Engine.routes.draw do
|
|
36
45
|
# SPARQL
|
37
46
|
match "sparql(.:format)" => "sparql#endpoint", :as => 'sparql_endpoint' # the main sparql endpoint
|
38
47
|
|
48
|
+
# Static pages
|
49
|
+
match "/docs" => "home#docs", :as => 'developer_docs'
|
50
|
+
match "/privacy" => "home#privacy", :as => 'privacy'
|
51
|
+
match "/accessibility" => "home#accessibility", :as => 'accessibility'
|
52
|
+
match "/" => 'home#home', :as => 'home'
|
53
|
+
|
39
54
|
#http://techoctave.com/c7/posts/36-rails-3-0-rescue-from-routing-error-solution
|
40
55
|
match '*a', :to => 'errors#routing'
|
41
56
|
end
|
data/lib/publish_my_data.rb
CHANGED
@@ -6,7 +6,8 @@ require "publish_my_data/paginator"
|
|
6
6
|
|
7
7
|
# A bit nasty, but these paths are included by default in Rails 4 so
|
8
8
|
# this is only a temporary measure
|
9
|
-
|
9
|
+
|
10
|
+
require File.expand_path('../../app/models/concerns/publish_my_data/cube_results.rb', __FILE__)
|
10
11
|
|
11
12
|
# load them in the right order so that dataset powers can access all features.
|
12
13
|
require File.expand_path('../../app/models/concerns/publish_my_data/all_features.rb', __FILE__)
|
@@ -51,13 +52,6 @@ module PublishMyData
|
|
51
52
|
mattr_accessor :max_resources_per_page
|
52
53
|
@@max_resources_per_page = 1000
|
53
54
|
|
54
|
-
mattr_accessor :aws_default_host
|
55
|
-
@@aws_default_host = 's3-eu-west-1.amazonaws.com'
|
56
|
-
|
57
|
-
mattr_accessor :aws_access_key_id
|
58
|
-
mattr_accessor :aws_secret_access_key
|
59
|
-
mattr_accessor :downloads_s3_bucket
|
60
|
-
|
61
55
|
|
62
56
|
# Use +configure+ to override PublishMyData configuration in an app, e.g.:
|
63
57
|
# (defaults shown)
|
@@ -70,10 +64,6 @@ module PublishMyData
|
|
70
64
|
# config.default_html_resources_per_page = 20
|
71
65
|
# config.default_html_sparql_per_page = 20
|
72
66
|
# config.max_resources_per_page = 1000
|
73
|
-
# config.aws_default_host = 's3-eu-west-1.amazonaws.com'
|
74
|
-
# config.downloads_s3_bucket = nil # the s3 bucket for dataset dumps. Used for redirecting to the right location for dataset downloads.
|
75
|
-
# config.aws_access_key_id = nil # the access key for the s3 bucket
|
76
|
-
# config.aws_secret_access_key = nil # the secret key for the s3 bucket
|
77
67
|
# config.tripod_cache_store = nil #e.g Tripod::CacheStores::MemcachedCacheStore.new('localhost:11211')
|
78
68
|
# # note: if using memcached, make sure you set the -I (slab size) to big enough to store each result (i.e. to more than SparqlQueryResult.MAX_SIZE)
|
79
69
|
# # and set the -m (total size) to something quite big (or the cache will recycle too often).
|
@@ -87,6 +77,11 @@ end
|
|
87
77
|
require 'kaminari'
|
88
78
|
require 'rdiscount'
|
89
79
|
require 'aws-sdk'
|
80
|
+
require 'rails_autolink'
|
81
|
+
require 'haml-rails'
|
82
|
+
require 'sass-rails'
|
83
|
+
require 'jquery-rails'
|
84
|
+
require 'entypo-rails'
|
90
85
|
|
91
86
|
Kaminari.configure do |config|
|
92
87
|
config.default_per_page = 20
|
@@ -112,80 +112,5 @@ module PublishMyData
|
|
112
112
|
|
113
113
|
end
|
114
114
|
|
115
|
-
describe "#dump" do
|
116
|
-
|
117
|
-
before do
|
118
|
-
s3 = AWS::S3.new
|
119
|
-
bucket = s3.buckets[PublishMyData.downloads_s3_bucket]
|
120
|
-
bucket.clear! # wipe the bucket
|
121
|
-
end
|
122
|
-
|
123
|
-
context "and a dataset with the slug exists" do
|
124
|
-
|
125
|
-
let(:dataset) { FactoryGirl.create(:my_dataset) }
|
126
|
-
|
127
|
-
context "when a download exists on s3 for today" do
|
128
|
-
|
129
|
-
before do
|
130
|
-
# make some downloads.
|
131
|
-
s3 = AWS::S3.new
|
132
|
-
bucket = s3.buckets[PublishMyData.downloads_s3_bucket]
|
133
|
-
|
134
|
-
@obj1 = bucket.objects.create("dataset_data_my|dataset_201007011200.nt.zip", 'data')
|
135
|
-
@obj2 = bucket.objects.create("dataset_data_my|dataset_201007011201.nt.zip", 'data')
|
136
|
-
@obj3 = bucket.objects.create("dataset_data_my|dataset_201007011202.nt.zip", 'data')
|
137
|
-
# this one's on another day:
|
138
|
-
@obj4 = bucket.objects.create("dataset_data_my|dataset_201007021202.nt.zip", 'data')
|
139
|
-
|
140
|
-
# make them public readable
|
141
|
-
[@obj1, @obj2, @obj3].each { |o| o.acl = :public_read }
|
142
|
-
end
|
143
|
-
|
144
|
-
it "should redirect to the latest download that exists for that dataset" do
|
145
|
-
get :dump, :id => dataset.slug, :use_route => :publish_my_data
|
146
|
-
response.should be_redirect
|
147
|
-
response.should redirect_to(@obj3.public_url.to_s)
|
148
|
-
end
|
149
|
-
|
150
|
-
end
|
151
|
-
|
152
|
-
context "when a download exists on s3 for today, but before the modified date" do
|
153
|
-
|
154
|
-
before do
|
155
|
-
# make some downloads.
|
156
|
-
s3 = AWS::S3.new
|
157
|
-
bucket = s3.buckets[PublishMyData.downloads_s3_bucket]
|
158
|
-
|
159
|
-
@obj1 = bucket.objects.create("dataset_data_#{dataset.slug}_201007011159.nt.zip", 'data')
|
160
|
-
|
161
|
-
# make them public readable
|
162
|
-
[@obj1].each { |o| o.acl = :public_read }
|
163
|
-
end
|
164
|
-
|
165
|
-
it "should 404" do
|
166
|
-
get :dump, :id => dataset.slug, :use_route => :publish_my_data
|
167
|
-
response.should be_not_found
|
168
|
-
end
|
169
|
-
|
170
|
-
end
|
171
|
-
|
172
|
-
context "when a download doesn't exist on s3" do
|
173
|
-
it "should 404" do
|
174
|
-
get :dump, :id => dataset.slug, :use_route => :publish_my_data
|
175
|
-
response.should be_not_found
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
end
|
180
|
-
|
181
|
-
context "when a dataset with that slug doesn't exist" do
|
182
|
-
it "should 404" do
|
183
|
-
get :dump, :id => "i-dont-exist", :use_route => :publish_my_data
|
184
|
-
response.should be_not_found
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
|
189
|
-
end
|
190
115
|
end
|
191
116
|
end
|
@@ -42,23 +42,14 @@ end
|
|
42
42
|
|
43
43
|
module PublishMyData
|
44
44
|
describe InformationResourcesController do
|
45
|
-
# dump an ontology
|
46
|
-
it_should_behave_like 'a controller with a dump action' do
|
47
|
-
let(:resource) { FactoryGirl.create(:ontology) }
|
48
|
-
end
|
49
|
-
|
50
|
-
# dump a concept scheme
|
51
|
-
it_should_behave_like 'a controller with a dump action' do
|
52
|
-
let(:resource) { FactoryGirl.create(:concept_scheme) }
|
53
|
-
end
|
54
45
|
|
55
46
|
describe '#data' do
|
56
47
|
context "given a dataset" do
|
57
48
|
let(:resource) { FactoryGirl.create(:my_dataset) }
|
58
49
|
|
59
50
|
context 'as html' do
|
60
|
-
before { get :data, id: resource.slug, use_route: :publish_my_data }
|
61
|
-
|
51
|
+
before { get :data, id: resource.slug, use_route: :publish_my_data }
|
52
|
+
|
62
53
|
it "should render the dataset show template" do
|
63
54
|
response.should render_template("publish_my_data/datasets/show")
|
64
55
|
end
|
@@ -32,10 +32,6 @@ Dummy::Application.configure do
|
|
32
32
|
PublishMyData.configure do |config|
|
33
33
|
config.sparql_endpoint = 'http://localhost:3030/pmd/sparql'
|
34
34
|
config.local_domain = 'pmd.dev'
|
35
|
-
|
36
|
-
config.downloads_s3_bucket = "publishmydata-dev"
|
37
|
-
config.aws_access_key_id = "AKIAIMGJ3RKNJJ6CVGTA"
|
38
|
-
config.aws_secret_access_key = "O0AylxAfa2dKj0eao3Y4ISYZXJrnGZyUs1U8sOlT"
|
39
35
|
end
|
40
36
|
|
41
37
|
end
|
@@ -35,9 +35,5 @@ Dummy::Application.configure do
|
|
35
35
|
PublishMyData.configure do |config|
|
36
36
|
config.sparql_endpoint = 'http://localhost:3030/pmdtest/sparql'
|
37
37
|
config.local_domain = 'pmdtest.dev'
|
38
|
-
|
39
|
-
config.downloads_s3_bucket = "publishmydata-dev"
|
40
|
-
config.aws_access_key_id = "AKIAIMGJ3RKNJJ6CVGTA"
|
41
|
-
config.aws_secret_access_key = "O0AylxAfa2dKj0eao3Y4ISYZXJrnGZyUs1U8sOlT"
|
42
38
|
end
|
43
39
|
end
|