linked_rails 0.0.1 → 0.0.4.pre.g9b7bc9073

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -674
  3. data/app/controllers/linked_rails/actions/objects_controller.rb +9 -0
  4. data/app/controllers/linked_rails/bulk_controller.rb +71 -21
  5. data/app/controllers/linked_rails/enum_values_controller.rb +0 -42
  6. data/app/models/linked_rails/actions/item.rb +64 -55
  7. data/app/models/linked_rails/actions/list.rb +6 -31
  8. data/app/models/linked_rails/actions/object.rb +38 -0
  9. data/app/models/linked_rails/collection/configuration.rb +55 -0
  10. data/app/models/linked_rails/collection/filter.rb +1 -1
  11. data/app/models/linked_rails/collection/filter_field.rb +19 -2
  12. data/app/models/linked_rails/collection/filter_option.rb +1 -1
  13. data/app/models/linked_rails/collection/filterable.rb +6 -9
  14. data/app/models/linked_rails/collection/infinite.rb +113 -0
  15. data/app/models/linked_rails/collection/infinite_view.rb +1 -90
  16. data/app/models/linked_rails/collection/iri.rb +47 -43
  17. data/app/models/linked_rails/collection/iri_mapping.rb +15 -7
  18. data/app/models/linked_rails/collection/paginated.rb +46 -0
  19. data/app/models/linked_rails/collection/paginated_view.rb +1 -33
  20. data/app/models/linked_rails/collection/sortable.rb +1 -9
  21. data/app/models/linked_rails/collection/sorting.rb +1 -1
  22. data/app/models/linked_rails/collection/view.rb +51 -14
  23. data/app/models/linked_rails/collection.rb +53 -85
  24. data/app/models/linked_rails/creative_work.rb +1 -1
  25. data/app/models/linked_rails/entry_point.rb +8 -5
  26. data/app/models/linked_rails/enum_value.rb +40 -2
  27. data/app/models/linked_rails/form/field/association_input.rb +7 -1
  28. data/app/models/linked_rails/form/field/file_input.rb +1 -0
  29. data/app/models/linked_rails/form/field/resource_field.rb +2 -0
  30. data/{lib/linked_rails/enhancements/indexable/model.rb → app/models/linked_rails/form/field/url_input.rb} +3 -3
  31. data/app/models/linked_rails/form/field.rb +37 -13
  32. data/app/models/linked_rails/form/field_factory.rb +48 -18
  33. data/app/models/linked_rails/form/group.rb +4 -6
  34. data/app/models/linked_rails/form/page.rb +8 -4
  35. data/app/models/linked_rails/form.rb +16 -21
  36. data/app/models/linked_rails/manifest.rb +8 -2
  37. data/app/models/linked_rails/menus/item.rb +10 -13
  38. data/app/models/linked_rails/menus/list.rb +16 -7
  39. data/app/models/linked_rails/ontology/base.rb +3 -1
  40. data/app/models/linked_rails/ontology/class.rb +3 -3
  41. data/app/models/linked_rails/ontology.rb +5 -5
  42. data/app/models/linked_rails/property_query.rb +2 -0
  43. data/app/models/linked_rails/sequence.rb +4 -13
  44. data/app/models/linked_rails/shacl/property_shape.rb +1 -1
  45. data/app/models/linked_rails/web_page.rb +0 -4
  46. data/app/models/linked_rails/web_site.rb +0 -4
  47. data/app/models/linked_rails/widget.rb +4 -11
  48. data/app/policies/linked_rails/actions/object_policy.rb +11 -0
  49. data/app/policies/linked_rails/collection_policy.rb +2 -2
  50. data/app/serializers/linked_rails/actions/item_serializer.rb +5 -5
  51. data/app/serializers/linked_rails/actions/object_serializer.rb +9 -0
  52. data/app/serializers/linked_rails/collection/filter_field_serializer.rb +3 -2
  53. data/app/serializers/linked_rails/collection/filter_option_serializer.rb +1 -1
  54. data/app/serializers/linked_rails/collection/filter_serializer.rb +1 -1
  55. data/app/serializers/linked_rails/collection/sorting_serializer.rb +1 -1
  56. data/app/serializers/linked_rails/collection/view_serializer.rb +3 -3
  57. data/app/serializers/linked_rails/collection_serializer.rb +8 -7
  58. data/app/serializers/linked_rails/condition_serializer.rb +3 -3
  59. data/app/serializers/linked_rails/entry_point_serializer.rb +3 -3
  60. data/app/serializers/linked_rails/enum_value_serializer.rb +1 -0
  61. data/app/serializers/linked_rails/form/field/association_input_serializer.rb +1 -0
  62. data/app/serializers/linked_rails/form/field/file_input_serializer.rb +11 -0
  63. data/app/serializers/linked_rails/form/field_serializer.rb +3 -1
  64. data/app/serializers/linked_rails/form/group_serializer.rb +1 -1
  65. data/app/serializers/linked_rails/form/page_serializer.rb +1 -1
  66. data/app/serializers/linked_rails/menus/item_serializer.rb +3 -3
  67. data/app/serializers/linked_rails/menus/list_serializer.rb +1 -1
  68. data/app/serializers/linked_rails/ontology_serializer.rb +2 -2
  69. data/app/serializers/linked_rails/property_query_serializer.rb +7 -0
  70. data/app/serializers/linked_rails/sequence_serializer.rb +2 -5
  71. data/app/serializers/linked_rails/shacl/node_shape_serializer.rb +1 -1
  72. data/app/serializers/linked_rails/shacl/property_shape_serializer.rb +1 -1
  73. data/app/serializers/linked_rails/shacl/shape_serializer.rb +5 -5
  74. data/app/serializers/linked_rails/web_page_serializer.rb +3 -3
  75. data/app/serializers/linked_rails/web_site_serializer.rb +1 -1
  76. data/app/serializers/linked_rails/widget_serializer.rb +3 -3
  77. data/lib/generators/linked_rails/install/install_generator.rb +7 -8
  78. data/lib/generators/linked_rails/install/templates/README +7 -0
  79. data/lib/generators/linked_rails/install/templates/app_menu_list.rb +36 -7
  80. data/lib/generators/linked_rails/install/templates/application_menu_list.rb +40 -1
  81. data/lib/generators/linked_rails/install/templates/initializer.rb +1 -2
  82. data/lib/generators/linked_rails/install/templates/locales.yml +14 -0
  83. data/lib/generators/linked_rails/install/templates/rdf_serializers_initializer.rb +1 -1
  84. data/lib/generators/linked_rails/install/templates/vocab.rb +1 -0
  85. data/lib/generators/linked_rails/install/templates/vocab.yml +2 -2
  86. data/lib/generators/linked_rails/model/model_generator.rb +0 -1
  87. data/lib/generators/linked_rails/model/templates/controller.rb.tt +5 -1
  88. data/lib/generators/linked_rails/model/templates/form.rb.tt +3 -0
  89. data/lib/generators/linked_rails/model/templates/menu_list.rb.tt +15 -0
  90. data/lib/generators/linked_rails/model/templates/policy.rb.tt +13 -0
  91. data/lib/generators/linked_rails/model/templates/serializer.rb.tt +5 -1
  92. data/lib/linked_rails/active_response/controller/collections.rb +1 -1
  93. data/lib/linked_rails/active_response/controller/crud_defaults.rb +4 -4
  94. data/lib/linked_rails/active_response/controller/params.rb +10 -10
  95. data/lib/linked_rails/active_response/controller.rb +8 -18
  96. data/lib/linked_rails/active_response/responders/rdf.rb +19 -10
  97. data/lib/linked_rails/callable_variable.rb +1 -1
  98. data/lib/linked_rails/collection_params_parser.rb +93 -0
  99. data/lib/linked_rails/controller/actionable.rb +121 -0
  100. data/lib/linked_rails/controller/authorization.rb +6 -0
  101. data/lib/linked_rails/controller/default_actions/create.rb +52 -0
  102. data/lib/linked_rails/controller/default_actions/destroy.rb +42 -0
  103. data/lib/linked_rails/controller/default_actions/update.rb +43 -0
  104. data/lib/linked_rails/controller/delta.rb +78 -0
  105. data/lib/linked_rails/controller/error_handling.rb +11 -9
  106. data/lib/linked_rails/controller/rendering.rb +48 -0
  107. data/lib/linked_rails/controller.rb +24 -4
  108. data/lib/linked_rails/enhanceable.rb +1 -1
  109. data/lib/linked_rails/enhancements/creatable/controller.rb +1 -1
  110. data/lib/linked_rails/enhancements/destroyable/controller.rb +1 -1
  111. data/lib/linked_rails/enhancements/updatable/controller.rb +1 -1
  112. data/lib/linked_rails/enhancements.rb +0 -16
  113. data/lib/linked_rails/helpers/delta_helper.rb +26 -57
  114. data/lib/linked_rails/helpers/ontola_actions_helper.rb +2 -2
  115. data/lib/linked_rails/helpers/resource_helper.rb +4 -2
  116. data/lib/linked_rails/iri_mapper.rb +17 -39
  117. data/lib/linked_rails/middleware/error_handling.rb +51 -0
  118. data/lib/linked_rails/middleware/linked_data_params.rb +30 -151
  119. data/lib/linked_rails/model/actionable.rb +68 -0
  120. data/lib/linked_rails/model/collections.rb +201 -39
  121. data/lib/linked_rails/model/dirty.rb +7 -8
  122. data/lib/linked_rails/model/enhancements.rb +1 -6
  123. data/lib/linked_rails/model/filtering.rb +4 -6
  124. data/lib/linked_rails/model/indexable.rb +6 -16
  125. data/lib/linked_rails/model/iri.rb +28 -19
  126. data/lib/linked_rails/model/iri_mapping.rb +37 -8
  127. data/lib/linked_rails/model/menuable.rb +28 -0
  128. data/lib/linked_rails/model/serialization.rb +2 -15
  129. data/lib/linked_rails/model/singularable.rb +57 -0
  130. data/lib/linked_rails/model/sorting.rb +0 -5
  131. data/lib/linked_rails/model/tables.rb +26 -0
  132. data/lib/linked_rails/model.rb +17 -7
  133. data/lib/linked_rails/params_parser.rb +133 -55
  134. data/lib/linked_rails/policy/attribute_conditions.rb +2 -2
  135. data/lib/linked_rails/policy.rb +40 -46
  136. data/lib/linked_rails/railtie.rb +11 -0
  137. data/lib/linked_rails/rdf_error.rb +2 -2
  138. data/lib/linked_rails/renderers.rb +1 -0
  139. data/lib/linked_rails/routes.rb +38 -22
  140. data/lib/linked_rails/serializer/actionable.rb +27 -0
  141. data/lib/linked_rails/serializer/menuable.rb +31 -0
  142. data/lib/linked_rails/serializer/singularable.rb +26 -0
  143. data/lib/linked_rails/serializer.rb +28 -11
  144. data/lib/linked_rails/test_methods.rb +114 -0
  145. data/lib/linked_rails/translate.rb +31 -9
  146. data/lib/linked_rails/types/iri_type.rb +37 -0
  147. data/lib/linked_rails/uri_template.rb +30 -0
  148. data/lib/linked_rails/version.rb +1 -1
  149. data/lib/linked_rails/vocab.rb +9 -0
  150. data/lib/linked_rails.rb +30 -13
  151. data/lib/rails/welcome_controller.rb +3 -2
  152. data/lib/rdf/list.rb +9 -0
  153. data/lib/rdf/query_fix.rb +15 -0
  154. metadata +58 -33
  155. data/app/models/linked_rails/actions/default_actions/create.rb +0 -60
  156. data/app/models/linked_rails/actions/default_actions/destroy.rb +0 -45
  157. data/app/models/linked_rails/actions/default_actions/update.rb +0 -50
  158. data/app/models/linked_rails/actions/default_actions.rb +0 -17
  159. data/lib/generators/linked_rails/install/templates/application_action_list.rb +0 -3
  160. data/lib/generators/linked_rails/model/templates/action_list.rb.tt +0 -6
  161. data/lib/linked_rails/enhancements/actionable/model.rb +0 -71
  162. data/lib/linked_rails/enhancements/actionable/serializer.rb +0 -25
  163. data/lib/linked_rails/enhancements/creatable/action.rb +0 -15
  164. data/lib/linked_rails/enhancements/destroyable/action.rb +0 -15
  165. data/lib/linked_rails/enhancements/destroyable/routing.rb +0 -19
  166. data/lib/linked_rails/enhancements/menuable/model.rb +0 -36
  167. data/lib/linked_rails/enhancements/menuable/serializer.rb +0 -33
  168. data/lib/linked_rails/enhancements/route_concerns.rb +0 -56
  169. data/lib/linked_rails/enhancements/singularable/controller.rb +0 -43
  170. data/lib/linked_rails/enhancements/singularable/model.rb +0 -47
  171. data/lib/linked_rails/enhancements/singularable/serializer.rb +0 -28
  172. data/lib/linked_rails/enhancements/tableable/model.rb +0 -28
  173. data/lib/linked_rails/enhancements/updatable/action.rb +0 -15
  174. data/lib/linked_rails/enhancements/updatable/routing.rb +0 -20
