geoblacklight 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.travis.yml +3 -3
  4. data/app/assets/javascripts/geoblacklight/geoblacklight.js +1 -1
  5. data/app/assets/javascripts/geoblacklight/modules/relations.js +14 -0
  6. data/app/assets/stylesheets/geoblacklight/modules/icon-customization.scss +8 -0
  7. data/app/controllers/relation_controller.rb +10 -0
  8. data/app/helpers/blacklight_helper.rb +5 -0
  9. data/app/views/catalog/_relations_container.html.erb +1 -0
  10. data/app/views/relation/_ancestors.html.erb +8 -0
  11. data/app/views/relation/_descendants.html.erb +15 -0
  12. data/app/views/relation/index.html.erb +13 -0
  13. data/app/views/relation/index.json.jbuilder +3 -0
  14. data/config/locales/geoblacklight.en.yml +5 -0
  15. data/geoblacklight.gemspec +1 -1
  16. data/lib/generators/geoblacklight/install_generator.rb +0 -3
  17. data/lib/generators/geoblacklight/templates/settings.yml +1 -0
  18. data/lib/geoblacklight.rb +3 -0
  19. data/lib/geoblacklight/relation/ancestors.rb +27 -0
  20. data/lib/geoblacklight/relation/descendants.rb +27 -0
  21. data/lib/geoblacklight/relation/relation_response.rb +23 -0
  22. data/lib/geoblacklight/routes/exportable.rb +1 -0
  23. data/lib/geoblacklight/version.rb +1 -1
  24. data/spec/controllers/relation_controller_spec.rb +11 -0
  25. data/spec/features/esri_viewer_spec.rb +1 -1
  26. data/spec/features/relations_spec.rb +51 -0
  27. data/spec/features/split_view.html.erb_spec.rb +1 -1
  28. data/spec/fixtures/solr_documents/baruch_ancestor1.json +46 -0
  29. data/spec/fixtures/solr_documents/baruch_ancestor2.json +46 -0
  30. data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +29 -26
  31. data/spec/lib/geoblacklight/relation/ancestors_spec.rb +32 -0
  32. data/spec/lib/geoblacklight/relation/descendants_spec.rb +32 -0
  33. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +35 -0
  34. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  35. data/spec/test_app_templates/solr_documents +1 -1
  36. data/template.rb +2 -2
  37. metadata +29 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2790f480cb5d55cf12f7cb2833a40fbd366d72c9
4
- data.tar.gz: b72946fc1299ff88dcb829dde41b2060ca53195a
3
+ metadata.gz: 63a935be20a30e560a0653acdd2397fe9393d40f
4
+ data.tar.gz: 325d07c535bf6b20a9a74f6f9d039dbd5257ce85
5
5
  SHA512:
6
- metadata.gz: 08ef76ebafe288ba94d401d88af615b56f4dc531df078cc3308ff8e7952001aa49a00b7c437ef4570d860a6c7718b95bc83b8b6ff683190e393cf90171f92e66
7
- data.tar.gz: bbd8456833a4c4bec1c978cdc3edaf82913cd6517e8c961795e8d1d3a7a6b8c308987d0312061b57be50677ba3f141a32b0ee4675b1c3857817ec93f34a2f091
6
+ metadata.gz: 5a8f2aca97d1458f5c8932aebe58e86ffbce1e330363448f34e25facf451b58eb713f0abc4071a1f5b39dcadeb0fb2e2690e6b2ee7feec05e052eea543e56b97
7
+ data.tar.gz: 4a28c89f1d327a4cbf1c1cf1ddac47acf8e95d9730a6dab4bb65846904ed86e272b42a23f165ba2d5a05d5573ca42db0ef07d4ab2dd461f810ceafce55e46fd4
data/.rubocop.yml CHANGED
@@ -25,7 +25,7 @@ Metrics/AbcSize:
25
25
  Max: 23
26
26
 
27
27
  Metrics/MethodLength:
28
- Max: 15
28
+ Max: 16
29
29
 
30
30
  # TODO: Add top-level class and module documentation.
31
31
  Style/Documentation:
data/.travis.yml CHANGED
@@ -10,16 +10,16 @@ rvm:
10
10
  matrix:
11
11
  include:
12
12
  - rvm: 2.3.1
13
- env: "RAILS_VERSION=4.2.6"
13
+ env: "RAILS_VERSION=4.2.7.1"
14
14
  - rvm: 2.2.5
15
- env: "RAILS_VERSION=5.0.0"
15
+ env: "RAILS_VERSION=5.0.0.1"
16
16
 
17
17
  before_install:
18
18
  - gem update --system
19
19
  - gem install bundler
20
20
 
21
21
  env:
22
- - "RAILS_VERSION=5.0.0"
22
+ - "RAILS_VERSION=5.0.0.1"
23
23
 
24
24
  global_env:
25
25
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
@@ -20,7 +20,7 @@
20
20
 
