solis 0.120.0 → 0.122.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/model.rb +10 -14
- data/lib/solis/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 02e35b7cfb4fd0efe75a619eb1261dabde1d6ea130ba4508fb4bac17a644207b
|
|
4
|
+
data.tar.gz: f04e921636d9aed215883796f83904cc24a618d3c8f7697ef2f691ca3e7768fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4e22f052c08a4e7cebcb2c78a114b752d2fe00ee898caf1e23d9331aef19cf55aa4616501bcfe0684c048e8f232e2d7304973368a5b6006321fb6ccd41ab9e55
|
|
7
|
+
data.tar.gz: d27220cf49606664cc05aacbad1d8f67a1282c0badb5bae1017535888ebf952ca87da6f2de48309f50bd058ffa97b4bd6342a5369193892fc8c25eab70ca9b0e
|
data/lib/solis/model.rb
CHANGED
|
@@ -250,7 +250,12 @@ values ?s {<#{self.graph_id}>}
|
|
|
250
250
|
id = attributes.delete('id')
|
|
251
251
|
sparql = sparql_client || SPARQL::Client.new(self.class.sparql_endpoint)
|
|
252
252
|
|
|
253
|
-
original_klass = prefetched_original
|
|
253
|
+
original_klass = prefetched_original
|
|
254
|
+
# A prefetched original may be an id-only stub (embedded relations are loaded that
|
|
255
|
+
# way by Query#graph_to_object). It cannot seed updated_klass — omitted mandatory
|
|
256
|
+
# attributes would be lost — so re-load the full entity from the store.
|
|
257
|
+
original_klass = nil if original_klass && shallow_stub?(original_klass)
|
|
258
|
+
original_klass ||= self.query.filter({ language: self.class.language, filters: { id: [id] } }).find_all.map { |m| m }&.first
|
|
254
259
|
raise Solis::Error::NotFoundError if original_klass.nil?
|
|
255
260
|
updated_klass = original_klass.deep_dup
|
|
256
261
|
|
|
@@ -806,7 +811,10 @@ values ?s {<#{self.graph_id}>}
|
|
|
806
811
|
if original_klass.nil?
|
|
807
812
|
original_klass = klass
|
|
808
813
|
else
|
|
809
|
-
|
|
814
|
+
# A store-fetched original carries id-only stub children, so its subgraph is
|
|
815
|
+
# not re-resolved. In the create path (skip_store_fetch) known_entities is
|
|
816
|
+
# pre-populated with full in-memory entities whose children must still be built.
|
|
817
|
+
resolve_all = false unless skip_store_fetch
|
|
810
818
|
klass.instance_variables.map { |m| m.to_s.gsub(/^@/, '') }
|
|
811
819
|
.select { |s| !["model_name", "model_plural_name"].include?(s) }.each do |attribute|
|
|
812
820
|
data = klass.instance_variable_get("@#{attribute}")
|
|
@@ -830,18 +838,6 @@ values ?s {<#{self.graph_id}>}
|
|
|
830
838
|
end
|
|
831
839
|
|
|
832
840
|
def make_graph(graph, hierarchy, id, klass, klass_metadata, resolve_all, known_entities = {}, skip_store_fetch: false)
|
|
833
|
-
# klass may arrive as an id-only stub (embedded relation from Query#graph_to_object,
|
|
834
|
-
# or passed via prefetched_original). Resolve it to the full stored entity once so
|
|
835
|
-
# every attribute is emitted into the graph.
|
|
836
|
-
if !skip_store_fetch && shallow_stub?(klass)
|
|
837
|
-
uuid = id.value.split('/').last
|
|
838
|
-
fetched = klass.query.filter({ filters: { id: [uuid] } }).find_all { |f| f.id == uuid }.first
|
|
839
|
-
unless fetched.nil?
|
|
840
|
-
klass = fetched
|
|
841
|
-
known_entities[uuid] = fetched
|
|
842
|
-
end
|
|
843
|
-
end
|
|
844
|
-
|
|
845
841
|
klass_metadata[:attributes].each do |attribute, metadata|
|
|
846
842
|
data = klass.instance_variable_get("@#{attribute}")
|
|
847
843
|
|
data/lib/solis/version.rb
CHANGED