linked_rails 0.0.2 → 0.0.4.pre.g2c6c26e86

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) 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 +107 -22
  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 +53 -15
  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 +5 -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 +49 -25
  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 +17 -21
  36. data/app/models/linked_rails/manifest.rb +102 -22
  37. data/app/models/linked_rails/menus/item.rb +11 -14
  38. data/app/models/linked_rails/menus/list.rb +30 -10
  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 +6 -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 +3 -2
  50. data/app/policies/linked_rails/form_policy.rb +13 -0
  51. data/app/policies/linked_rails/ontology_policy.rb +13 -0
  52. data/app/serializers/linked_rails/actions/item_serializer.rb +5 -5
  53. data/app/serializers/linked_rails/actions/object_serializer.rb +9 -0
  54. data/app/serializers/linked_rails/collection/filter_field_serializer.rb +3 -2
  55. data/app/serializers/linked_rails/collection/filter_option_serializer.rb +1 -1
  56. data/app/serializers/linked_rails/collection/filter_serializer.rb +1 -1
  57. data/app/serializers/linked_rails/collection/sorting_serializer.rb +1 -1
  58. data/app/serializers/linked_rails/collection/view_serializer.rb +4 -3
  59. data/app/serializers/linked_rails/collection_serializer.rb +8 -7
  60. data/app/serializers/linked_rails/condition_serializer.rb +3 -3
  61. data/app/serializers/linked_rails/entry_point_serializer.rb +3 -3
  62. data/app/serializers/linked_rails/enum_value_serializer.rb +1 -0
  63. data/app/serializers/linked_rails/form/field/association_input_serializer.rb +1 -0
  64. data/app/serializers/linked_rails/form/field/file_input_serializer.rb +11 -0
  65. data/app/serializers/linked_rails/form/field_serializer.rb +3 -1
  66. data/app/serializers/linked_rails/form/group_serializer.rb +1 -1
  67. data/app/serializers/linked_rails/form/page_serializer.rb +1 -1
  68. data/app/serializers/linked_rails/menus/item_serializer.rb +3 -3
  69. data/app/serializers/linked_rails/menus/list_serializer.rb +1 -1
  70. data/app/serializers/linked_rails/ontology_serializer.rb +2 -2
  71. data/app/serializers/linked_rails/property_query_serializer.rb +7 -0
  72. data/app/serializers/linked_rails/sequence_serializer.rb +2 -5
  73. data/app/serializers/linked_rails/shacl/node_shape_serializer.rb +1 -1
  74. data/app/serializers/linked_rails/shacl/property_shape_serializer.rb +1 -1
  75. data/app/serializers/linked_rails/shacl/shape_serializer.rb +5 -5
  76. data/app/serializers/linked_rails/web_page_serializer.rb +3 -3
  77. data/app/serializers/linked_rails/web_site_serializer.rb +1 -1
  78. data/app/serializers/linked_rails/widget_serializer.rb +3 -3
  79. data/app/workers/linked_rails/invalidation_stream_worker.rb +16 -0
  80. data/lib/generators/linked_rails/install/install_generator.rb +7 -8
  81. data/lib/generators/linked_rails/install/templates/README +7 -0
  82. data/lib/generators/linked_rails/install/templates/app_menu_list.rb +36 -7
  83. data/lib/generators/linked_rails/install/templates/application_menu_list.rb +40 -1
  84. data/lib/generators/linked_rails/install/templates/initializer.rb +1 -2
  85. data/lib/generators/linked_rails/install/templates/locales.yml +16 -0
  86. data/lib/generators/linked_rails/install/templates/rdf_serializers_initializer.rb +1 -1
  87. data/lib/generators/linked_rails/install/templates/vocab.rb +1 -0
  88. data/lib/generators/linked_rails/install/templates/vocab.yml +2 -2
  89. data/lib/generators/linked_rails/model/model_generator.rb +0 -1
  90. data/lib/generators/linked_rails/model/templates/controller.rb.tt +5 -1
  91. data/lib/generators/linked_rails/model/templates/form.rb.tt +3 -0
  92. data/lib/generators/linked_rails/model/templates/menu_list.rb.tt +15 -0
  93. data/lib/generators/linked_rails/model/templates/policy.rb.tt +13 -0
  94. data/lib/generators/linked_rails/model/templates/serializer.rb.tt +5 -1
  95. data/lib/linked_rails/active_response/controller/collections.rb +1 -1
  96. data/lib/linked_rails/active_response/controller/crud_defaults.rb +4 -4
  97. data/lib/linked_rails/active_response/controller/params.rb +10 -10
  98. data/lib/linked_rails/active_response/controller.rb +8 -18
  99. data/lib/linked_rails/active_response/responders/rdf.rb +19 -10
  100. data/lib/linked_rails/callable_variable.rb +1 -1
  101. data/lib/linked_rails/collection_params_parser.rb +93 -0
  102. data/lib/linked_rails/controller/actionable.rb +121 -0
  103. data/lib/linked_rails/controller/authorization.rb +6 -0
  104. data/lib/linked_rails/controller/default_actions/create.rb +52 -0
  105. data/lib/linked_rails/controller/default_actions/destroy.rb +42 -0
  106. data/lib/linked_rails/controller/default_actions/update.rb +43 -0
  107. data/lib/linked_rails/controller/delta.rb +58 -0
  108. data/lib/linked_rails/controller/error_handling.rb +14 -7
  109. data/lib/linked_rails/controller/rendering.rb +48 -0
  110. data/lib/linked_rails/controller.rb +24 -4
  111. data/lib/linked_rails/enhanceable.rb +1 -1
  112. data/lib/linked_rails/enhancements/creatable/controller.rb +1 -1
  113. data/lib/linked_rails/enhancements/destroyable/controller.rb +1 -1
  114. data/lib/linked_rails/enhancements/updatable/controller.rb +1 -1
  115. data/lib/linked_rails/enhancements.rb +0 -16
  116. data/lib/linked_rails/errors/forbidden.rb +37 -0
  117. data/lib/linked_rails/errors.rb +3 -0
  118. data/lib/linked_rails/helpers/delta_helper.rb +26 -57
  119. data/lib/linked_rails/helpers/ontola_actions_helper.rb +2 -2
  120. data/lib/linked_rails/helpers/resource_helper.rb +14 -2
  121. data/lib/linked_rails/iri_mapper.rb +18 -40
  122. data/lib/linked_rails/middleware/error_handling.rb +51 -0
  123. data/lib/linked_rails/middleware/linked_data_params.rb +30 -151
  124. data/lib/linked_rails/model/actionable.rb +68 -0
  125. data/lib/linked_rails/model/cacheable.rb +45 -0
  126. data/lib/linked_rails/model/collections.rb +201 -39
  127. data/lib/linked_rails/model/dirty.rb +6 -18
  128. data/lib/linked_rails/model/enhancements.rb +1 -6
  129. data/lib/linked_rails/model/filtering.rb +4 -6
  130. data/lib/linked_rails/model/indexable.rb +6 -16
  131. data/lib/linked_rails/model/iri.rb +29 -19
  132. data/lib/linked_rails/model/iri_mapping.rb +37 -8
  133. data/lib/linked_rails/model/menuable.rb +28 -0
  134. data/lib/linked_rails/model/serialization.rb +2 -15
  135. data/lib/linked_rails/model/singularable.rb +57 -0
  136. data/lib/linked_rails/model/sorting.rb +0 -5
  137. data/lib/linked_rails/model/tables.rb +26 -0
  138. data/lib/linked_rails/model.rb +18 -7
  139. data/lib/linked_rails/params_parser.rb +131 -54
  140. data/lib/linked_rails/policy/attribute_conditions.rb +2 -2
  141. data/lib/linked_rails/policy.rb +44 -46
  142. data/lib/linked_rails/railtie.rb +11 -0
  143. data/lib/linked_rails/rdf_error.rb +2 -2
  144. data/lib/linked_rails/renderers.rb +1 -0
  145. data/lib/linked_rails/routes.rb +38 -22
  146. data/lib/linked_rails/serializer/actionable.rb +27 -0
  147. data/lib/linked_rails/serializer/menuable.rb +31 -0
  148. data/lib/linked_rails/serializer/singularable.rb +26 -0
  149. data/lib/linked_rails/serializer.rb +28 -11
  150. data/lib/linked_rails/storage.rb +32 -0
  151. data/lib/linked_rails/test_methods.rb +114 -0
  152. data/lib/linked_rails/translate.rb +31 -9
  153. data/lib/linked_rails/types/iri_type.rb +37 -0
  154. data/lib/linked_rails/uri_template.rb +30 -0
  155. data/lib/linked_rails/url.rb +11 -0
  156. data/lib/linked_rails/version.rb +1 -1
  157. data/lib/linked_rails/vocab.rb +9 -0
  158. data/lib/linked_rails.rb +40 -14
  159. data/lib/rails/welcome_controller.rb +3 -2
  160. data/lib/rdf/list.rb +9 -0
  161. data/lib/rdf/query_fix.rb +15 -0
  162. metadata +80 -33
  163. data/app/models/linked_rails/actions/default_actions/create.rb +0 -60
  164. data/app/models/linked_rails/actions/default_actions/destroy.rb +0 -45
  165. data/app/models/linked_rails/actions/default_actions/update.rb +0 -50
  166. data/app/models/linked_rails/actions/default_actions.rb +0 -17
  167. data/lib/generators/linked_rails/install/templates/application_action_list.rb +0 -3
  168. data/lib/generators/linked_rails/model/templates/action_list.rb.tt +0 -6
  169. data/lib/linked_rails/enhancements/actionable/model.rb +0 -71
  170. data/lib/linked_rails/enhancements/actionable/serializer.rb +0 -25
  171. data/lib/linked_rails/enhancements/creatable/action.rb +0 -15
  172. data/lib/linked_rails/enhancements/destroyable/action.rb +0 -15
  173. data/lib/linked_rails/enhancements/destroyable/routing.rb +0 -19
  174. data/lib/linked_rails/enhancements/menuable/model.rb +0 -36
  175. data/lib/linked_rails/enhancements/menuable/serializer.rb +0 -33
  176. data/lib/linked_rails/enhancements/route_concerns.rb +0 -56
  177. data/lib/linked_rails/enhancements/singularable/controller.rb +0 -43
  178. data/lib/linked_rails/enhancements/singularable/model.rb +0 -47
  179. data/lib/linked_rails/enhancements/singularable/serializer.rb +0 -28
  180. data/lib/linked_rails/enhancements/tableable/model.rb +0 -28
  181. data/lib/linked_rails/enhancements/updatable/action.rb +0 -15
  182. data/lib/linked_rails/enhancements/updatable/routing.rb +0 -20
