solis 0.90.0 → 0.92.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: db4b32f6a9c7af88cdb8906b2e79ede7216ea1178b1eadfb26ef4cdebfe074a1
4
- data.tar.gz: 7e644c2f97bac0967c466a5bf97b1aa45ce89fee8f6c34185cf08827a6fce2e3
3
+ metadata.gz: e85831535e206873d8f7b40cd0a9cb5de13c31e9e726b57331ce81e641acd54b
4
+ data.tar.gz: 6a590a9130caa22dbf386e7431c3320c09920e6c8995c70071709ef6b68b2a1e
5
5
  SHA512:
6
- metadata.gz: bfff3bcc0a4805c782c1b5f088237c4fba9e2bc90181a9701cf369e6652c9ec07fcf52b00186a42288f0d0e7f8df8711ee9cf0349a3231476f8abc48d98de7d0
7
- data.tar.gz: a027a7c9b640b13e544e1b9e5ec5b61bd5fd15f4b9d96d5407751c16aef3a8fde368d1bee013e667d98540d6b970b525ba59d862d057547679d9df9336ef352b
6
+ metadata.gz: 3eb2c16098538ce61eea28aec3f7938fe679c5571976b89004e180679ad7bbdc676013dd6d71cc87e438faf6f2055a806f878437fc0de5cf5c0a9824b51b0d38
7
+ data.tar.gz: 5ad01cb9131bfbfefc5c0e21e05bf3b0c804cc1272b5b53933812d457f6705c65a5eec22185b0928cce79d864915f3e388ac84bf965583f28f6f613f14301789
data/lib/solis/graph.rb CHANGED
@@ -20,8 +20,8 @@ module Solis
20
20
 
21
21
  @global_resource_stack = []
22
22
  @graph = graph
23
- @graph_name = cloned_options.delete(:graph_name) || '/'
24
- @graph_prefix = cloned_options.delete(:graph_prefix) || 'pf0'
23
+ @graph_name = cloned_options.key?(:graph_name) ? cloned_options.delete(:graph_name) : cloned_options.key?(:graphs) ? cloned_options[:graphs].select{|s| s['type'].eql?(:main)}&.first['name'] || '/' : '/'
24
+ @graph_prefix = cloned_options.key?(:graph_prefix) ? cloned_options.delete(:graph_prefix) : cloned_options.key?(:graphs) ? cloned_options[:graphs].select{|s| s['type'].eql?(:main)}&.first['prefix'] || 'pf0' : 'pf0'
25
25
  @sparql_endpoint = cloned_options.delete(:sparql_endpoint) || nil
26
26
 
27
27
  if cloned_options&.key?(:hooks) && cloned_options[:hooks].is_a?(Hash)
@@ -117,8 +117,13 @@ module Solis
117
117
 
118
118
 
119
119
  end
120
- else
121
- filter = "?concept <#{metadata[:path]}> ?__search#{i} FILTER(#{contains.empty? ? '""' : contains}) .\n"
120
+ else # if "~" contains
121
+ if metadata[:datatype_rdf].eql?( 'http://www.w3.org/2001/XMLSchema#anyURI') || !metadata[:node].nil?
122
+ model_graph_name = Solis::Options.instance.get.key?(:graphs) ? Solis::Options.instance.get[:graphs].select{|s| s['type'].eql?(:data)}&.first['name'] : @model.class.graph_name
123
+ filter = "?CONCEPT <#{metadata[:path]}> ?__search#{i} . ?__search#{i} <#{model_graph_name}id> ?__search#{i}_#{i} FILTER(?__search#{i}_#{i} = \"#{value[:value].first}\")."
124
+ else
125
+ filter = "?concept <#{metadata[:path]}> ?__search#{i} FILTER(#{contains.empty? ? '""' : contains}) .\n"
126
+ end
122
127
  end
123
128
  end
124
129
  end
@@ -7,7 +7,7 @@ class Solis::Query::Runner
7
7
  context = JSON.parse %(
8
8
  {
9
9
  "@context": {
10
- "@vocab": "#{Solis::Options.instance.get[:graph_name]}",
10
+ "@vocab": "#{graph_name}",
11
11
  "id": "@id"
12
12
  },
13
13
  "@type": "#{entity}",
@@ -15,7 +15,7 @@ class Solis::Query::Runner
15
15
  }
16
16
  )
17
17
 
18
- c = Solis::Store::Sparql::Client.new(Solis::Options.instance.get[:sparql_endpoint], Solis::Options.instance.get[:graph_name])
18
+ c = Solis::Store::Sparql::Client.new(Solis::Options.instance.get[:sparql_endpoint], graph_name)
19
19
  r = c.query(query, options)
20
20
  if r.is_a?(SPARQL::Client)
21
21
  g = RDF::Graph.new
@@ -107,4 +107,8 @@ class Solis::Query::Runner
107
107
  Solis::LOGGER.error(e.message)
108
108
  data
109
109
  end
110
+
111
+ def self.graph_name
112
+ Solis::Options.instance.get.key?(:graphs) ? Solis::Options.instance.get[:graphs].select{|s| s['type'].eql?(:main)}&.first['name'] : ''
113
+ end
110
114
  end
data/lib/solis/query.rb CHANGED
@@ -36,7 +36,7 @@ module Solis
36
36
  ids = [ids] unless ids.is_a?(Array)
37
37
  ids = ids.map do |m|
38
38
  if URI(m).class.eql?(URI::Generic)
39
- "<#{Solis::Options.instance.get[:graph_name]}#{entity.tableize}/#{m}>"
39
+ "<#{@model.class.graph_name}#{entity.tableize}/#{m}>"
40
40
  else
41
41
  "<#{m}>"
42
42
  end
@@ -60,7 +60,12 @@ module Solis
60
60
  @shapes = @model.class.shapes
61
61
  @metadata = @model.class.metadata
62
62
  @sparql_endpoint = @model.class.sparql_endpoint
63
- @sparql_client = SPARQL::Client.new(@sparql_endpoint, graph: @model.class.graph_name)
63
+ if Solis::Options.instance.get.key?(:graphs) && Solis::Options.instance.get[:graphs].size > 0
64
+ @sparql_client = SPARQL::Client.new(@sparql_endpoint)
65
+ else
66
+ @sparql_client = SPARQL::Client.new(@sparql_endpoint, graph: @model.class.graph_name)
67
+ end
68
+
64
69
  @filter = {values: ["VALUES ?type {#{target_class}}"], concepts: ['?concept a ?type .'] }
65
70
  @sort = 'ORDER BY ?s'
66
71
  @sort_select = ''
@@ -360,5 +365,6 @@ PREFIX #{@model.class.graph_prefix}: <#{@model.class.graph_name}>"
360
365
  # result << solution_model.new(data) unless data.empty?
361
366
  result
362
367
  end
368
+
363
369
  end
364
370
  end
data/lib/solis/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Solis
2
- VERSION = "0.90.0"
2
+ VERSION = "0.92.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.90.0
4
+ version: 0.92.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehmet Celik
@@ -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.9
338
+ rubygems_version: 3.7.1
339
339
  specification_version: 4
340
340
  summary: Turn any SHACL file into an API, ORM, documentation, ...
341
341
  test_files: []