data/lib/linked_rails.rb CHANGED
@@ -1,22 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_response'
4
+ require 'empathy/emp_json'
4
5
  require 'jsonapi/serializer'
5
6
  require 'kaminari/activerecord'
6
7
  require 'rdf'
8
+ require 'rdf/list'
9
+ require 'rdf/query_fix'
7
10
  require 'rdf/vocab'
8
- require 'uri_template'
9
11
  require 'nill_class_renderer'
10
12
  require 'linked_rails/engine'
11
13
  require 'linked_rails/iri_mapper'
14
+ require 'linked_rails/collection_params_parser'
12
15
  require 'linked_rails/params_parser'
13
16
  require 'linked_rails/middleware/linked_data_params'
17
+ require 'linked_rails/middleware/error_handling'
14
18
  require 'linked_rails/renderers'
15
19
 
16
20
  module LinkedRails
17
21
  @model_classes = {}
18
22
 
19
- mattr_accessor :app_vocab, default: RDF::Vocabulary.new('http://example.com/my_vocab#')
20
23
  mattr_accessor :whitelisted_spi_ips
21
24
  mattr_writer :host, :scheme
22
25
 
@@ -37,37 +40,51 @@ module LinkedRails
37
40
  # rubocop:enable Style/ClassVars
38
41
  end