data/lib/linked_rails.rb CHANGED
@@ -1,24 +1,31 @@
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
25
+ mattr_accessor :persistent_redis_database, default: ENV['PERSISTENT_REDIS_DATABASE'].presence || 6
26
+ mattr_accessor :stream_redis_database, default: ENV['STREAM_REDIS_DATABASE'].presence || 7
27
+ mattr_accessor :cache_redis_database, default: ENV['CACHE_REDIS_DATABASE'].presence || 8
28
+ mattr_accessor :cache_stream, default: ENV['CACHE_STREAM'].presence || 'transactions'
22
29
 
23
30
  def self.configurable_class(parent, klass, default: nil, reader: nil) # rubocop:disable Metrics/AbcSize
24
31
  method = :"#{[parent, klass.to_s.downcase].compact.join('_')}_class"
@@ -37,37 +44,54 @@ module LinkedRails
37
44
  # rubocop:enable Style/ClassVars
38
45
  end
39
46
 
47
+ def linked_models
48
+ @linked_models ||= ObjectSpace.each_object(Class).select do |c|
49
+ c.included_modules.include?(LinkedRails::Model)
50
+ end
51
+ end
52
+
40
53
  def scheme
41
54
  @@scheme ||= Rails.application.routes.default_url_options[:protocol] || :http # rubocop:disable Style/ClassVars
