solis 0.86.0 → 0.88.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 +17 -0
- data/lib/solis/model.rb +9 -1
- data/lib/solis/query.rb +1 -1
- data/lib/solis/shape/reader/sheet.rb +7 -7
- data/lib/solis/store/sparql/client.rb +1 -1
- data/lib/solis/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ea2b39d46de37ed36dd0132d993c82abac68da1fddc43c7ccae04ada175dbd1
|
4
|
+
data.tar.gz: 482e9fd7e9da74e9324f9836e2d820dea97918458d48c598e3267145d78337ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 654347d6d6a72464e6b513be9cbf31412f5fde09da73cf013bda2a46e7a205839af11550fe7b0b2c4b77c55b370c08b6e1f3e651c5168a894b46544060e7be45
|
7
|
+
data.tar.gz: 38631633199f44e18b21cd07833f0a3b79e851276bf41b2fad49639eb23f1350d69fa811cb55cd2535fa4a4f756867994bb3630c59fae5da4cb549c54889d55b
|
data/lib/solis/graph.rb
CHANGED
@@ -292,6 +292,23 @@ module Solis
|
|
292
292
|
"#{resource.class.graph_name.gsub(/\/$/,'')}/#{belongs_to_resource_name.tableize}?filter[id]=#{resource_ids.join(',')}" unless remote_resources.nil? || resource_ids.empty?
|
293
293
|
end
|
294
294
|
end
|
295
|
+
elsif (value[:mincount] && value[:mincount] == 1) || (value[:maxcount] && value[:maxcount] == 1)
|
296
|
+
has_one_resource_name = value[:datatype].nil? ? value[:class].gsub(self.model.graph_name, '') : value[:datatype].to_s.classify
|
297
|
+
LOGGER.info "\t\t\t#{resource_name}(#{resource_name.gsub('Resource','').tableize.singularize}) has_one #{has_one_resource_name}(#{key})"
|
298
|
+
resource.has_one(key.to_sym, foreign_key: :id, primary_key: :id, resource: graph.shape_as_resource("#{has_one_resource_name}", stack_level << has_one_resource_name)) do
|
299
|
+
link do |resource|
|
300
|
+
remote_resources = resource.instance_variable_get("@#{key}")
|
301
|
+
if remote_resources
|
302
|
+
remote_resources = [remote_resources] unless remote_resources.is_a?(Array)
|
303
|
+
resource_ids = remote_resources.map do |remote_resource|
|
304
|
+
remote_resource.id =~ /^http/ ? remote_resource.id.split('/').last : remote_resource.id
|
305
|
+
end
|
306
|
+
|
307
|
+
end
|
308
|
+
|
309
|
+
"#{resource.class.graph_name.gsub(/\/$/,'')}/#{has_one_resource_name.tableize}?filter[id]=#{resource_ids.join(',')}" unless remote_resources.nil? || resource_ids.empty?
|
310
|
+
end
|
311
|
+
end
|
295
312
|
else
|
296
313
|
has_many_resource_name = value[:datatype].nil? ? value[:class].gsub(self.model.graph_name, '') : value[:datatype].to_s.classify
|
297
314
|
LOGGER.info "\t\t\t#{resource_name}(#{resource_name.gsub('Resource','').tableize.singularize}) has_many #{has_many_resource_name}(#{key})"
|
data/lib/solis/model.rb
CHANGED
@@ -225,6 +225,9 @@ values ?s {<#{self.graph_id}>}
|
|
225
225
|
end
|
226
226
|
end
|
227
227
|
|
228
|
+
maxcount = original_klass.class.metadata[:attributes][key][:maxcount]
|
229
|
+
value = value.first if maxcount && maxcount == 1 && value.is_a?(Array)
|
230
|
+
|
228
231
|
updated_klass.instance_variable_set("@#{key}", value)
|
229
232
|
end
|
230
233
|
|
@@ -483,7 +486,12 @@ values ?s {<#{self.graph_id}>}
|
|
483
486
|
end
|
484
487
|
end
|
485
488
|
|
486
|
-
|
489
|
+
begin
|
490
|
+
make_graph(graph, hierarchy, id, original_klass, klass_metadata, resolve_all)
|
491
|
+
rescue => e
|
492
|
+
Solis::LOGGER.error(e.message)
|
493
|
+
raise e
|
494
|
+
end
|
487
495
|
|
488
496
|
hierarchy.pop
|
489
497
|
id
|
data/lib/solis/query.rb
CHANGED
@@ -320,7 +320,7 @@ PREFIX #{@model.class.graph_prefix}: <#{@model.class.graph_name}>"
|
|
320
320
|
|
321
321
|
if data.key?(attribute) # attribute exists
|
322
322
|
raise "Cardinality error, max = #{solution_model.metadata[:attributes][attribute][:maxcount]}" if solution_model.metadata[:attributes][attribute][:maxcount] == 0
|
323
|
-
if solution_model.metadata[:attributes][attribute][:maxcount] == 1 && data.key?(attribute)
|
323
|
+
if solution_model.metadata[:attributes][attribute][:maxcount] == 1 && data.key?(attribute) && data[attribute].is_a?(Array) && data[attribute].length > 1
|
324
324
|
raise "Cardinality error, max = #{solution_model.metadata[:attributes][attribute][:maxcount]}"
|
325
325
|
elsif solution_model.metadata[:attributes][attribute][:maxcount] == 1
|
326
326
|
data[attribute] = object
|
@@ -481,16 +481,16 @@ hide empty members
|
|
481
481
|
"required" => []
|
482
482
|
}
|
483
483
|
|
484
|
-
graph.query([nil, RDF.type, SHACL.NodeShape]) do |shape|
|
484
|
+
graph.query([nil, RDF.type, RDF::Vocab::SHACL.NodeShape]) do |shape|
|
485
485
|
shape_subject = shape.subject
|
486
486
|
|
487
|
-
graph.query([shape_subject, SHACL.property, nil]) do |prop_stmt|
|
487
|
+
graph.query([shape_subject, RDF::Vocab::SHACL.property, nil]) do |prop_stmt|
|
488
488
|
prop_subject = prop_stmt.object
|
489
|
-
prop_name = graph.query([prop_subject, SHACL.path, nil]).first&.object.to_s
|
490
|
-
datatype = graph.query([prop_subject, SHACL.datatype, nil]).first&.object
|
491
|
-
min_count = graph.query([prop_subject, SHACL.minCount, nil]).first&.object&.to_i
|
492
|
-
max_count = graph.query([prop_subject, SHACL.maxCount, nil]).first&.object&.to_i
|
493
|
-
pattern = graph.query([prop_subject, SHACL.pattern, nil]).first&.object&.to_s
|
489
|
+
prop_name = graph.query([prop_subject, RDF::Vocab::SHACL.path, nil]).first&.object.to_s
|
490
|
+
datatype = graph.query([prop_subject, RDF::Vocab::SHACL.datatype, nil]).first&.object
|
491
|
+
min_count = graph.query([prop_subject, RDF::Vocab::SHACL.minCount, nil]).first&.object&.to_i
|
492
|
+
max_count = graph.query([prop_subject, RDF::Vocab::SHACL.maxCount, nil]).first&.object&.to_i
|
493
|
+
pattern = graph.query([prop_subject, RDF::Vocab::SHACL.pattern, nil]).first&.object&.to_s
|
494
494
|
|
495
495
|
json_schema["properties"][prop_name] = {}
|
496
496
|
json_schema["properties"][prop_name]["type"] = datatype.to_s.split("#").last.downcase if datatype
|
@@ -11,7 +11,7 @@ module Solis
|
|
11
11
|
@endpoint = endpoint
|
12
12
|
@graph_name = graph_name
|
13
13
|
|
14
|
-
|
14
|
+
@pool = ConnectionPool.new(size:5, timeout: 160) do
|
15
15
|
SPARQL::Client.new(@endpoint, graph: @graph_name)
|
16
16
|
#SPARQL::Client.new(@endpoint)
|
17
17
|
end
|
data/lib/solis/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.88.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mehmet Celik
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|
@@ -335,7 +335,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
335
335
|
- !ruby/object:Gem::Version
|
336
336
|
version: '0'
|
337
337
|
requirements: []
|
338
|
-
rubygems_version: 3.6.
|
338
|
+
rubygems_version: 3.6.9
|
339
339
|
specification_version: 4
|
340
340
|
summary: Turn any SHACL file into an API, ORM, documentation, ...
|
341
341
|
test_files: []
|