39
42
 
43
+ def linked_models
44
+ @linked_models ||= ObjectSpace.each_object(Class).select do |c|
45
+ c.included_modules.include?(LinkedRails::Model)
46
+ end
47
+ end
48
+
40
49
  def scheme
41
50
  @@scheme ||= Rails.application.routes.default_url_options[:protocol] || :http # rubocop:disable Style/ClassVars
42
51
  end
43
52
 
44
- def iri(opts = {})
53
+ def iri(**opts)
45
54
  RDF::URI.new(**{scheme: LinkedRails.scheme, host: LinkedRails.host}.merge(opts))
46
55
  end
47
56
  end
48
57
 
49
- %i[collection entry_point ontology].each { |klass| configurable_class(nil, klass) }
50
- %i[filter sorting view infinite_view paginated_view].each { |klass| configurable_class(:collection, klass) }
51
- configurable_class(:ontology, :class)
52
- configurable_class(:ontology, :property)
53
58
  configurable_class(:actions, :item)
59
+ configurable_class(:collection, :filter)
60
+ configurable_class(:collection, :sorting)
61
+ configurable_class(:collection, :view)
62
+ configurable_class(:collection, :infinite_view)
63
+ configurable_class(:collection, :paginated_view)
54
64
  configurable_class(:menus, :item)