42
55
  end
43
56
 
44
- def iri(opts = {})
45
- RDF::URI.new(**{scheme: LinkedRails.scheme, host: LinkedRails.host}.merge(opts))
57
+ def iri(**args)
58
+ opts = {scheme: LinkedRails.scheme, host: LinkedRails.host}.merge(args)
59
+ opts[:path] = opts[:path].presence || '/'
60
+ RDF::URI.new(**opts)
46
61
  end
47
62
  end
48
63
 
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
64
  configurable_class(:actions, :item)
65
+ configurable_class(:collection, :filter)
66
+ configurable_class(:collection, :sorting)
67
+ configurable_class(:collection, :view)
68
+ configurable_class(:collection, :infinite_view)
69
+ configurable_class(:collection, :paginated_view)
54
70
  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')
71
+ configurable_class(:ontology, :class)
72
+ configurable_class(:ontology, :property)
73
+ configurable_class(nil, :action_list_parent, default: 'LinkedRails::Actions::List')
74
+ configurable_class(nil, :collection)
59
75
  configurable_class(nil, :controller_parent, default: 'ApplicationController')
76
+ configurable_class(nil, :current_user)
77
+ configurable_class(nil, :entry_point)
60
78
  configurable_class(nil, :form_parent, default: 'ApplicationForm')
