solis 0.68.0 → 0.70.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/solis/graph.rb +10 -19
- data/lib/solis/query.rb +1 -0
- data/lib/solis/version.rb +1 -1
- data/solis.gemspec +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8643fbce6b423cf64728ed433be0208ee53db367afecb93b8e63c131fc7fbcd
|
4
|
+
data.tar.gz: 22679c04f9d67219a0b6f5598029462b7e067b3c9218132b076b58b23d514f88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2a8ec6b308230459b5a2a4ad4271ebc31305c776deedaf7bb631c6051df1e6b84c2a6cf5bef4d705fe175c0a300ab3a7fe07f0586a232f3c8fe70035ecaf542
|
7
|
+
data.tar.gz: 50c09efc0aa5ae63cdd45c5e9a9923461a8231dda52d6fe3600548c770eec871e3df684bbe36d3817081892fe7af3391b190257cdd1d19d7d88c4a631e0714da
|
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
|
-
|
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
282
|
end
|
285
283
|
|
286
|
-
|
287
|
-
remote_resources.join(',') if remote_resources #belongs_to
|
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.join(',')
|
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/query.rb
CHANGED
@@ -119,6 +119,7 @@ module Solis
|
|
119
119
|
core_query = core_query(relationship)
|
120
120
|
count_query = core_query.gsub(/SELECT .* WHERE/, 'SELECT (COUNT(distinct ?concept) as ?count) WHERE')
|
121
121
|
|
122
|
+
count_query = count_query.split('a ?type')[0]+'a ?type }'
|
122
123
|
result = sparql_client.query(count_query)
|
123
124
|
solution = result.first
|
124
125
|
solution.nil? ? 0 : solution[:count].object || 0
|
data/lib/solis/version.rb
CHANGED
data/solis.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.email = ['mehmet@celik.be']
|
8
8
|
|
9
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.
|
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.70.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:
|
11
|
+
date: 2023-01-05 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: []
|