55
- configurable_class(nil, :current_user)
56
- configurable_class(nil, :manifest)
57
- configurable_class(nil, :rdf_error, default: 'LinkedRails::RDFError')
58
- configurable_class(nil, :action_list_parent, default: 'ApplicationActionList')
65
+ configurable_class(:ontology, :class)
66
+ configurable_class(:ontology, :property)
67
+ configurable_class(nil, :action_list_parent, default: 'LinkedRails::Actions::List')
68
+ configurable_class(nil, :collection)
59
69
  configurable_class(nil, :controller_parent, default: 'ApplicationController')
70
+ configurable_class(nil, :current_user)
71
+ configurable_class(nil, :entry_point)
60
72
  configurable_class(nil, :form_parent, default: 'ApplicationForm')
73
+ configurable_class(nil, :iri_mapper, default: 'LinkedRails::IRIMapper', reader: :iri_mapper)
74
+ configurable_class(nil, :manifest)
75
+ configurable_class(nil, :ontology)
61
76
  configurable_class(nil, :policy_parent, default: 'ApplicationPolicy')
77
+ configurable_class(nil, :rdf_error, default: 'LinkedRails::RDFError')
62
78
  configurable_class(nil, :serializer_parent, default: 'ApplicationSerializer')
63
- configurable_class(nil, :iri_mapper, default: 'LinkedRails::IRIMapper', reader: :iri_mapper)
64
79
  end
65
80
 
66
81
  ActiveSupport::Inflector.inflections do |inflect|
82
+ inflect.acronym 'IRI'
67
83
  inflect.acronym 'RDF'
68
84
  inflect.acronym 'SHACL'
69
85
  end
70
86
 
87
+ require 'linked_rails/uri_template'
71
88
  require 'linked_rails/vocab'
72
89
  require 'linked_rails/cache'
73
90
  require 'linked_rails/enhancements'
@@ -83,4 +100,4 @@ require 'linked_rails/rdf_error'
83
100
  require 'linked_rails/routes'
84
101
  require 'linked_rails/serializer'
85
102
  require 'linked_rails/translate'
86
- require_relative 'rails/welcome_controller'
103
+ require 'linked_rails/railtie'
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'rails/application_controller'
4
+
3
5
  module Rails
4
- class WelcomeController
5
- include ActiveResponse::Controller
6
+ class WelcomeController < Rails::ApplicationController
6
7
  include LinkedRails::Controller
7
8
 
8
9
  def index
data/lib/rdf/list.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RDF
4
+ class List
5
+ def serializer_class
6
+ RDF::Serializers::ListSerializer
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module QueryFix
4
+ def initialize(*args, **options)
5
+ if args.length == 1 && args.first.is_a?(String) && args.first.include?('?')
6
+ split_iri = args.first.split('?')
7
+
8
+ super([split_iri[0], split_iri[1]&.gsub('+', '%20')].join('?'), **options)
9
+ else
10
+ super
11
+ end
12
+ end
13
+ end
14
+
15
+ RDF::URI.prepend(QueryFix)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linked_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.4.pre.g9b7bc9073
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Dingemans
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-26 00:00:00.000000000 Z
11
+ date: 2022-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_response
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.0.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: emp_json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: kaminari-activerecord
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +86,14 @@ dependencies:
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: 0.0.8
89
+ version: 0.0.10
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: 0.0.8
96
+ version: 0.0.10
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rdf-vocab
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +192,7 @@ dependencies:
178
192
  - - ">="
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
181
- description:
195
+ description:
182
196
  email:
183
197
  - arthur@argu.co
184
198
  executables: []
@@ -189,6 +203,7 @@ files:
189
203
  - README.md