79
+ configurable_class(nil, :iri_mapper, default: 'LinkedRails::IRIMapper', reader: :iri_mapper)
80
+ configurable_class(nil, :manifest)
81
+ configurable_class(nil, :ontology)
61
82
  configurable_class(nil, :policy_parent, default: 'ApplicationPolicy')
83
+ configurable_class(nil, :rdf_error, default: 'LinkedRails::RDFError')
62
84
  configurable_class(nil, :serializer_parent, default: 'ApplicationSerializer')
63
- configurable_class(nil, :iri_mapper, default: 'LinkedRails::IRIMapper', reader: :iri_mapper)
64
85
  end
65
86
 
66
87
  ActiveSupport::Inflector.inflections do |inflect|
88
+ inflect.acronym 'IRI'
67
89
  inflect.acronym 'RDF'
68
90
  inflect.acronym 'SHACL'
69
91
  end
70
92
 
93
+ require 'linked_rails/errors'
94
+ require 'linked_rails/uri_template'
71
95
  require 'linked_rails/vocab'
72
96
  require 'linked_rails/cache'
73
97
  require 'linked_rails/enhancements'
@@ -83,4 +107,6 @@ require 'linked_rails/rdf_error'
83
107
  require 'linked_rails/routes'
84
108
  require 'linked_rails/serializer'
85
109
  require 'linked_rails/translate'
86
- require_relative 'rails/welcome_controller'
110
+ require 'linked_rails/railtie'
111
+ require 'linked_rails/url'
112
+ require 'linked_rails/storage'
@@ -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.2
4
+ version: 0.0.4.pre.g2c6c26e86
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-26 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: 1.3.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: kaminari-activerecord
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: redis
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: rdf
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +100,14 @@ dependencies:
72
100
  requirements:
73
101
  - - "~>"
74
102
  - !ruby/object:Gem::Version
75
- version: 0.0.9
103
+ version: 0.0.10
76
104
  type: :runtime
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
108
  - - "~>"
81
109
  - !ruby/object:Gem::Version
