solis 0.67.0 → 0.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/solis/graph.rb +10 -19
- data/lib/solis/model.rb +10 -7
- data/lib/solis/query.rb +5 -1
- data/lib/solis/version.rb +1 -1
- data/solis.gemspec +2 -2
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb7b4c2f87c4dfaa321b9e986296cbcef41849230a8c29efcd3385e6168e7034
|
4
|
+
data.tar.gz: 9992f2c9eef0d56c9ec0fc53fa68b45a8b5efb8e9065ddd637427c9f7a3b2087
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0284ecdce9377633bddef224daf54c25862a65e3eef78995db67b61380cae989958c088aba229c3ee100106008c948031679d61b845f4a8dbfacc5d540e0ebfb'
|
7
|
+
data.tar.gz: d6cbf0d9e0bcf54c7e5a129eb56575bea5af2391ab9f64afdd268c420e747c3c2f5577b5ce84d05ca8f8de6acf094287d3732e31fb5e8ceb2bddd89fc408eb29
|
data/lib/solis/graph.rb
CHANGED
@@ -275,16 +275,13 @@ module Solis
|
|
275
275
|
remote_resources = resource.instance_variable_get("@#{key}")
|
276
276
|
if remote_resources
|
277
277
|
remote_resources = [remote_resources] unless remote_resources.is_a?(Array)
|
278
|
-
|
279
|
-
|
280
|
-
#"/#{key.tableize}/#{resource_id}"
|
281
|
-
"#{resource.class.graph_name.gsub(/\/$/,'')}/#{belongs_to_resource_name.tableize}/#{resource_id}"
|
278
|
+
resource_ids = remote_resources.map do |remote_resource|
|
279
|
+
remote_resource.id =~ /^http/ ? remote_resource.id.split('/').last : remote_resource.id
|
282
280
|
end
|
283
281
|
|
284
|
-
# return remote_resources.length == 1 ? remote_resources.first : remote_resources
|
285
282
|
end
|
286
283
|
|
287
|
-
|
284
|
+
"#{resource.class.graph_name.gsub(/\/$/,'')}/#{belongs_to_resource_name.tableize}?filter[id]=#{resource_ids.join(',')}" unless remote_resources.nil? || resource_ids.empty?
|
288
285
|
end
|
289
286
|
end
|
290
287
|
else
|
@@ -296,18 +293,15 @@ module Solis
|
|
296
293
|
|
297
294
|
belongs_to_resource.belongs_to(resource.model.name.tableize.singularize, foreign_key: :id, primary_key: :id, resource: graph.shape_as_resource(resource.model.name)) do
|
298
295
|
link do |resource|
|
296
|
+
ids=[]
|
299
297
|
remote_resources = resource.instance_variable_get("@#{shape_name.tableize.singularize}")
|
300
298
|
if remote_resources
|
301
299
|
remote_resources = [remote_resources] unless remote_resources.is_a?(Array)
|
302
|
-
|
303
|
-
|
304
|
-
#"/#{key.tableize}/#{resource_id}"
|
305
|
-
"#{resource.class.graph_name.gsub(/\/$/,'')}/#{belongs_to_resource.name.tableize}/#{resource_id}"
|
300
|
+
resource_ids = remote_resources.map do |remote_resource|
|
301
|
+
remote_resource.id =~ /^http/ ? remote_resource.id.split('/').last : remote_resource.id
|
306
302
|
end
|
307
|
-
|
308
|
-
# return remote_resources.length == 1 ? remote_resources.first : remote_resources
|
309
303
|
end
|
310
|
-
|
304
|
+
"#{resource.class.graph_name.gsub(/\/$/,'')}/#{belongs_to_resource.name.tableize}?filter[id]=#{resource_ids.join(',')}" unless remote_resources.nil? || resource_ids.empty?
|
311
305
|
end
|
312
306
|
end
|
313
307
|
#
|
@@ -315,15 +309,12 @@ module Solis
|
|
315
309
|
remote_resources = resource.instance_variable_get("@#{key}")
|
316
310
|
if remote_resources
|
317
311
|
remote_resources = [remote_resources] unless remote_resources.is_a?(Array)
|
318
|
-
|
319
|
-
|
320
|
-
#"/#{key.tableize}/#{resource_id}"
|
321
|
-
"#{resource.class.graph_name.gsub(/\/$/,'')}/#{remote_resource.name.tableize}/#{resource_id}"
|
312
|
+
resource_ids = remote_resources.map do |remote_resource|
|
313
|
+
remote_resource.id =~ /^http/ ? remote_resource.id.split('/').last : remote_resource.id
|
322
314
|
end
|
323
315
|
|
324
|
-
#return remote_resources.length == 1 ? remote_resources.first : remote_resources
|
325
316
|
end
|
326
|
-
remote_resources.first
|
317
|
+
"#{resource.class.graph_name.gsub(/\/$/,'')}/#{remote_resources.first.name.tableize}?filter[id]=#{resource_ids.join(',')}" unless remote_resources.nil? || resource_ids.empty?
|
327
318
|
end
|
328
319
|
end
|
329
320
|
end
|
data/lib/solis/model.rb
CHANGED
@@ -26,9 +26,12 @@ module Solis
|
|
26
26
|
elsif self.class.metadata[:attributes][attribute.to_s][:node_kind].is_a?(RDF::URI) && value.is_a?(Array)
|
27
27
|
new_value = []
|
28
28
|
value.each do |v|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
if v.is_a?(Hash)
|
30
|
+
inner_model = self.class.graph.shape_as_model(self.class.metadata[:attributes][attribute.to_s][:datatype].to_s)
|
31
|
+
new_value << inner_model.new(v)
|
32
|
+
else
|
33
|
+
new_value << v
|
34
|
+
end
|
32
35
|
end
|
33
36
|
value = new_value
|
34
37
|
end
|
@@ -147,7 +150,7 @@ module Solis
|
|
147
150
|
|
148
151
|
sparql = SPARQL::Client.new(self.class.sparql_endpoint)
|
149
152
|
|
150
|
-
original_klass = self.query.filter({language: nil, filters: { id: [id] } }).find_all.map { |m| m }&.first
|
153
|
+
original_klass = self.query.filter({ language: nil, filters: { id: [id] } }).find_all.map { |m| m }&.first
|
151
154
|
raise Solis::Error::NotFoundError if original_klass.nil?
|
152
155
|
updated_klass = original_klass.deep_dup
|
153
156
|
|
@@ -408,11 +411,11 @@ module Solis
|
|
408
411
|
|
409
412
|
data.each do |d|
|
410
413
|
if defined?(d.name) && self.class.graph.shape?(d.name)
|
411
|
-
if self.class.graph.shape_as_model(d.name.to_s).metadata[:attributes].select{|_,v| v[:node_kind].is_a?(RDF::URI)}.size > 0 &&
|
412
|
-
hierarchy.select{|s| s =~ /^#{d.name.to_s}/}.size == 0
|
414
|
+
if self.class.graph.shape_as_model(d.name.to_s).metadata[:attributes].select { |_, v| v[:node_kind].is_a?(RDF::URI) }.size > 0 &&
|
415
|
+
hierarchy.select { |s| s =~ /^#{d.name.to_s}/ }.size == 0
|
413
416
|
internal_resolve = false
|
414
417
|
d = build_ttl_objekt2(graph, d, hierarchy, internal_resolve)
|
415
|
-
elsif self.class.graph.shape_as_model(d.name.to_s) && hierarchy.select{|s| s =~ /^#{d.name.to_s}/}.size == 0
|
418
|
+
elsif self.class.graph.shape_as_model(d.name.to_s) && hierarchy.select { |s| s =~ /^#{d.name.to_s}/ }.size == 0
|
416
419
|
internal_resolve = false
|
417
420
|
d = build_ttl_objekt2(graph, d, hierarchy, internal_resolve)
|
418
421
|
else
|
data/lib/solis/query.rb
CHANGED
@@ -321,7 +321,11 @@ PREFIX #{@model.class.graph_prefix}: <#{@model.class.graph_name}>"
|
|
321
321
|
end
|
322
322
|
else
|
323
323
|
if solution_model.metadata[:attributes][attribute][:maxcount].nil? || solution_model.metadata[:attributes][attribute][:maxcount] > 1
|
324
|
-
data
|
324
|
+
if data.include?(attribute)
|
325
|
+
data[attribute] << object
|
326
|
+
else
|
327
|
+
data[attribute] = [object]
|
328
|
+
end
|
325
329
|
else
|
326
330
|
data[attribute] = object
|
327
331
|
end
|
data/lib/solis/version.rb
CHANGED
data/solis.gemspec
CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.authors = ['Mehmet Celik']
|
7
7
|
spec.email = ['mehmet@celik.be']
|
8
8
|
|
9
|
-
spec.summary = '
|
10
|
-
spec.description = 'The SUN in latin or is it SILOS spelled backwards.
|
9
|
+
spec.summary = 'Turn any SHACL file into an API, ORM, documentation, ...'
|
10
|
+
spec.description = 'The SUN in latin or is it SILOS spelled backwards. Turn any SHACL file or Google sheet into an API, ORM, documentation on top of a data store'
|
11
11
|
spec.homepage = 'https://github.com/mehmetc/solis'
|
12
12
|
spec.license = 'MIT'
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.69.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mehmet Celik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -220,9 +220,8 @@ dependencies:
|
|
220
220
|
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: 5.15.0
|
223
|
-
description: The SUN in latin or is it SILOS spelled backwards.
|
224
|
-
|
225
|
-
store)
|
223
|
+
description: The SUN in latin or is it SILOS spelled backwards. Turn any SHACL file
|
224
|
+
or Google sheet into an API, ORM, documentation on top of a data store
|
226
225
|
email:
|
227
226
|
- mehmet@celik.be
|
228
227
|
executables: []
|
@@ -299,6 +298,5 @@ requirements: []
|
|
299
298
|
rubygems_version: 3.1.6
|
300
299
|
signing_key:
|
301
300
|
specification_version: 4
|
302
|
-
summary:
|
303
|
-
of a data store(RDBMS, Triple store)
|
301
|
+
summary: Turn any SHACL file into an API, ORM, documentation, ...
|
304
302
|
test_files: []
|