190
204
  - Rakefile
191
205
  - app/controllers/linked_rails/actions/items_controller.rb
206
+ - app/controllers/linked_rails/actions/objects_controller.rb
192
207
  - app/controllers/linked_rails/bulk_controller.rb
193
208
  - app/controllers/linked_rails/current_user_controller.rb
194
209
  - app/controllers/linked_rails/enum_values_controller.rb
@@ -198,20 +213,20 @@ files:
198
213
  - app/controllers/linked_rails/menus/lists_controller.rb
199
214
  - app/controllers/linked_rails/not_found_controller.rb
200
215
  - app/controllers/linked_rails/ontologies_controller.rb
201
- - app/models/linked_rails/actions/default_actions.rb
202
- - app/models/linked_rails/actions/default_actions/create.rb
203
- - app/models/linked_rails/actions/default_actions/destroy.rb
204
- - app/models/linked_rails/actions/default_actions/update.rb
205
216
  - app/models/linked_rails/actions/item.rb
206
217
  - app/models/linked_rails/actions/list.rb
218
+ - app/models/linked_rails/actions/object.rb
207
219
  - app/models/linked_rails/collection.rb
220
+ - app/models/linked_rails/collection/configuration.rb
208
221
  - app/models/linked_rails/collection/filter.rb
209
222
  - app/models/linked_rails/collection/filter_field.rb
210
223
  - app/models/linked_rails/collection/filter_option.rb
211
224
  - app/models/linked_rails/collection/filterable.rb
225
+ - app/models/linked_rails/collection/infinite.rb
212
226
  - app/models/linked_rails/collection/infinite_view.rb
213
227
  - app/models/linked_rails/collection/iri.rb
214
228
  - app/models/linked_rails/collection/iri_mapping.rb
229
+ - app/models/linked_rails/collection/paginated.rb
215
230
  - app/models/linked_rails/collection/paginated_view.rb
216
231
  - app/models/linked_rails/collection/sortable.rb
217
232
  - app/models/linked_rails/collection/sorting.rb
@@ -243,6 +258,7 @@ files:
243
258
  - app/models/linked_rails/form/field/text_area_input.rb
244
259
  - app/models/linked_rails/form/field/text_input.rb
245
260
  - app/models/linked_rails/form/field/toggle_button_group.rb
261
+ - app/models/linked_rails/form/field/url_input.rb
246
262
  - app/models/linked_rails/form/field_factory.rb
247
263
  - app/models/linked_rails/form/group.rb
248
264
  - app/models/linked_rails/form/page.rb
@@ -265,6 +281,7 @@ files:
265
281
  - app/models/linked_rails/widget.rb
266
282
  - app/policies/linked_rails/actions/item_policy.rb
267
283
  - app/policies/linked_rails/actions/list_policy.rb
284
+ - app/policies/linked_rails/actions/object_policy.rb
268
285
  - app/policies/linked_rails/collection/view_policy.rb
269
286
  - app/policies/linked_rails/collection_policy.rb
270
287
  - app/policies/linked_rails/enum_value_policy.rb
@@ -272,6 +289,7 @@ files:
272
289
  - app/policies/linked_rails/menus/list_policy.rb
273
290
  - app/policies/linked_rails/sequence_policy.rb
274
291
  - app/serializers/linked_rails/actions/item_serializer.rb
292
+ - app/serializers/linked_rails/actions/object_serializer.rb
275
293
  - app/serializers/linked_rails/collection/filter_field_serializer.rb
276
294
  - app/serializers/linked_rails/collection/filter_option_serializer.rb
277
295
  - app/serializers/linked_rails/collection/filter_serializer.rb
@@ -284,6 +302,7 @@ files:
284
302
  - app/serializers/linked_rails/entry_point_serializer.rb
285
303
  - app/serializers/linked_rails/enum_value_serializer.rb
286
304
  - app/serializers/linked_rails/form/field/association_input_serializer.rb
305
+ - app/serializers/linked_rails/form/field/file_input_serializer.rb
287
306
  - app/serializers/linked_rails/form/field/resource_field_serializer.rb
288
307
  - app/serializers/linked_rails/form/field/select_input_serializer.rb
289
308
  - app/serializers/linked_rails/form/field_serializer.rb
@@ -296,6 +315,7 @@ files:
296
315
  - app/serializers/linked_rails/ontology/class_serializer.rb
297
316
  - app/serializers/linked_rails/ontology/property_serializer.rb
298
317
  - app/serializers/linked_rails/ontology_serializer.rb
318
+ - app/serializers/linked_rails/property_query_serializer.rb
299
319
  - app/serializers/linked_rails/rdf_error_serializer.rb
300
320
  - app/serializers/linked_rails/sequence_serializer.rb
301
321
  - app/serializers/linked_rails/shacl/node_shape_serializer.rb
@@ -306,8 +326,8 @@ files:
306
326
  - app/serializers/linked_rails/widget_serializer.rb