82
- version: 0.0.9
110
+ version: 0.0.10
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: rdf-vocab
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +206,7 @@ dependencies:
178
206
  - - ">="
179
207
  - !ruby/object:Gem::Version
180
208
  version: '0'
181
- description:
209
+ description:
182
210
  email:
183
211
  - arthur@argu.co
184
212
  executables: []
@@ -189,6 +217,7 @@ files:
189
217
  - README.md
190
218
  - Rakefile
191
219
  - app/controllers/linked_rails/actions/items_controller.rb
220
+ - app/controllers/linked_rails/actions/objects_controller.rb
192
221
  - app/controllers/linked_rails/bulk_controller.rb
193
222
  - app/controllers/linked_rails/current_user_controller.rb
194
223
  - app/controllers/linked_rails/enum_values_controller.rb
@@ -198,20 +227,20 @@ files:
198
227
  - app/controllers/linked_rails/menus/lists_controller.rb
199
228
  - app/controllers/linked_rails/not_found_controller.rb
200
229
  - 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
230
  - app/models/linked_rails/actions/item.rb
206
231
  - app/models/linked_rails/actions/list.rb
232
+ - app/models/linked_rails/actions/object.rb
207
233
  - app/models/linked_rails/collection.rb
234
+ - app/models/linked_rails/collection/configuration.rb
208
235
  - app/models/linked_rails/collection/filter.rb
209
236
  - app/models/linked_rails/collection/filter_field.rb
210
237
  - app/models/linked_rails/collection/filter_option.rb
211
238
  - app/models/linked_rails/collection/filterable.rb
239
+ - app/models/linked_rails/collection/infinite.rb
212
240
  - app/models/linked_rails/collection/infinite_view.rb
213
241
  - app/models/linked_rails/collection/iri.rb
214
242
  - app/models/linked_rails/collection/iri_mapping.rb
243
+ - app/models/linked_rails/collection/paginated.rb
215
244
  - app/models/linked_rails/collection/paginated_view.rb
216
245
  - app/models/linked_rails/collection/sortable.rb
217
246
  - app/models/linked_rails/collection/sorting.rb
@@ -243,6 +272,7 @@ files:
243
272
  - app/models/linked_rails/form/field/text_area_input.rb
244
273
  - app/models/linked_rails/form/field/text_input.rb
245
274
  - app/models/linked_rails/form/field/toggle_button_group.rb
275
+ - app/models/linked_rails/form/field/url_input.rb
246
276
  - app/models/linked_rails/form/field_factory.rb
247
277
  - app/models/linked_rails/form/group.rb
248
278
  - app/models/linked_rails/form/page.rb
@@ -265,13 +295,17 @@ files:
265
295
  - app/models/linked_rails/widget.rb
266
296
  - app/policies/linked_rails/actions/item_policy.rb
267
297
  - app/policies/linked_rails/actions/list_policy.rb
298
+ - app/policies/linked_rails/actions/object_policy.rb
268
299
  - app/policies/linked_rails/collection/view_policy.rb
269
300
  - app/policies/linked_rails/collection_policy.rb
270
301
  - app/policies/linked_rails/enum_value_policy.rb
302
+ - app/policies/linked_rails/form_policy.rb
271
303
  - app/policies/linked_rails/menus/item_policy.rb
272
304
  - app/policies/linked_rails/menus/list_policy.rb
305
+ - app/policies/linked_rails/ontology_policy.rb
273
306
  - app/policies/linked_rails/sequence_policy.rb
274
307
  - app/serializers/linked_rails/actions/item_serializer.rb
308
+ - app/serializers/linked_rails/actions/object_serializer.rb
275
309
  - app/serializers/linked_rails/collection/filter_field_serializer.rb
276
310
  - app/serializers/linked_rails/collection/filter_option_serializer.rb
277
311
  - app/serializers/linked_rails/collection/filter_serializer.rb
