linked_rails 0.0.3 → 0.0.4.pre.g2c53724b3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -674
- data/app/controllers/linked_rails/actions/objects_controller.rb +9 -0
- data/app/controllers/linked_rails/bulk_controller.rb +71 -21
- data/app/controllers/linked_rails/enum_values_controller.rb +0 -42
- data/app/models/linked_rails/actions/item.rb +64 -55
- data/app/models/linked_rails/actions/list.rb +6 -31
- data/app/models/linked_rails/actions/object.rb +38 -0
- data/app/models/linked_rails/collection/configuration.rb +55 -0
- data/app/models/linked_rails/collection/filter.rb +1 -1
- data/app/models/linked_rails/collection/filter_field.rb +19 -2
- data/app/models/linked_rails/collection/filter_option.rb +1 -1
- data/app/models/linked_rails/collection/filterable.rb +6 -9
- data/app/models/linked_rails/collection/infinite.rb +113 -0
- data/app/models/linked_rails/collection/infinite_view.rb +1 -90
- data/app/models/linked_rails/collection/iri.rb +47 -43
- data/app/models/linked_rails/collection/iri_mapping.rb +15 -7
- data/app/models/linked_rails/collection/paginated.rb +46 -0
- data/app/models/linked_rails/collection/paginated_view.rb +1 -33
- data/app/models/linked_rails/collection/sortable.rb +1 -9
- data/app/models/linked_rails/collection/sorting.rb +1 -1
- data/app/models/linked_rails/collection/view.rb +51 -14
- data/app/models/linked_rails/collection.rb +53 -85
- data/app/models/linked_rails/creative_work.rb +1 -1
- data/app/models/linked_rails/entry_point.rb +8 -5
- data/app/models/linked_rails/enum_value.rb +40 -2
- data/app/models/linked_rails/form/field/association_input.rb +7 -1
- data/app/models/linked_rails/form/field/file_input.rb +1 -0
- data/app/models/linked_rails/form/field/resource_field.rb +2 -0
- data/{lib/linked_rails/enhancements/indexable/model.rb → app/models/linked_rails/form/field/url_input.rb} +3 -3
- data/app/models/linked_rails/form/field.rb +37 -13
- data/app/models/linked_rails/form/field_factory.rb +48 -18
- data/app/models/linked_rails/form/group.rb +4 -6
- data/app/models/linked_rails/form/page.rb +8 -4
- data/app/models/linked_rails/form.rb +16 -21
- data/app/models/linked_rails/manifest.rb +86 -22
- data/app/models/linked_rails/menus/item.rb +10 -13
- data/app/models/linked_rails/menus/list.rb +16 -7
- data/app/models/linked_rails/ontology/base.rb +3 -1
- data/app/models/linked_rails/ontology/class.rb +3 -3
- data/app/models/linked_rails/ontology.rb +5 -5
- data/app/models/linked_rails/property_query.rb +2 -0
- data/app/models/linked_rails/sequence.rb +4 -13
- data/app/models/linked_rails/shacl/property_shape.rb +1 -1
- data/app/models/linked_rails/web_page.rb +0 -4
- data/app/models/linked_rails/web_site.rb +0 -4
- data/app/models/linked_rails/widget.rb +4 -11
- data/app/policies/linked_rails/actions/object_policy.rb +11 -0
- data/app/policies/linked_rails/collection_policy.rb +2 -2
- data/app/serializers/linked_rails/actions/item_serializer.rb +5 -5
- data/app/serializers/linked_rails/actions/object_serializer.rb +9 -0
- data/app/serializers/linked_rails/collection/filter_field_serializer.rb +3 -2
- data/app/serializers/linked_rails/collection/filter_option_serializer.rb +1 -1
- data/app/serializers/linked_rails/collection/filter_serializer.rb +1 -1
- data/app/serializers/linked_rails/collection/sorting_serializer.rb +1 -1
- data/app/serializers/linked_rails/collection/view_serializer.rb +3 -3
- data/app/serializers/linked_rails/collection_serializer.rb +8 -7
- data/app/serializers/linked_rails/condition_serializer.rb +3 -3
- data/app/serializers/linked_rails/entry_point_serializer.rb +3 -3
- data/app/serializers/linked_rails/enum_value_serializer.rb +1 -0
- data/app/serializers/linked_rails/form/field/association_input_serializer.rb +1 -0
- data/app/serializers/linked_rails/form/field/file_input_serializer.rb +11 -0
- data/app/serializers/linked_rails/form/field_serializer.rb +3 -1
- data/app/serializers/linked_rails/form/group_serializer.rb +1 -1
- data/app/serializers/linked_rails/form/page_serializer.rb +1 -1
- data/app/serializers/linked_rails/menus/item_serializer.rb +3 -3
- data/app/serializers/linked_rails/menus/list_serializer.rb +1 -1
- data/app/serializers/linked_rails/ontology_serializer.rb +2 -2
- data/app/serializers/linked_rails/property_query_serializer.rb +7 -0
- data/app/serializers/linked_rails/sequence_serializer.rb +2 -5
- data/app/serializers/linked_rails/shacl/node_shape_serializer.rb +1 -1
- data/app/serializers/linked_rails/shacl/property_shape_serializer.rb +1 -1
- data/app/serializers/linked_rails/shacl/shape_serializer.rb +5 -5
- data/app/serializers/linked_rails/web_page_serializer.rb +3 -3
- data/app/serializers/linked_rails/web_site_serializer.rb +1 -1
- data/app/serializers/linked_rails/widget_serializer.rb +3 -3
- data/lib/generators/linked_rails/install/install_generator.rb +5 -8
- data/lib/generators/linked_rails/install/templates/README +2 -0
- data/lib/generators/linked_rails/install/templates/app_menu_list.rb +36 -7
- data/lib/generators/linked_rails/install/templates/application_menu_list.rb +40 -1
- data/lib/generators/linked_rails/install/templates/initializer.rb +1 -2
- data/lib/generators/linked_rails/install/templates/locales.yml +14 -0
- data/lib/generators/linked_rails/install/templates/rdf_serializers_initializer.rb +1 -1
- data/lib/generators/linked_rails/install/templates/vocab.rb +1 -0
- data/lib/generators/linked_rails/install/templates/vocab.yml +2 -2
- data/lib/generators/linked_rails/model/model_generator.rb +0 -1
- data/lib/generators/linked_rails/model/templates/controller.rb.tt +5 -1
- data/lib/generators/linked_rails/model/templates/form.rb.tt +3 -0
- data/lib/generators/linked_rails/model/templates/menu_list.rb.tt +15 -0
- data/lib/generators/linked_rails/model/templates/policy.rb.tt +13 -0
- data/lib/generators/linked_rails/model/templates/serializer.rb.tt +5 -1
- data/lib/linked_rails/active_response/controller/collections.rb +1 -1
- data/lib/linked_rails/active_response/controller/crud_defaults.rb +4 -4
- data/lib/linked_rails/active_response/controller/params.rb +10 -10
- data/lib/linked_rails/active_response/controller.rb +8 -18
- data/lib/linked_rails/active_response/responders/rdf.rb +19 -10
- data/lib/linked_rails/callable_variable.rb +1 -1
- data/lib/linked_rails/collection_params_parser.rb +93 -0
- data/lib/linked_rails/controller/actionable.rb +121 -0
- data/lib/linked_rails/controller/authorization.rb +6 -0
- data/lib/linked_rails/controller/default_actions/create.rb +52 -0
- data/lib/linked_rails/controller/default_actions/destroy.rb +42 -0
- data/lib/linked_rails/controller/default_actions/update.rb +43 -0
- data/lib/linked_rails/controller/delta.rb +58 -0
- data/lib/linked_rails/controller/error_handling.rb +10 -10
- data/lib/linked_rails/controller/rendering.rb +48 -0
- data/lib/linked_rails/controller.rb +24 -4
- data/lib/linked_rails/enhancements/creatable/controller.rb +1 -1
- data/lib/linked_rails/enhancements/destroyable/controller.rb +1 -1
- data/lib/linked_rails/enhancements/updatable/controller.rb +1 -1
- data/lib/linked_rails/enhancements.rb +0 -16
- data/lib/linked_rails/helpers/delta_helper.rb +26 -57
- data/lib/linked_rails/helpers/ontola_actions_helper.rb +2 -2
- data/lib/linked_rails/helpers/resource_helper.rb +4 -2
- data/lib/linked_rails/iri_mapper.rb +17 -39
- data/lib/linked_rails/middleware/error_handling.rb +51 -0
- data/lib/linked_rails/middleware/linked_data_params.rb +30 -151
- data/lib/linked_rails/model/actionable.rb +68 -0
- data/lib/linked_rails/model/collections.rb +201 -39
- data/lib/linked_rails/model/dirty.rb +6 -18
- data/lib/linked_rails/model/enhancements.rb +1 -6
- data/lib/linked_rails/model/filtering.rb +4 -6
- data/lib/linked_rails/model/indexable.rb +6 -16
- data/lib/linked_rails/model/iri.rb +28 -19
- data/lib/linked_rails/model/iri_mapping.rb +37 -8
- data/lib/linked_rails/model/menuable.rb +28 -0
- data/lib/linked_rails/model/serialization.rb +2 -15
- data/lib/linked_rails/model/singularable.rb +57 -0
- data/lib/linked_rails/model/sorting.rb +0 -5
- data/lib/linked_rails/model/tables.rb +26 -0
- data/lib/linked_rails/model.rb +17 -7
- data/lib/linked_rails/params_parser.rb +131 -54
- data/lib/linked_rails/policy/attribute_conditions.rb +2 -2
- data/lib/linked_rails/policy.rb +40 -46
- data/lib/linked_rails/railtie.rb +11 -0
- data/lib/linked_rails/rdf_error.rb +2 -2
- data/lib/linked_rails/renderers.rb +1 -0
- data/lib/linked_rails/routes.rb +38 -22
- data/lib/linked_rails/serializer/actionable.rb +27 -0
- data/lib/linked_rails/serializer/menuable.rb +31 -0
- data/lib/linked_rails/serializer/singularable.rb +26 -0
- data/lib/linked_rails/serializer.rb +28 -11
- data/lib/linked_rails/test_methods.rb +114 -0
- data/lib/linked_rails/translate.rb +31 -9
- data/lib/linked_rails/types/iri_type.rb +37 -0
- data/lib/linked_rails/uri_template.rb +30 -0
- data/lib/linked_rails/version.rb +1 -1
- data/lib/linked_rails/vocab.rb +9 -0
- data/lib/linked_rails.rb +30 -13
- data/lib/rails/welcome_controller.rb +3 -3
- data/lib/rdf/list.rb +9 -0
- data/lib/rdf/query_fix.rb +15 -0
- metadata +71 -33
- data/app/models/linked_rails/actions/default_actions/create.rb +0 -60
- data/app/models/linked_rails/actions/default_actions/destroy.rb +0 -45
- data/app/models/linked_rails/actions/default_actions/update.rb +0 -50
- data/app/models/linked_rails/actions/default_actions.rb +0 -17
- data/lib/generators/linked_rails/install/templates/application_action_list.rb +0 -3
- data/lib/generators/linked_rails/model/templates/action_list.rb.tt +0 -6
- data/lib/linked_rails/enhancements/actionable/model.rb +0 -71
- data/lib/linked_rails/enhancements/actionable/serializer.rb +0 -25
- data/lib/linked_rails/enhancements/creatable/action.rb +0 -15
- data/lib/linked_rails/enhancements/destroyable/action.rb +0 -15
- data/lib/linked_rails/enhancements/destroyable/routing.rb +0 -19
- data/lib/linked_rails/enhancements/menuable/model.rb +0 -36
- data/lib/linked_rails/enhancements/menuable/serializer.rb +0 -33
- data/lib/linked_rails/enhancements/route_concerns.rb +0 -56
- data/lib/linked_rails/enhancements/singularable/controller.rb +0 -43
- data/lib/linked_rails/enhancements/singularable/model.rb +0 -47
- data/lib/linked_rails/enhancements/singularable/serializer.rb +0 -28
- data/lib/linked_rails/enhancements/tableable/model.rb +0 -28
- data/lib/linked_rails/enhancements/updatable/action.rb +0 -15
- data/lib/linked_rails/enhancements/updatable/routing.rb +0 -20
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module LinkedRails
|
4
|
-
module Enhancements
|
5
|
-
class RouteConcerns
|
6
|
-
cattr_accessor :enhancement_concerns, default: []
|
7
|
-
|
8
|
-
class << self
|
9
|
-
def add_concern(opts)
|
10
|
-
enhancement_concerns << opts unless enhancement_concerns.include?(opts)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
module ActionDispatch
|
18
|
-
module Routing
|
19
|
-
class Mapper
|
20
|
-
def include_route_concerns(klass: @scope[:controller].classify.constantize, only: nil, except: [])
|
21
|
-
include =
|
22
|
-
if klass.respond_to?(:each)
|
23
|
-
klass.map(&method(:route_concerns_for)).flatten.uniq
|
24
|
-
else
|
25
|
-
route_concerns_for(klass)
|
26
|
-
end
|
27
|
-
|
28
|
-
include &= only unless only.nil?
|
29
|
-
include -= except
|
30
|
-
|
31
|
-
concerns include
|
32
|
-
end
|
33
|
-
|
34
|
-
def add_missing_concern(enhancement)
|
35
|
-
return if @concerns.include?(concern_key_from_enhancement(enhancement))
|
36
|
-
|
37
|
-
module_parent_for(enhancement).route_concerns(self)
|
38
|
-
end
|
39
|
-
|
40
|
-
def concern_key_from_enhancement(enhancement)
|
41
|
-
module_parent_for(enhancement).to_s.demodulize.underscore.to_sym
|
42
|
-
end
|
43
|
-
|
44
|
-
def route_concerns_for(klass)
|
45
|
-
klass
|
46
|
-
.enhancement_modules(:Routing)
|
47
|
-
.each(&method(:add_missing_concern))
|
48
|
-
.map(&method(:concern_key_from_enhancement))
|
49
|
-
end
|
50
|
-
|
51
|
-
def module_parent_for(klass)
|
52
|
-
Rails.version < '6' ? klass.parent : klass.module_parent
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module LinkedRails
|
4
|
-
module Enhancements
|
5
|
-
module Singularable
|
6
|
-
module Controller
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def create_meta
|
12
|
-
data = super
|
13
|
-
data << same_as_statement
|
14
|
-
data
|
15
|
-
end
|
16
|
-
|
17
|
-
def destroy_meta
|
18
|
-
data = super
|
19
|
-
data << remove_same_as_delta
|
20
|
-
data
|
21
|
-
end
|
22
|
-
|
23
|
-
def same_as_statement
|
24
|
-
return [] unless current_resource.respond_to?(:singular_iri)
|
25
|
-
|
26
|
-
[
|
27
|
-
current_resource.singular_iri,
|
28
|
-
Vocab.owl.sameAs,
|
29
|
-
current_resource.iri
|
30
|
-
]
|
31
|
-
end
|
32
|
-
|
33
|
-
def singular_route?
|
34
|
-
params[:singular_route]
|
35
|
-
end
|
36
|
-
|
37
|
-
def remove_same_as_delta
|
38
|
-
invalidate_resource_delta(current_resource.singular_iri)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module LinkedRails
|
4
|
-
module Enhancements
|
5
|
-
module Singularable
|
6
|
-
module Model
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
included do
|
10
|
-
attr_accessor :singular_resource
|
11
|
-
|
12
|
-
alias_method :singular_resource?, :singular_resource
|
13
|
-
end
|
14
|
-
|
15
|
-
def root_relative_singular_iri(opts = {})
|
16
|
-
RDF::URI(self.class.singular_iri_template.expand(singular_iri_opts.merge(opts)))
|
17
|
-
end
|
18
|
-
|
19
|
-
def root_relative_iri(opts = {})
|
20
|
-
return super unless anonymous_iri?
|
21
|
-
|
22
|
-
root_relative_singular_iri(opts)
|
23
|
-
end
|
24
|
-
|
25
|
-
def singular_iri(opts = {})
|
26
|
-
return iri_with_root(root_relative_singular_iri(opts)) if opts.present?
|
27
|
-
|
28
|
-
@singular_iri ||= iri_with_root(root_relative_singular_iri)
|
29
|
-
end
|
30
|
-
|
31
|
-
class_methods do
|
32
|
-
def requested_singular_resource(_params, _user_context)
|
33
|
-
raise(NotImplementedError)
|
34
|
-
end
|
35
|
-
|
36
|
-
def singular_iri_template
|
37
|
-
@singular_iri_template ||= URITemplate.new("{/parent_iri*}/#{singular_route_key}{#fragment}")
|
38
|
-
end
|
39
|
-
|
40
|
-
def singular_route_key
|
41
|
-
name.underscore
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module LinkedRails
|
4
|
-
module Enhancements
|
5
|
-
module Singularable
|
6
|
-
module Serializer
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
included do
|
10
|
-
statements :same_as_statement
|
11
|
-
|
12
|
-
def self.same_as_statement(object, _params)
|
13
|
-
return [] unless object.singular_resource? && object.singular_iri != object.iri
|
14
|
-
|
15
|
-
[
|
16
|
-
RDF::Statement.new(
|
17
|
-
object.singular_iri,
|
18
|
-
Vocab.owl.sameAs,
|
19
|
-
object.iri,
|
20
|
-
graph_name: Vocab.ll[:supplant]
|
21
|
-
)
|
22
|
-
]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module LinkedRails
|
4
|
-
module Enhancements
|
5
|
-
module Tableable
|
6
|
-
module Model
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
included do
|
10
|
-
class_attribute :defined_columns
|
11
|
-
end
|
12
|
-
|
13
|
-
module ClassMethods
|
14
|
-
def with_columns(opts)
|
15
|
-
initialize_columns
|
16
|
-
defined_columns.merge!(opts)
|
17
|
-
end
|
18
|
-
|
19
|
-
def initialize_columns
|
20
|
-
return if defined_columns && method(:defined_columns).owner == singleton_class
|
21
|
-
|
22
|
-
self.defined_columns = superclass.try(:defined_columns)&.dup || {}
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module LinkedRails
|
4
|
-
module Enhancements
|
5
|
-
module Updatable
|
6
|
-
module Routing; end
|
7
|
-
|
8
|
-
class << self
|
9
|
-
def route_concerns(mapper)
|
10
|
-
mapper.concern :updatable do
|
11
|
-
mapper.member do
|
12
|
-
mapper.patch :update
|
13
|
-
mapper.put :update
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|