307
327
  - config/initializers/inflections.rb
308
328
  - lib/generators/linked_rails/install/install_generator.rb
329
+ - lib/generators/linked_rails/install/templates/README
309
330
  - lib/generators/linked_rails/install/templates/app_menu_list.rb
310
- - lib/generators/linked_rails/install/templates/application_action_list.rb
311
331
  - lib/generators/linked_rails/install/templates/application_form.rb
312
332
  - lib/generators/linked_rails/install/templates/application_menu_list.rb
313
333
  - lib/generators/linked_rails/install/templates/application_policy.rb
@@ -319,7 +339,6 @@ files:
319
339
  - lib/generators/linked_rails/install/templates/vocab.rb
320
340
  - lib/generators/linked_rails/install/templates/vocab.yml
321
341
  - lib/generators/linked_rails/model/model_generator.rb
322
- - lib/generators/linked_rails/model/templates/action_list.rb.tt
323
342
  - lib/generators/linked_rails/model/templates/controller.rb.tt
324
343
  - lib/generators/linked_rails/model/templates/create_table_migration.rb.tt
325
344
  - lib/generators/linked_rails/model/templates/form.rb.tt
@@ -336,38 +355,32 @@ files:
336
355
  - lib/linked_rails/active_response/responders/rdf.rb
337
356
  - lib/linked_rails/cache.rb
338
357
  - lib/linked_rails/callable_variable.rb
358
+ - lib/linked_rails/collection_params_parser.rb
339
359
  - lib/linked_rails/constraints/whitelist.rb
340
360
  - lib/linked_rails/controller.rb
361
+ - lib/linked_rails/controller/actionable.rb
341
362
  - lib/linked_rails/controller/authorization.rb
363
+ - lib/linked_rails/controller/default_actions/create.rb
364
+ - lib/linked_rails/controller/default_actions/destroy.rb
365
+ - lib/linked_rails/controller/default_actions/update.rb
366
+ - lib/linked_rails/controller/delta.rb
342
367
  - lib/linked_rails/controller/error_handling.rb
368
+ - lib/linked_rails/controller/rendering.rb
343
369
  - lib/linked_rails/engine.rb
344
370
  - lib/linked_rails/enhanceable.rb
345
371
  - lib/linked_rails/enhancements.rb
346
- - lib/linked_rails/enhancements/actionable/model.rb
347
- - lib/linked_rails/enhancements/actionable/serializer.rb
348
- - lib/linked_rails/enhancements/creatable/action.rb
349
372
  - lib/linked_rails/enhancements/creatable/controller.rb
350
- - lib/linked_rails/enhancements/destroyable/action.rb
351
373
  - lib/linked_rails/enhancements/destroyable/controller.rb
352
- - lib/linked_rails/enhancements/destroyable/routing.rb
353
- - lib/linked_rails/enhancements/indexable/model.rb
354
- - lib/linked_rails/enhancements/menuable/model.rb
355
- - lib/linked_rails/enhancements/menuable/serializer.rb
356
- - lib/linked_rails/enhancements/route_concerns.rb
357
- - lib/linked_rails/enhancements/singularable/controller.rb
358
- - lib/linked_rails/enhancements/singularable/model.rb
359
- - lib/linked_rails/enhancements/singularable/serializer.rb
360
- - lib/linked_rails/enhancements/tableable/model.rb
361
- - lib/linked_rails/enhancements/updatable/action.rb
362
374
  - lib/linked_rails/enhancements/updatable/controller.rb
363
- - lib/linked_rails/enhancements/updatable/routing.rb
364
375
  - lib/linked_rails/enhancements/updatable/serializer.rb
365
376
  - lib/linked_rails/helpers/delta_helper.rb
366
377
  - lib/linked_rails/helpers/ontola_actions_helper.rb
367
378
  - lib/linked_rails/helpers/resource_helper.rb
368
379
  - lib/linked_rails/iri_mapper.rb
380
+ - lib/linked_rails/middleware/error_handling.rb
369
381
  - lib/linked_rails/middleware/linked_data_params.rb
370
382
  - lib/linked_rails/model.rb
383
+ - lib/linked_rails/model/actionable.rb
371
384
  - lib/linked_rails/model/collections.rb
372
385
  - lib/linked_rails/model/dirty.rb
373
386
  - lib/linked_rails/model/enhancements.rb
@@ -375,26 +388,38 @@ files:
375
388
  - lib/linked_rails/model/indexable.rb
376
389
  - lib/linked_rails/model/iri.rb
377
390
  - lib/linked_rails/model/iri_mapping.rb
391
+ - lib/linked_rails/model/menuable.rb
378
392
  - lib/linked_rails/model/serialization.rb
393
+ - lib/linked_rails/model/singularable.rb
379
394
  - lib/linked_rails/model/sorting.rb
395
+ - lib/linked_rails/model/tables.rb
380
396
  - lib/linked_rails/params_parser.rb