@@ -284,6 +318,7 @@ files:
284
318
  - app/serializers/linked_rails/entry_point_serializer.rb
285
319
  - app/serializers/linked_rails/enum_value_serializer.rb
286
320
  - app/serializers/linked_rails/form/field/association_input_serializer.rb
321
+ - app/serializers/linked_rails/form/field/file_input_serializer.rb
287
322
  - app/serializers/linked_rails/form/field/resource_field_serializer.rb
288
323
  - app/serializers/linked_rails/form/field/select_input_serializer.rb
289
324
  - app/serializers/linked_rails/form/field_serializer.rb
@@ -296,6 +331,7 @@ files:
296
331
  - app/serializers/linked_rails/ontology/class_serializer.rb
297
332
  - app/serializers/linked_rails/ontology/property_serializer.rb
298
333
  - app/serializers/linked_rails/ontology_serializer.rb
334
+ - app/serializers/linked_rails/property_query_serializer.rb
299
335
  - app/serializers/linked_rails/rdf_error_serializer.rb
300
336
  - app/serializers/linked_rails/sequence_serializer.rb
301
337
  - app/serializers/linked_rails/shacl/node_shape_serializer.rb
@@ -304,10 +340,11 @@ files:
304
340
  - app/serializers/linked_rails/web_page_serializer.rb
305
341
  - app/serializers/linked_rails/web_site_serializer.rb
306
342
  - app/serializers/linked_rails/widget_serializer.rb
343
+ - app/workers/linked_rails/invalidation_stream_worker.rb
307
344
  - config/initializers/inflections.rb
308
345
  - lib/generators/linked_rails/install/install_generator.rb
346
+ - lib/generators/linked_rails/install/templates/README
309
347
  - lib/generators/linked_rails/install/templates/app_menu_list.rb
310
- - lib/generators/linked_rails/install/templates/application_action_list.rb
311
348
  - lib/generators/linked_rails/install/templates/application_form.rb
312
349
  - lib/generators/linked_rails/install/templates/application_menu_list.rb
313
350
  - lib/generators/linked_rails/install/templates/application_policy.rb
@@ -319,7 +356,6 @@ files:
319
356
  - lib/generators/linked_rails/install/templates/vocab.rb
320
357
  - lib/generators/linked_rails/install/templates/vocab.yml
321
358
  - lib/generators/linked_rails/model/model_generator.rb
322
- - lib/generators/linked_rails/model/templates/action_list.rb.tt
323
359
  - lib/generators/linked_rails/model/templates/controller.rb.tt
324
360
  - lib/generators/linked_rails/model/templates/create_table_migration.rb.tt
325
361
  - lib/generators/linked_rails/model/templates/form.rb.tt
@@ -336,38 +372,35 @@ files:
336
372
  - lib/linked_rails/active_response/responders/rdf.rb
337
373
  - lib/linked_rails/cache.rb
338
374
  - lib/linked_rails/callable_variable.rb
375
+ - lib/linked_rails/collection_params_parser.rb
339
376
  - lib/linked_rails/constraints/whitelist.rb
340
377
  - lib/linked_rails/controller.rb
378
+ - lib/linked_rails/controller/actionable.rb
341
379
  - lib/linked_rails/controller/authorization.rb
380
+ - lib/linked_rails/controller/default_actions/create.rb
381
+ - lib/linked_rails/controller/default_actions/destroy.rb
382
+ - lib/linked_rails/controller/default_actions/update.rb
383
+ - lib/linked_rails/controller/delta.rb
342
384
  - lib/linked_rails/controller/error_handling.rb
385
+ - lib/linked_rails/controller/rendering.rb
343
386
  - lib/linked_rails/engine.rb
344
387
  - lib/linked_rails/enhanceable.rb
345
388
  - 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
389
  - lib/linked_rails/enhancements/creatable/controller.rb
350
- - lib/linked_rails/enhancements/destroyable/action.rb
351
390
  - 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