21
21
  var GeoBlacklight = L.Class.extend({
22
22
  statics: {
23
- __version__: '1.2.0',
23
+ __version__: '1.3.0',
24
24
 
25
25
  debounce: function(fn, delay) {
26
26
  var timeout = null;
@@ -0,0 +1,14 @@
1
+ Blacklight.onLoad(function () {
2
+ $('[data-relations="true"]').each(function (i, element) {
3
+ var $elem = $(element);
4
+ var attributes = $elem.data();
5
+ var relation_url = attributes['url'] + '/relations';
6
+ $.ajax({
7
+ url: relation_url,
8
+ type: 'GET',
9
+ success: function (data) {
10
+ $elem.append($(data).hide().fadeIn(200));
11
+ }
12
+ })
13
+ });
14
+ });
@@ -34,6 +34,14 @@
34
34
  @extend .fa, .fa-envelope;
35
35
  }
36
36
 
37
+ .geoblacklight-relations-ancestor {
38
+ @extend .fa, .fa-pagelines;
39
+ }
40
+
41
+ .geoblacklight-relations-descendant {
42
+ @extend .fa, .fa-leaf;
43
+ }
44
+
37
45
  .geoblacklight-web_services {
38
46
  @extend .fa, .fa-external-link;
39
47
  }
@@ -0,0 +1,10 @@
1
+ class RelationController < ApplicationController
2
+ include Blacklight::Configurable
3
+ include Blacklight::SearchHelper
4
+ copy_blacklight_config_from(CatalogController)
5
+
6
+ def index
7
+ @relations = Geoblacklight::Relation::RelationResponse.new(params[:id], repository)
8
+ render layout: !request.xhr?
9
+ end
10
+ end
@@ -1,4 +1,9 @@
1
1
  module BlacklightHelper
2
2
  include Blacklight::BlacklightHelperBehavior
3
3
  include Geoblacklight::GeoblacklightHelperBehavior
4
+ include Blacklight::CatalogHelperBehavior
5
+
6
+ def render_document_sidebar_partial(document = @document)
7
+ super(document) + (render 'relations_container', document: document)
8
+ end
4
9
  end
@@ -0,0 +1 @@
1
+ <%= content_tag(:div, nil, data: {relations: true, url: solr_document_path(document.id)}) %>
@@ -0,0 +1,8 @@
1
+ <b><%= t('geoblacklight.relations.ancestor') %></b>
2
+ <% @relations.ancestors['docs'].each do |ancestor| %>
3
+ <li>
4
+ <%= link_to solr_document_path(ancestor['layer_slug_s']) do %>
5
+ <span class='geoblacklight geoblacklight-relations-ancestor'></span> <%= ancestor['dc_title_s'] %>
6
+ <% end %>
7
+ </li>
8
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <b><%= t('geoblacklight.relations.descendant', count: @relations.descendants['numFound']) %></b>
2
+ <% @relations.descendants['docs'][0..2].each do |descendant| %>
3
+ <li>
4
+ <%= link_to solr_document_path(descendant['layer_slug_s']) do %>
5
+ <span class='geoblacklight geoblacklight-relations-descendant'></span> <%= descendant['dc_title_s'] %>
6
+ <% end %>
7
+ </li>
8
+ <% end %>
9
+ <% unless (@relations.descendants['numFound'].to_i <= 3) %>
10
+ <li>
11
+ <%= link_to search_catalog_path({f: {"#{Settings.FIELDS.SOURCE}" => [@relations.search_id]}}) do %>
12
+ <%= t('geoblacklight.relations.browse_all', count: @relations.descendants['numFound']) %>
13
+ <% end %>
14
+ </li>
15
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <% unless @relations.empty? %>
2
+ <div class="panel panel-default show-tools">
3
+ <div class="panel-heading">
4
+ <%= t('geoblacklight.relations.title') %>
5
+ </div>
6
+ <div class="panel-body">
7
+ <ul class="nav">
8
+ <%= render 'ancestors' unless @relations.ancestors['numFound'].to_i == 0 %>
9
+ <%= render 'descendants' unless @relations.descendants['numFound'].to_i == 0 %>
10
+ </ul>
11
+ </div>
12
+ </div>
13
+ <% end %>
@@ -0,0 +1,3 @@
1
+ json.ancestors@relations.ancestors
2
+ json.descendants @relations.descendants
3
+ json.current_doc @relations.search_id
@@ -32,3 +32,8 @@ en:
32
32
  dynamic_map_layer: 'ArcGIS Dynamic Map Layer'
33
33
  image_map_layer: 'ArcGIS Image Map Layer'
34
34
  data_dictionary: 'Documentation'
35
+ relations:
36
+ ancestor: 'Source Datasets'
37
+ descendant: 'Derived Datasets (%{count})'
38
+ browse_all: "Browse all %{count} records..."
39
+ title: 'Data Relations'
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency 'solr_wrapper'
33
33
  spec.add_development_dependency 'rails-controller-testing'
34
34
  spec.add_development_dependency 'rspec-rails', '~> 3.1'
35
- spec.add_development_dependency 'engine_cart', '~> 0.10'
35
+ spec.add_development_dependency 'engine_cart', '~> 1.0'
36
36
  spec.add_development_dependency 'capybara', '>= 2.5.0'
37
37
  spec.add_development_dependency 'poltergeist'
38
38
  spec.add_development_dependency 'factory_girl_rails'
@@ -20,17 +20,14 @@ module Geoblacklight
20
20
  resources :solr_documents, only: [:show], path: '/catalog', controller: 'catalog' do
21
21
  concerns :gbl_exportable
22
22
  end
23
-
24
23
  concern :gbl_wms, Geoblacklight::Routes::Wms.new
25
24
  namespace :wms do
26
25
  concerns :gbl_wms
27
26
  end
28
-
29
27
  concern :gbl_downloadable, Geoblacklight::Routes::Downloadable.new
30
28
  namespace :download do
31
29
  concerns :gbl_downloadable
32
30
  end
33
-
34
31
  resources :download, only: [:show]
35
32
  EOF
36
33
  end
@@ -28,6 +28,7 @@ FIELDS:
28
28
  :PART_OF: 'dct_isPartOf_sm'
29
29
  :TEMPORAL: 'dct_temporal_sm'
30
30
  :TITLE: 'dc_title_s'
31
+ :SOURCE: 'dc_source_sm'
31
32
 
32
33
  # Institution deployed at
33
34
  INSTITUTION: 'Stanford'
data/lib/geoblacklight.rb CHANGED
@@ -22,6 +22,9 @@ module Geoblacklight
22
22
  require 'geoblacklight/reference'
23
23
  require 'geoblacklight/references'
24
24
  require 'geoblacklight/routes'
25
+ require 'geoblacklight/relation/descendants'
26
+ require 'geoblacklight/relation/ancestors'
27
+ require 'geoblacklight/relation/relation_response'
25
28
 
26
29
  def self.inject!
27
30
  CatalogController.send(:include, Geoblacklight::ControllerOverride)
@@ -0,0 +1,27 @@
1
+ module Geoblacklight
2
+ module Relation
3
+ class Ancestors
4
+ def initialize(id, repository)
5
+ @search_id = id
6
+ @repository = repository
7
+ end
8
+
9
+ def create_search_params
10
+ { fq: ["{!join from=#{Settings.FIELDS.SOURCE} to=layer_slug_s}layer_slug_s:#{@search_id}"],
11
+ fl: [Settings.FIELDS.TITLE, 'layer_slug_s'] }
12
+ end
13
+
14
+ def execute_query
15
+ @repository.connection.send_and_receive(
16
+ @repository.blacklight_config.solr_path,
17
+ params: create_search_params
18
+ )
19
+ end
20
+
21
+ def results
22
+ response = execute_query
23
+ response['response']
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module Geoblacklight
2
+ module Relation
3
+ class Descendants
4
+ def initialize(id, repository)
5
+ @search_id = id
6
+ @repository = repository
7
+ end
8
+
9
+ def create_search_params
10
+ { fq: "#{Settings.FIELDS.SOURCE}:#{@search_id}",
11
+ fl: [Settings.FIELDS.TITLE, 'layer_slug_s'] }
12
+ end
13
+
14
+ def execute_query
15
+ @repository.connection.send_and_receive(
16
+ @repository.blacklight_config.solr_path,
17
+ params: create_search_params
18
+ )
19
+ end
20
+
21
+ def results
22
+ response = execute_query
23
+ response['response']
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,23 @@
1
+ module Geoblacklight
2
+ module Relation
3
+ class RelationResponse
4
+ attr_reader :search_id
5
+ def initialize(id, repository)
6
+ @search_id = id
7
+ @repository = repository
8
+ end
9
+
10
+ def ancestors
11
+ @ancestors ||= Geoblacklight::Relation::Ancestors.new(@search_id, @repository).results
12
+ end
13
+
14
+ def descendants
15
+ @descendants ||= Geoblacklight::Relation::Descendants.new(@search_id, @repository).results
16
+ end
17
+
18
+ def empty?
19
+ !(ancestors['numFound'] > 0 || descendants['numFound'] > 0)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -9,6 +9,7 @@ module Geoblacklight
9
9
  mapper.member do
10
10
  mapper.get 'web_services'
11
11
  mapper.get 'metadata'
12
+ mapper.get 'relations' => 'relation#index'
12
13
  end
13
14
  end
14
15
  end
@@ -1,3 +1,3 @@
1
1
  module Geoblacklight
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe RelationController, type: :controller do
4
+ describe '#index' do
5
+ it 'returns a listing of related documents for a record' do
6
+ get :index, params: { id: 'nyu_2451_34502' }
7
+ expect(response.status).to eq 200
8
+ expect(assigns(:relations)).not_to be_nil
9
+ end
10
+ end
11
+ end
@@ -12,7 +12,7 @@ feature 'feature_layer reference', js: true do
12
12
  expect(page).to have_css 'img.leaflet-image-layer', visible: true
13
13
  end
14
14
  scenario 'displays dynamic layer (single layer)' do
15
- visit solr_document_path 'michigan-state-urn-ad0e6ebc-824e-4450-a0d9-987f2232724f'
15
+ visit solr_document_path 'Minnesota-urn-0f7ae38b-4bf2-4e03-a32b-e87f245ccb03'
16
16
  expect(page).to have_css '.leaflet-control-zoom', visible: true
17
17
  expect(page).to have_css 'img.leaflet-image-layer', visible: true
18
18
  end
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+
3
+ feature 'Display related documents' do
4
+ let(:expected_json_resp) do
5
+ {
6
+ 'ancestors' =>
7
+ {
8
+ 'numFound' => 0,
9
+ 'start' => 0,
10
+ 'docs' => []
11
+ },
12
+ 'descendants' =>
13
+ {
14
+ 'numFound' => 1,
15
+ 'start' => 0,
16
+ 'docs' =>
17
+ [
18
+ {
19
+ 'dc_title_s' => '2015 New York City Subway Complexes and Ridership',
20
+ 'layer_slug_s' => 'nyu_2451_34502'
21
+ }
22
+ ]
23
+ },
24
+ 'current_doc' => 'nyu_2451_34635'
25
+ }
26
+ end
27
+ scenario 'Record with dc_source_sm value(s) should have parent(s)' do
28
+ visit relations_solr_document_path('nyu_2451_34502')
29
+ expect(page).to have_css('ul b', text: 'Source Datasets')
30
+ end
31
+
32
+ scenario 'Record that is pointed to by others should have children' do
33
+ visit relations_solr_document_path('nyu_2451_34635')
34
+ expect(page).to have_css('ul b', text: 'Derived Datasets')
35
+ end
36
+
37
+ scenario 'Relations should respond to json' do
38
+ visit relations_solr_document_path('nyu_2451_34635', format: 'json')
39
+ expect(page.body).to eq(expected_json_resp.to_json)
40
+ end
41
+
42
+ scenario 'Record with relations should render widget in catalog#show', js: true do
43
+ visit solr_document_path('nyu_2451_34635')
44
+ expect(page).to have_css('div.panel-heading', text: 'Data Relations')
45
+ end
46
+
47
+ scenario 'Record without relations should not render widget in catalog#show', js: true do
48
+ visit solr_document_path('harvard-g7064-s2-1834-k3')
49
+ expect(page).to have_no_css('div.panel-heading', text: 'Data Relations')
50
+ end
51
+ end
@@ -49,7 +49,7 @@ feature 'Index view', js: true do
49
49
  scenario 'spatial search should reset to page one' do
50
50
  visit '/?per_page=5&q=%2A&page=2'
51
51
  find('#map').double_click
52
- expect(find('.page_entries')).to have_content(/^1 - \d of \d.$/)
52
+ expect(find('.page_entries')).to have_content(/^1 - \d of \d.*$/)
53
53
  end
54
54
 
55
55
  scenario 'clicking map search should retain current search parameters' do
@@ -0,0 +1,46 @@
1
+ {
2
+ "dc_identifier_s": "http://hdl.handle.net/2451/34635",
3
+ "dc_title_s": "2016 NYC Geodatabase, Open Source Version (jan2016)",
4
+ "dc_description_s": "The NYC Geodatabase (nyc_gdb) is a resource designed for basic geographic analysis and thematic mapping within the five boroughs of New York City. It contains geographic features and data compiled from several public sources. Subsets of large features like water, greenspace, and public facilities were created and Census geographies like tracts, ZCTAs, and PUMAs were geoprocessed to create land-based boundaries. Census data from the 2010 Census, American Community Survey (ACS), and ZIP Code Business Patterns are stored in tables that can be easily related to geographic features. Transit and public facility point data were gathered from several city agencies and transformed into spatial data that can be used for reference or analysis for measuring distance, drawing buffers, or counting features within areas. The data is provided in SQLite format.",
5
+ "dc_rights_s": "Public",
6
+ "dct_provenance_s": "Baruch CUNY",
7
+ "dct_references_s": "{\"http://schema.org/url\":\"http://hdl.handle.net/2451/34635\",\"http://schema.org/downloadUrl\":\"https://archive.nyu.edu/retrieve/74854/nyu_2451_34635.zip\",\"http://lccn.loc.gov/sh85035852\":\"https://archive.nyu.edu/retrieve/74855/nyu_2451_34635_doc.zip\"}",
8
+ "layer_id_s": "sdr:nyu_2451_34635",
9
+ "layer_slug_s": "nyu_2451_34635",
10
+ "layer_geom_type_s": "Mixed",
11
+ "layer_modified_dt": "2016-5-2T18:21:7Z",
12
+ "dc_format_s": "SQLite Database",
13
+ "dc_language_s": "English",
14
+ "dc_type_s": "Dataset",
15
+ "dc_publisher_s": [
16
+ "Newman Library (Bernard M. Baruch College)"
17
+ ],
18
+ "dc_creator_sm": "GIS Lab, Newman Library, Baruch CUNY",
19
+ "dc_subject_sm": [
20
+ "Boroughs",
21
+ "Boundaries",
22
+ "Counties"
23
+ ],
24
+ "dct_isPartOf_sm": "NYC Geodatabase (version jan2016)",
25
+ "dct_issued_s": "1/15/2016",
26
+ "dct_temporal_sm": [
27
+ "2010",
28
+ "2016"
29
+ ],
30
+ "dct_spatial_sm": [
31
+ "New York, New York, United States",
32
+ "Bronx County, New York, United States",
33
+ "Kings County, New York, United States",
34
+ "New York County, New York, United States",
35
+ "Queens County, New York, United States",
36
+ "Richmond County, New York, United States",
37
+ "Borough of Bronx, New York, United States",
38
+ "Borough of Brooklyn, New York, United States",
39
+ "Borough of Manhattan, New York, United States",
40
+ "Borough of Queens, New York, United States",
41
+ "Borough of Staten Island, New York, United States"
42
+ ],
43
+ "solr_geom": "ENVELOPE(-74.255895, -73.700272, 40.9152819999998, 40.4959289999998)",
44
+ "solr_year_i": 2016,
45
+ "geoblacklight_version": "1.0"
46
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "dc_identifier_s": "http://hdl.handle.net/2451/34636",
3
+ "dc_title_s": "2016 NYC Geodatabase, ArcGIS Version (jan2016)",
4
+ "dc_description_s": "The NYC Geodatabase (nyc_gdb) is a resource designed for basic geographic analysis and thematic mapping within the five boroughs of New York City. It contains geographic features and data compiled from several public sources. Subsets of large features like water, greenspace, and public facilities were created and Census geographies like tracts, ZCTAs, and PUMAs were geoprocessed to create land-based boundaries. Census data from the 2010 Census, American Community Survey (ACS), and ZIP Code Business Patterns are stored in tables that can be easily related to geographic features. Transit and public facility point data were gathered from several city agencies and transformed into spatial data that can be used for reference or analysis for measuring distance, drawing buffers, or counting features within areas. The data is provided in ESRI Geodatabase format.",
5
+ "dc_rights_s": "Public",
6
+ "dct_provenance_s": "Baruch CUNY",
7
+ "dct_references_s": "{\"http://schema.org/url\":\"http://hdl.handle.net/2451/34636\",\"http://schema.org/downloadUrl\":\"https://archive.nyu.edu/retrieve/74856/nyu_2451_34636.zip\",\"http://lccn.loc.gov/sh85035852\":\"https://archive.nyu.edu/retrieve/74857/nyu_2451_34636_doc.zip\"}",
8
+ "layer_id_s": "sdr:nyu_2451_34636",
9
+ "layer_slug_s": "nyu_2451_34636",
10
+ "layer_geom_type_s": "Mixed",
11
+ "layer_modified_dt": "2016-5-2T18:21:7Z",
12
+ "dc_format_s": "ESRI Geodatabase",
13
+ "dc_language_s": "English",
14
+ "dc_type_s": "Dataset",
15
+ "dc_publisher_s": [
16
+ "Newman Library (Bernard M. Baruch College)"
17
+ ],
18
+ "dc_creator_sm": "GIS Lab, Newman Library, Baruch CUNY",
19
+ "dc_subject_sm": [
20
+ "Boroughs",
21
+ "Boundaries",
22
+ "Counties"
23
+ ],
24
+ "dct_isPartOf_sm": "NYC Geodatabase (version jan2016)",
25
+ "dct_issued_s": "1/15/2016",
26
+ "dct_temporal_sm": [
27
+ "2010",
28
+ "2016"
29
+ ],
30
+ "dct_spatial_sm": [
31
+ "New York, New York, United States",
32
+ "Bronx County, New York, United States",
33
+ "Kings County, New York, United States",
34
+ "New York County, New York, United States",
35
+ "Queens County, New York, United States",
36
+ "Richmond County, New York, United States",
37
+ "Borough of Bronx, New York, United States",
38
+ "Borough of Brooklyn, New York, United States",
39
+ "Borough of Manhattan, New York, United States",
40
+ "Borough of Queens, New York, United States",
41
+ "Borough of Staten Island, New York, United States"
42
+ ],
43
+ "solr_geom": "ENVELOPE(-74.255895, -73.700272, 40.9152819999998, 40.4959289999998)",
44
+ "solr_year_i": 2016,
45
+ "geoblacklight_version": "1.0"
46
+ }
@@ -1,34 +1,37 @@
1
1
  {
2
2
  "geoblacklight_version": "1.0",
3
- "dc_creator_sm": [
4
- "State of Michigan"
5
- ],
6
- "dc_description_s": "Michigan Glacial Landsystems",
7
- "dc_format_s": "Shapefile",
8
- "dc_identifier_s": "urn-ad0e6ebc-824e-4450-a0d9-987f2232724f",
9
- "dc_publisher_sm": [
10
- "State of Michigan GIS Open Data"
11
- ],
3
+ "layer_geom_type_s": "Polygon",
4
+ "layer_modified_dt": "2016-09-19T16:48:34Z",
5
+ "solr_geom": "ENVELOPE(-93.772, -93.1769, 45.2477, 44.7834)",
6
+ "dct_references_s": "{\"http://schema.org/downloadUrl\":\"http://gis.hennepin.opendata.arcgis.com/datasets/62c63204202b45aca308a60efd8784d9_0.zip\",\"http://schema.org/url\":\"http://gis.hennepin.opendata.arcgis.com/datasets/62c63204202b45aca308a60efd8784d9_0\",\"http://www.isotc211.org/schemas/2005/gmd/\":\"https://opengeometadata.github.io/edu.umn/0f/7a/e3/8b4bf24e03a32be87f245ccb03/iso19139.xml\",\"urn:x-esri:serviceType:ArcGIS#DynamicMapLayer\":\"https://gis.hennepin.us/arcgis/rest/services/HennepinData/PEOPLE_SOCIETY/MapServer/0\"}",
12
7
  "dc_rights_s": "Public",
8
+ "dct_provenance_s": "Minnesota",
13
9
  "dc_subject_sm": [
14
- "geoscientificinformation",
15
- "utilitiesCommunications",
16
- "inlandWaters",
17
- "glaciers",
18
- "geology"
10
+ "Society"
11
+ ],
12
+ "dct_temporal_sm": [
13
+ "2015"
14
+ ],
15
+ "dc_description_s": "2010 US Census County Subdivisions (Cities) for Hennepin County with subset of PL94-171 demographic data. The Hennepin County GIS Office downloaded US Census data from the following sites: Shapefiles: http://www.census.gov/cgi-bin/geo/shapefiles2010/main PL94-171: http://www.census.gov/rdo/data/2010_census_redistricting_data_pl_94-171_summary_files.html PL94-171 tabular data was post processed per instructions and stored in an Access database. Link to Attribute Table Information: http://gis.hennepin.us/OpenData/Metadata/2010%20Census%20Cities.pdf Data updated: 04/08/2011 Use Limitations: This data (i) is furnished 'AS IS' with no representation as to completeness or accuracy; (ii) is furnished with no warranty of any kind; and (iii) is not suitable for legal, engineering or surveying purposes. Hennepin County shall not be liable for any damage, injury or loss resulting from this data.",
16
+ "dct_issued_s": "2015-09-11T18:24:36Z",
17
+ "dc_format_s": "Shapefile",
18
+ "dc_creator_sm": [
19
+ "Hennepin County"
19
20
  ],
20
- "dc_title_s": "Glacial Landsystems: Michigan, 2015",
21
21
  "dc_type_s": "Dataset",
22
- "dct_issued_s": "2015-02-28T18:53:27Z",
23
- "dct_provenance_s": "Michigan State",
24
- "dct_references_s": "{\"http://schema.org/downloadUrl\":\"http://gis.michigan.opendata.arcgis.com/datasets/a020fc444ff04d6abf7b03b268cadb71_9.zip\",\"http://schema.org/url\":\"http://gis.michigan.opendata.arcgis.com/datasets/a020fc444ff04d6abf7b03b268cadb71_9\",\"http://www.isotc211.org/schemas/2005/gmd/\":\"https://opengeometadata.github.io/edu.michstate/ad/0e/6e/bc824e4450a0d9987f2232724f/iso19139.xml\",\"urn:x-esri:serviceType:ArcGIS#DynamicMapLayer\":\"https://gisago.mcgi.state.mi.us/arcgis/rest/services/OpenData/hydro/MapServer/9\"}",
22
+ "dc_identifier_s": "urn-0f7ae38b-4bf2-4e03-a32b-e87f245ccb03",
23
+ "dct_isPartOf_sm": [
24
+ "Hennepin County Open Data"
25
+ ],
26
+ "solr_year_i": 2015,
25
27
  "dct_spatial_sm": [
26
- "Michigan"
28
+ "Hennepin County, Minnesota",
29
+ "Minnesota"
27
30
  ],
28
- "layer_geom_type_s": "Polygon",
29
- "layer_id_s": "urn:urn-ad0e6ebc-824e-4450-a0d9-987f2232724f",
30
- "layer_modified_dt": "2016-07-18T15:17:46Z",
31
- "layer_slug_s": "michigan-state-urn-ad0e6ebc-824e-4450-a0d9-987f2232724f",
32
- "solr_geom": "ENVELOPE(-90.5497, -82.0758, 48.2152, 41.6321)",
33
- "solr_year_i": 2015
34
- }
31
+ "dc_publisher_sm": [
32
+ "Hennepin County"
33
+ ],
34
+ "layer_id_s": "urn:urn-0f7ae38b-4bf2-4e03-a32b-e87f245ccb03",
35
+ "dc_title_s": "2010 Census Cities: Hennepin County, Minnesota",
36
+ "layer_slug_s": "Minnesota-urn-0f7ae38b-4bf2-4e03-a32b-e87f245ccb03"
37
+ }
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe Geoblacklight::Relation::Ancestors do
4
+ let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
5
+ let(:ancestors) { described_class.new('nyu_2451_34502', repository) }
6
+ let(:empty_ancestors) { described_class.new('harvard-g7064-s2-1834-k3', repository) }
7
+
8
+ describe '#create_search_params' do
9
+ it 'assembles the correct search params for finding ancestor documents' do
10
+ expect(ancestors.create_search_params).to eq(fq: ["{!join from=#{Settings.FIELDS.SOURCE} to=layer_slug_s}layer_slug_s:nyu_2451_34502"], fl: [Settings.FIELDS.TITLE.to_s, 'layer_slug_s'])
11
+ end
12
+ end
13
+
14
+ describe '#execute_query' do
15
+ it 'executes the query for finding ancestors, return response' do
16
+ expect(ancestors.execute_query).to include('responseHeader')
17
+ end
18
+ end
19
+
20
+ describe '#results' do
21
+ it 'produces a hash of results from the query' do
22
+ expect(ancestors.results).to include('numFound')
23
+ expect(ancestors.results).to include('docs')
24
+ end
25
+ it 'has non-zero numfound for a document with ancestors' do
26
+ expect(ancestors.results['numFound']).to be > 0
27
+ end
28
+ it 'has zero numfound for a document without ancestors' do
29
+ expect(empty_ancestors.results['numFound']).to eq(0)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe Geoblacklight::Relation::Descendants do
4
+ let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
5
+ let(:descendants) { described_class.new('nyu_2451_34636', repository) }
6
+ let(:empty_descendants) { described_class.new('harvard-g7064-s2-1834-k3', repository) }
7
+
8
+ describe '#create_search_params' do
9
+ it 'assembles the correct search params for finding descendant documents' do
10
+ expect(descendants.create_search_params).to eq(fq: "#{Settings.FIELDS.SOURCE}:nyu_2451_34636", fl: [Settings.FIELDS.TITLE.to_s, 'layer_slug_s'])
11
+ end
12
+ end
13
+
14
+ describe '#execute_query' do
15
+ it 'executes the query for finding descendants, return response' do
16
+ expect(descendants.execute_query).to include('responseHeader')
17
+ end
18
+ end
19
+
20
+ describe '#results' do
21
+ it 'produces a hash of results from the query' do
22
+ expect(descendants.results).to include('numFound')
23
+ expect(descendants.results).to include('docs')
24
+ end
25
+ it 'has non-zero numfound for a document with descendants' do
26
+ expect(descendants.results['numFound']).to be > 0
27
+ end
28
+ it 'has zero numfound for a document without descendants' do
29
+ expect(empty_descendants.results['numFound']).to eq(0)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe Geoblacklight::Relation::RelationResponse do
4
+ let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
5
+ let(:relation_resp) { described_class.new('nyu_2451_34502', repository) }
6
+ let(:empty_relation_resp) { described_class.new('harvard-g7064-s2-1834-k3', repository) }
7
+ describe '#initialize' do
8
+ it 'creates a RelationResponse' do
9
+ expect(relation_resp).to be_an described_class
10
+ end
11
+ end
12
+
13
+ describe '#ancestors' do
14
+ it 'returns a hash of ancestor documents' do
15
+ expect(relation_resp.ancestors).to include('numFound')
16
+ expect(relation_resp.ancestors).to include('docs')
17
+ end
18
+ end
19
+
20
+ describe '#descendants' do
21
+ it 'returns a hash of descendant documents' do
22
+ expect(relation_resp.ancestors).to include('numFound')
23
+ expect(relation_resp.ancestors).to include('docs')
24
+ end
25
+ end
26
+
27
+ describe '#empty?' do
28
+ it 'returns false if document has ancestors or descendants' do
29
+ expect(relation_resp.empty?).to be false
30
+ end
31
+ it 'returns true if document has neither ancestors nor descendants' do
32
+ expect(empty_relation_resp.empty?).to be true
33
+ end
34
+ end
35
+ end
@@ -19,7 +19,7 @@ class TestAppGenerator < Rails::Generators::Base
19
19
  end
20
20
 
21
21
  def install_engine
22
- generate 'geoblacklight:install'
22
+ generate 'geoblacklight:install', '-f'
23
23
  end
24
24
 
25
25
  def fixtures
@@ -1 +1 @@
1
- ../fixtures/solr_documents
1
+ spec/test_app_templates/../fixtures/solr_documents
data/template.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  gem 'blacklight', '>= 6.3'
2
- gem 'geoblacklight', '>= 1.1.2'
2
+ gem 'geoblacklight', '>= 1.3'
3
3
 
4
4
  run 'bundle install'
5
5
 
6
6
  generate 'blacklight:install', '--devise'
7
- generate 'geoblacklight:install', '--solrwrapper'
7
+ generate 'geoblacklight:install', '--solrwrapper', '-f'
8
8
 
9
9
  rake 'db:migrate'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoblacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Graves
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-09-09 00:00:00.000000000 Z
14
+ date: 2016-11-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -193,14 +193,14 @@ dependencies:
193
193
  requirements:
194
194
  - - "~>"
195
195
  - !ruby/object:Gem::Version
196
- version: '0.10'
196
+ version: '1.0'
197
197
  type: :development
198
198
  prerelease: false
199
199
  version_requirements: !ruby/object:Gem::Requirement
200
200
  requirements:
201
201
  - - "~>"
202
202
  - !ruby/object:Gem::Version
203
- version: '0.10'
203
+ version: '1.0'
204
204
  - !ruby/object:Gem::Dependency
205
205
  name: capybara
206
206
  requirement: !ruby/object:Gem::Requirement
@@ -299,6 +299,7 @@ files:
299
299
  - app/assets/javascripts/geoblacklight/modules/home.js
300
300
  - app/assets/javascripts/geoblacklight/modules/item.js
301
301
  - app/assets/javascripts/geoblacklight/modules/layer_opacity.js
302
+ - app/assets/javascripts/geoblacklight/modules/relations.js
302
303
  - app/assets/javascripts/geoblacklight/modules/results.js
303
304
  - app/assets/javascripts/geoblacklight/modules/util.js
304
305
  - app/assets/javascripts/geoblacklight/viewers.js
@@ -329,6 +330,7 @@ files:
329
330
  - app/assets/stylesheets/geoblacklight/modules/twitter-typeahead.scss
330
331
  - app/assets/stylesheets/geoblacklight/modules/web_services.scss
331
332
  - app/controllers/download_controller.rb
333
+ - app/controllers/relation_controller.rb
332
334
  - app/controllers/wms_controller.rb
333
335
  - app/helpers/blacklight_helper.rb
334
336
  - app/helpers/carto_helper.rb
@@ -353,6 +355,7 @@ files:
353
355
  - app/views/catalog/_icon_facet.html.erb
354
356
  - app/views/catalog/_index_split_default.html.erb
355
357
  - app/views/catalog/_metadata.html.erb
358
+ - app/views/catalog/_relations_container.html.erb
356
359
  - app/views/catalog/_search_form_no_navbar.html.erb
357
360
  - app/views/catalog/_show_default.html.erb
358
361
  - app/views/catalog/_show_default_attribute_table.html.erb
@@ -369,6 +372,10 @@ files:
369
372
  - app/views/catalog/web_services.html.erb
370
373
  - app/views/catalog/web_services.js.erb
371
374
  - app/views/download/hgl.html.erb
375
+ - app/views/relation/_ancestors.html.erb
376
+ - app/views/relation/_descendants.html.erb
377
+ - app/views/relation/index.html.erb
378
+ - app/views/relation/index.json.jbuilder
372
379
  - app/views/shared/_header_navbar.html.erb
373
380
  - config/initializers/rails_config.rb
374
381
  - config/locales/geoblacklight.en.yml
@@ -396,6 +403,9 @@ files:
396
403
  - lib/geoblacklight/metadata.rb
397
404
  - lib/geoblacklight/reference.rb
398
405
  - lib/geoblacklight/references.rb
406
+ - lib/geoblacklight/relation/ancestors.rb
407
+ - lib/geoblacklight/relation/descendants.rb
408
+ - lib/geoblacklight/relation/relation_response.rb
399
409
  - lib/geoblacklight/routes.rb
400
410
  - lib/geoblacklight/routes/downloadable.rb
401
411
  - lib/geoblacklight/routes/exportable.rb
@@ -425,6 +435,7 @@ files:
425
435
  - solr/conf/xslt/luke.xsl
426
436
  - spec/controllers/catalog_controller_spec.rb
427
437
  - spec/controllers/download_controller_spec.rb
438
+ - spec/controllers/relation_controller_spec.rb
428
439
  - spec/controllers/wms_controller_spec.rb
429
440
  - spec/factories/user.rb
430
441
  - spec/features/bookmarks_spec.rb
@@ -441,6 +452,7 @@ files:
441
452
  - spec/features/layer_with_no_references_spec.rb
442
453
  - spec/features/linkified_attribute_table_spec.rb
443
454
  - spec/features/metadata_panel_spec.rb
455
+ - spec/features/relations_spec.rb
444
456
  - spec/features/saved_searches_spec.rb
445
457
  - spec/features/search_bar_spec.rb
446
458
  - spec/features/show_page_metadata_spec.rb
@@ -450,6 +462,8 @@ files:
450
462
  - spec/fixtures/solr_documents/actual-point1.json
451
463
  - spec/fixtures/solr_documents/actual-polygon1.json
452
464
  - spec/fixtures/solr_documents/actual-raster1.json
465
+ - spec/fixtures/solr_documents/baruch_ancestor1.json
466
+ - spec/fixtures/solr_documents/baruch_ancestor2.json
453
467
  - spec/fixtures/solr_documents/baruch_documentation_download.json
454
468
  - spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json
455
469
  - spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json
@@ -481,6 +495,9 @@ files:
481
495
  - spec/lib/geoblacklight/metadata_spec.rb
482
496
  - spec/lib/geoblacklight/reference_spec.rb
483
497
  - spec/lib/geoblacklight/references_spec.rb
498
+ - spec/lib/geoblacklight/relation/ancestors_spec.rb
499
+ - spec/lib/geoblacklight/relation/descendants_spec.rb
500
+ - spec/lib/geoblacklight/relation/relation_response_spec.rb
484
501
  - spec/lib/geoblacklight/view_helper_override_spec.rb
485
502
  - spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb
486
503
  - spec/lib/geoblacklight/wms_layer_spec.rb
@@ -524,13 +541,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
524
541
  version: 2.5.2
525
542
  requirements: []
526
543
  rubyforge_project:
527
- rubygems_version: 2.5.1
544
+ rubygems_version: 2.6.7
528
545
  signing_key:
529
546
  specification_version: 4
530
547
  summary: A discovery platform for geospatial holdings
531
548
  test_files:
532
549
  - spec/controllers/catalog_controller_spec.rb
533
550
  - spec/controllers/download_controller_spec.rb
551
+ - spec/controllers/relation_controller_spec.rb
534
552
  - spec/controllers/wms_controller_spec.rb
535
553
  - spec/factories/user.rb
536
554
  - spec/features/bookmarks_spec.rb
@@ -547,6 +565,7 @@ test_files:
547
565
  - spec/features/layer_with_no_references_spec.rb
548
566
  - spec/features/linkified_attribute_table_spec.rb
549
567
  - spec/features/metadata_panel_spec.rb
568
+ - spec/features/relations_spec.rb
550
569
  - spec/features/saved_searches_spec.rb
551
570
  - spec/features/search_bar_spec.rb
552
571
  - spec/features/show_page_metadata_spec.rb
@@ -556,6 +575,8 @@ test_files:
556
575
  - spec/fixtures/solr_documents/actual-point1.json
557
576
  - spec/fixtures/solr_documents/actual-polygon1.json
558
577
  - spec/fixtures/solr_documents/actual-raster1.json
578
+ - spec/fixtures/solr_documents/baruch_ancestor1.json
579
+ - spec/fixtures/solr_documents/baruch_ancestor2.json
559
580
  - spec/fixtures/solr_documents/baruch_documentation_download.json
560
581
  - spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json
561
582
  - spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json
@@ -587,6 +608,9 @@ test_files:
587
608
  - spec/lib/geoblacklight/metadata_spec.rb
588
609
  - spec/lib/geoblacklight/reference_spec.rb
589
610
  - spec/lib/geoblacklight/references_spec.rb
611
+ - spec/lib/geoblacklight/relation/ancestors_spec.rb
612
+ - spec/lib/geoblacklight/relation/descendants_spec.rb
613
+ - spec/lib/geoblacklight/relation/relation_response_spec.rb
590
614
  - spec/lib/geoblacklight/view_helper_override_spec.rb
591
615
  - spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb
592
616
  - spec/lib/geoblacklight/wms_layer_spec.rb