381
397
  - lib/linked_rails/policy.rb
382
398
  - lib/linked_rails/policy/attribute_conditions.rb
399
+ - lib/linked_rails/railtie.rb
383
400
  - lib/linked_rails/rdf_error.rb
384
401
  - lib/linked_rails/renderers.rb
385
402
  - lib/linked_rails/routes.rb
386
403
  - lib/linked_rails/serializer.rb
404
+ - lib/linked_rails/serializer/actionable.rb
405
+ - lib/linked_rails/serializer/menuable.rb
406
+ - lib/linked_rails/serializer/singularable.rb
407
+ - lib/linked_rails/test_methods.rb
387
408
  - lib/linked_rails/translate.rb
409
+ - lib/linked_rails/types/iri_type.rb
410
+ - lib/linked_rails/uri_template.rb
388
411
  - lib/linked_rails/version.rb
389
412
  - lib/linked_rails/vocab.rb
390
413
  - lib/nill_class_renderer.rb
391
414
  - lib/rails/welcome_controller.rb
415
+ - lib/rdf/list.rb
416
+ - lib/rdf/query_fix.rb
392
417
  - lib/tasks/linked_rails_tasks.rake
393
418
  homepage: https://github.com/ontola/linked_rails
394
419
  licenses:
395
- - GPL-3.0-or-later
420
+ - MIT
396
421
  metadata: {}
397
- post_install_message:
422
+ post_install_message:
398
423
  rdoc_options: []
399
424
  require_paths:
400
425
  - lib
@@ -405,12 +430,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
405
430
  version: '0'
406
431
  required_rubygems_version: !ruby/object:Gem::Requirement
407
432
  requirements:
408
- - - ">="
433
+ - - ">"
409
434
  - !ruby/object:Gem::Version
410
- version: '0'
435
+ version: 1.3.1
411
436
  requirements: []
412
- rubygems_version: 3.1.2
413
- signing_key:
437
+ rubygems_version: 3.3.7
438
+ signing_key:
414
439
  specification_version: 4
415
440
  summary: LinkedRails helps you create a Linked Data application in a matter of seconds.
