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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 663d9c6ac4bec283d623346be498856494152c103c1f347a48a79cac7bc19662
4
- data.tar.gz: 65e2d8370f3e4ff4638e00293b522b6c4d927b91fcb95259dcb3e21e11c5ae39
3
+ metadata.gz: 02e35b7cfb4fd0efe75a619eb1261dabde1d6ea130ba4508fb4bac17a644207b
4
+ data.tar.gz: f04e921636d9aed215883796f83904cc24a618d3c8f7697ef2f691ca3e7768fa
5
5
  SHA512:
6
- metadata.gz: b28a6189d553f6e444ebb33760ae7b29abe6ffc084995ba13c69b482a9fc9d562294f293671955e94111e915472aef7a419a2d4b5a9eb1b623dc15f149f9c9df
7
- data.tar.gz: 24c7b79c0f720b349ecf85c1832ee4e43f3a63d59ba208ce588faa6bf09ed68c09907f57a118832a8a9441e78fb318d7fd50d329d93956ec47b4be4862380a2c
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 || self.query.filter({ language: self.class.language, filters: { id: [id] } }).find_all.map { |m| m }&.first
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
- resolve_all = false
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
@@ -1,3 +1,3 @@
1
1
  module Solis
2
- VERSION = "0.120.0"
2
+ VERSION = "0.122.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.120.0
4
+ version: 0.122.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehmet Celik