391
  - lib/linked_rails/enhancements/updatable/controller.rb
363
- - lib/linked_rails/enhancements/updatable/routing.rb
364
392
  - lib/linked_rails/enhancements/updatable/serializer.rb
393
+ - lib/linked_rails/errors.rb
394
+ - lib/linked_rails/errors/forbidden.rb
365
395
  - lib/linked_rails/helpers/delta_helper.rb
366
396
  - lib/linked_rails/helpers/ontola_actions_helper.rb
367
397
  - lib/linked_rails/helpers/resource_helper.rb
368
398
  - lib/linked_rails/iri_mapper.rb
399
+ - lib/linked_rails/middleware/error_handling.rb
369
400
  - lib/linked_rails/middleware/linked_data_params.rb
370
401
  - lib/linked_rails/model.rb
402
+ - lib/linked_rails/model/actionable.rb
403
+ - lib/linked_rails/model/cacheable.rb
371
404
  - lib/linked_rails/model/collections.rb
372
405
  - lib/linked_rails/model/dirty.rb
373
406
  - lib/linked_rails/model/enhancements.rb
@@ -375,26 +408,40 @@ files:
375
408
  - lib/linked_rails/model/indexable.rb
376
409
  - lib/linked_rails/model/iri.rb
377
410
  - lib/linked_rails/model/iri_mapping.rb
411
+ - lib/linked_rails/model/menuable.rb
378
412
  - lib/linked_rails/model/serialization.rb
413
+ - lib/linked_rails/model/singularable.rb
379
414
  - lib/linked_rails/model/sorting.rb
415
+ - lib/linked_rails/model/tables.rb
380
416
  - lib/linked_rails/params_parser.rb
381
417
  - lib/linked_rails/policy.rb
382
418
  - lib/linked_rails/policy/attribute_conditions.rb
419
+ - lib/linked_rails/railtie.rb
383
420
  - lib/linked_rails/rdf_error.rb
384
421
  - lib/linked_rails/renderers.rb
385
422
  - lib/linked_rails/routes.rb
386
423
  - lib/linked_rails/serializer.rb
424
+ - lib/linked_rails/serializer/actionable.rb
425
+ - lib/linked_rails/serializer/menuable.rb
426
+ - lib/linked_rails/serializer/singularable.rb
427
+ - lib/linked_rails/storage.rb
428
+ - lib/linked_rails/test_methods.rb
387
429
  - lib/linked_rails/translate.rb
430
+ - lib/linked_rails/types/iri_type.rb
431
+ - lib/linked_rails/uri_template.rb
432
+ - lib/linked_rails/url.rb
388
433
  - lib/linked_rails/version.rb
389
434
  - lib/linked_rails/vocab.rb
390
435
  - lib/nill_class_renderer.rb
391
436
  - lib/rails/welcome_controller.rb
437
+ - lib/rdf/list.rb
438
+ - lib/rdf/query_fix.rb
392
439
  - lib/tasks/linked_rails_tasks.rake
393
440
  homepage: https://github.com/ontola/linked_rails
394
441
  licenses:
395
- - GPL-3.0-or-later
442
+ - MIT
396
443
  metadata: {}
397
- post_install_message:
444
+ post_install_message:
398
445
  rdoc_options: []
399
446
  require_paths:
400
447
  - lib
@@ -405,12 +452,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
405
452
  version: '0'
406
453
  required_rubygems_version: !ruby/object:Gem::Requirement
407
454
  requirements:
408
- - - ">="
455
+ - - ">"
409
456
  - !ruby/object:Gem::Version
410
- version: '0'
457
+ version: 1.3.1
411
458
  requirements: []
412
- rubygems_version: 3.1.2
413
- signing_key:
459
+ rubygems_version: 3.3.7
460
+ signing_key:
414
461
  specification_version: 4
415
462
  summary: LinkedRails helps you create a Linked Data application in a matter of seconds.
416
463
  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 -%>