416
441
  test_files: []
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Actions
5
- module DefaultActions
6
- module Create
7
- def has_collection_create_action(overwrite = {}) # rubocop:disable Naming/PredicateName
8
- has_collection_action(:create, create_collection_options(overwrite))
9
- end
10
-
11
- def has_singular_create_action(overwrite = {}) # rubocop:disable Naming/PredicateName
12
- has_singular_action(:create, create_singular_options(overwrite))
13
- end
14
-
15
- private
16
-
17
- def create_collection_options(overwrite = {})
18
- default_create_options(
19
- form: -> { resource.association_class.try(:form_class) },
20
- object: -> { resource.build_child },
21
- policy: :create_child?
22
- ).merge(overwrite)
23
- end
24
-
25
- def create_singular_options(overwrite = {})
26
- default_create_options(
27
- form: -> { resource.class.try(:form_class) },
28
- object: -> { resource },
29
- policy: :create?,
30
- url: -> { resource.singular_iri }
31
- ).merge(overwrite)
32
- end
33
-
34
- def default_create_options(overwrite = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
35
- {
36
- http_method: :post,
37
- image: 'fa-plus',
38
- label: lambda do
39
- item = LinkedRails::Actions::Item.new(resource: result_class.new, tag: :create)
40
- LinkedRails.translate(:action, :label, item, false).presence ||
41
- I18n.t("#{association}.type_new", default: "New #{result_class.name.demodulize.humanize}")
42
- end,
43
- root_relative_iri: lambda {
44
- uri = resource.root_relative_iri.dup
45
- uri.path ||= ''
46
- uri.path += '/new'
47
- uri.query = Rack::Utils.parse_nested_query(uri.query).except('display', 'sort').to_param.presence
48
- uri.to_s
49
- },
50
- result: -> { result_class },
51
- type: lambda {
52
- [Vocab.ontola["Create::#{result_class}"], Vocab.schema.CreateAction]
53
- },
54
- url: -> { resource.iri }
55
- }.merge(overwrite)
56
- end
57
- end
58
- end
59
- end
60
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Actions
5
- module DefaultActions
6
- module Destroy
7
- def has_resource_destroy_action(overwrite = {}) # rubocop:disable Naming/PredicateName
8
- has_resource_action(:destroy, destroy_resource_options(overwrite))
9
- end
10
-
11
- def has_singular_destroy_action(overwrite = {}) # rubocop:disable Naming/PredicateName
12
- has_singular_action(:destroy, destroy_singular_options(overwrite))
13
- end
14
-
15
- private
16
-
17
- def destroy_resource_options(overwrite = {})
18
- default_destroy_options(overwrite)
19
- end
20
-
21
- def destroy_singular_options(overwrite = {})
22
- default_destroy_options(
23
- url: -> { resource.singular_iri }
24
- ).merge(overwrite)
25
- end
26
-
27
- def default_destroy_options(overwrite = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
28
- {
29
- http_method: :delete,
30
- image: 'fa-close',
31
- policy: :destroy?,
32
- root_relative_iri: lambda {
33
- uri = resource.root_relative_iri.dup
34
- uri.path ||= ''
35
- uri.path += '/delete'
36
- uri.to_s
37
- },
38
- type: [Vocab.schema.Action, Vocab.ontola[:DestroyAction]],
39
- url: -> { resource.iri(destroy: true) }
40
- }.merge(overwrite)
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Actions
5
- module DefaultActions
6
- module Update
7
- def has_resource_update_action(overwrite = {}) # rubocop:disable Naming/PredicateName
8
- has_resource_action(:update, update_resource_options(overwrite))
9
- end
10
-
11
- def has_singular_update_action(overwrite = {}) # rubocop:disable Naming/PredicateName
12
- has_singular_action(:update, update_singular_options(overwrite))
13
- end
14
-
15
- private
16
-
17
- def update_resource_options(overwrite = {})
18
- default_update_options(overwrite)
19
- end
20
-
21
- def update_singular_options(overwrite = {})
22
- default_update_options(
23
- url: -> { resource.singular_iri }
24
- ).merge(overwrite)
25
- end
26
-
27
- def default_update_options(overwrite = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
28
- {
29
- form: -> { resource.class.try(:form_class) },
30
- http_method: :put,
31
- image: 'fa-pencil-square-o',
32
- label: lambda {
33
- type = I18n.t("#{resource.class.name.tableize}.type", default: nil)
34
- type.present? ? I18n.t('edit_type', type: type) : I18n.t('update')
35
- },
36
- policy: :update?,
37
- root_relative_iri: lambda {
38
- uri = resource.root_relative_iri.dup
39
- uri.path ||= ''
40
- uri.path += '/edit'
41
- uri.to_s
42
- },
43
- type: Vocab.schema.UpdateAction,
44
- url: -> { resource.iri }
45
- }.merge(overwrite)
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'default_actions/create'
4
-
5
- module LinkedRails
6
- module Actions
7
- module DefaultActions
8
- extend ActiveSupport::Concern
9
-
10
- included do
11
- extend LinkedRails::Actions::DefaultActions::Create
12
- extend LinkedRails::Actions::DefaultActions::Destroy
13
- extend LinkedRails::Actions::DefaultActions::Update
14
- end
15
- end
16
- end
17
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ApplicationActionList < LinkedRails::Actions::List; end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- <% module_namespacing do -%>
4
- class <%= class_name %>ActionList < ApplicationActionList
5
- end
6
- <% end -%>
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Enhancements
5
- module Actionable
6
- module Model
7
- extend ActiveSupport::Concern
8
-
9
- def actions(user_context = nil)
10
- action_list(user_context).actions
11
- end
12
-
13
- def action(tag, user_context = nil)
14
- actions(user_context).find { |a| a.tag == tag }
15
- end
16
-
17
- def action_list(user_context)
18
- @action_list ||= {}
19
- @action_list[user_context] ||= self.class.action_list.new(resource: self, user_context: user_context)
20
- end
21
-
22
- def action_triples
23
- @action_triples ||= triples_for_actions(actions) + triples_for_actions(collection_actions)
24
- end
25
-
26
- def collection_actions
27
- (try(:collections) || []).map do |opts|
28
- collection_for(opts[:name]).actions
29
- end.flatten
30
- end
31
-
32
- private
33
-
34
- def triples_for_actions(actions)
35
- actions.flat_map do |action|
36
- triples = [
37
- [iri, action.predicate, action.iri],
38
- [iri, Vocab.schema.potentialAction, action.iri]
39
- ]
40
- triples << [iri, LinkedRails::Vocab.ontola[:favoriteAction], action.iri] if action.favorite
41
- triples
42
- end
43
- end
44
-
45
- module ClassMethods
46
- def action_list
47
- return @action_list if @action_list.try(:actionable_class) == self
48
-
49
- @action_list = defined_action_list || define_action_list
50
- end
51
-
52
- private
53
-
54
- def action_superclass
55
- superclass.try(:action_list) || LinkedRails.action_list_parent_class
56
- end
57
-
58
- def defined_action_list
59
- "#{name}ActionList".safe_constantize
60
- end
61
-
62
- def define_action_list
63
- list = const_set("#{name.demodulize}ActionList", Class.new(action_superclass))
64
- list.include_enhancements(:actionable_class, :Action)
65
- list
66
- end
67
- end
68
- end
69
- end
70
- end
71
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Enhancements
5
- module Actionable
6
- module Serializer
7
- extend ActiveSupport::Concern
8
-
9
- included do
10
- statements :action_triples
11
- end
12
-
13
- class_methods do
14
- def action_triples(object, _params)
15
- if object.iri.anonymous? && !object.singular_resource?
16
- []
17
- else
18
- object.action_triples
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end