solis 0.93.0 → 0.94.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 +1 -1
- data/lib/solis/model.rb +2 -2
- data/lib/solis/query/construct.rb +3 -2
- data/lib/solis/query/filter.rb +1 -3
- data/lib/solis/query/run.rb +1 -1
- data/lib/solis/query.rb +2 -4
- data/lib/solis/store/sparql/client.rb +13 -4
- data/lib/solis/version.rb +1 -1
- data/solis.gemspec +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: 36a3cb8c2712803966b8da5b1fda51f0ecbdebc2d52fc11c91d5a6045ad395b8
|
4
|
+
data.tar.gz: 56b2c6bc5e69977dddefa79a36bb6db2a759d8cdc9090fef97b0b751a571e315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6367fc29b396be4a11456d96bfa5b8d89dc260c466021cf2ee2539ab8f80a2e2a253ca7a742b4de857cacc83e22ea642c11f984731a430c1451e9fb04d1068ab
|
7
|
+
data.tar.gz: ba2b061b4f30397c81153e87f01b24d6fd6e40c7f45f1a07158384117af924cdf391c9c4b3e9dc75aadf519c3691b875d87ce952ae1d74e9c5293393c754409a
|
data/lib/solis/graph.rb
CHANGED
@@ -367,7 +367,7 @@ module Solis
|
|
367
367
|
def flush_all(graph_name=nil, force = false)
|
368
368
|
raise Solis::Error::NotFoundError, "Supplied graph_name '#{graph_name}' does not equal graph name defined in config file '#{@graph_name}', set force to true" unless graph_name.eql?(@graph_name) && !force
|
369
369
|
|
370
|
-
@sparql_client =
|
370
|
+
@sparql_client = Solis::Store::Sparql::Client.new(@sparql_endpoint)
|
371
371
|
result = @sparql_client.query("with <#{graph_name}> delete {?s ?p ?o} where{?s ?p ?o}")
|
372
372
|
LOGGER.info(result)
|
373
373
|
true
|
data/lib/solis/model.rb
CHANGED
@@ -109,7 +109,7 @@ module Solis
|
|
109
109
|
|
110
110
|
def destroy
|
111
111
|
raise "I need a SPARQL endpoint" if self.class.sparql_endpoint.nil?
|
112
|
-
sparql =
|
112
|
+
sparql = Solis::Store::Sparql::Client.new(self.class.sparql_endpoint)
|
113
113
|
|
114
114
|
raise Solis::Error::QueryError, "#{self.id} is still referenced, refusing to delete" if is_referenced?(sparql)
|
115
115
|
# sparql.query('delete{}')
|
@@ -309,7 +309,7 @@ values ?s {<#{self.graph_id}>}
|
|
309
309
|
|
310
310
|
def self.make_id_for(model)
|
311
311
|
raise "I need a SPARQL endpoint" if self.sparql_endpoint.nil?
|
312
|
-
sparql =
|
312
|
+
sparql = Solis::Store::Sparql::Client.new(self.sparql_endpoint)
|
313
313
|
id = model.instance_variable_get("@id")
|
314
314
|
if id.nil? || (id.is_a?(String) && id&.empty?)
|
315
315
|
id_retries = 0
|
@@ -6,7 +6,8 @@ module Solis
|
|
6
6
|
def initialize(model)
|
7
7
|
@model = model
|
8
8
|
@sparql_endpoint = @model.class.sparql_endpoint
|
9
|
-
|
9
|
+
#@sparql_client = SPARQL::Client.new(@sparql_endpoint, graph: @model.class.graph_name, read_timeout: 120)
|
10
|
+
@sparql_client = Solis::Store::Sparql::Client.new(@sparql_endpoint, graph: @model.class.graph_name, read_timeout: 120)
|
10
11
|
@construct_cache = File.absolute_path(Solis::Options.instance.get[:cache])
|
11
12
|
@moneta = Moneta.new(:File, dir: "#{@construct_cache}/construct", expires: Solis::Options.instance.get[:cache_expire])
|
12
13
|
end
|
@@ -38,7 +39,7 @@ module Solis
|
|
38
39
|
if @moneta.key?(file_path_hash) && from_cache.eql?('1')
|
39
40
|
sparql_repository = @moneta[file_path_hash]
|
40
41
|
else
|
41
|
-
|
42
|
+
#@sparql_client = SPARQL::Client.new(@sparql_endpoint, read_timeout: 120)
|
42
43
|
result = @sparql_client.query(construct_query)
|
43
44
|
repository=RDF::Repository.new
|
44
45
|
result.each {|s| repository << [s[:s], s[:p], s[:o]]}
|
data/lib/solis/query/filter.rb
CHANGED
@@ -114,13 +114,11 @@ module Solis
|
|
114
114
|
v=normalize_string(v)
|
115
115
|
filter = "?concept <#{metadata[:path]}> ?__search#{i} FILTER(?__search#{i} #{not_operator}#{value[:operator]} \"#{v}\"#{datatype}) .\n"
|
116
116
|
end
|
117
|
-
|
118
|
-
|
119
117
|
end
|
120
118
|
else # if "~" contains
|
121
119
|
if metadata[:datatype_rdf].eql?( 'http://www.w3.org/2001/XMLSchema#anyURI') || !metadata[:node].nil?
|
122
120
|
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 = "?
|
121
|
+
filter = "?concept <#{metadata[:path]}> ?__search#{i} . ?__search#{i} <#{model_graph_name}id> ?__search#{i}_#{i} filter(?__search#{i}_#{i} = \"#{value[:value].first}\")."
|
124
122
|
else
|
125
123
|
filter = "?concept <#{metadata[:path]}> ?__search#{i} FILTER(#{contains.empty? ? '""' : contains}) .\n"
|
126
124
|
end
|
data/lib/solis/query/run.rb
CHANGED
@@ -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], graph_name)
|
18
|
+
c = Solis::Store::Sparql::Client.new(Solis::Options.instance.get[:sparql_endpoint], graph_name: graph_name)
|
19
19
|
r = c.query(query, options)
|
20
20
|
if r.is_a?(SPARQL::Client)
|
21
21
|
g = RDF::Graph.new
|
data/lib/solis/query.rb
CHANGED
@@ -65,11 +65,10 @@ module Solis
|
|
65
65
|
@metadata = @model.class.metadata
|
66
66
|
@sparql_endpoint = @model.class.sparql_endpoint
|
67
67
|
if Solis::Options.instance.get.key?(:graphs) && Solis::Options.instance.get[:graphs].size > 0
|
68
|
-
@sparql_client =
|
68
|
+
@sparql_client = Solis::Store::Sparql::Client.new(@sparql_endpoint)
|
69
69
|
else
|
70
|
-
@sparql_client =
|
70
|
+
@sparql_client = Solis::Store::Sparql::Client.new(@sparql_endpoint, graph: @model.class.graph_name)
|
71
71
|
end
|
72
|
-
|
73
72
|
@filter = {values: ["VALUES ?type {#{target_class}}"], concepts: ['?concept a ?type .'] }
|
74
73
|
@sort = 'ORDER BY ?s'
|
75
74
|
@sort_select = ''
|
@@ -166,7 +165,6 @@ module Solis
|
|
166
165
|
offset = @offset || 0
|
167
166
|
|
168
167
|
sparql_client = model_construct? ? Solis::Query::Construct.new(@model).run : @sparql_client
|
169
|
-
#sparql_client = model_construct? ? SPARQL::Client.new(run_construct) : @sparql_client
|
170
168
|
|
171
169
|
relationship = ''
|
172
170
|
if options.key?(:relationship)
|
@@ -7,13 +7,22 @@ module Solis
|
|
7
7
|
module Store
|
8
8
|
module Sparql
|
9
9
|
class Client
|
10
|
-
def initialize(endpoint,
|
10
|
+
def initialize(endpoint, options = {})
|
11
11
|
@endpoint = endpoint
|
12
|
-
@graph_name = graph_name
|
12
|
+
@graph_name = options[:graph_name] || ''
|
13
|
+
@read_timeout = options[:read_timeout] || 120
|
14
|
+
@logger = options[:logger] || Solis::LOGGER
|
13
15
|
|
14
16
|
@pool = ConnectionPool.new(size:5, timeout: 160) do
|
15
|
-
|
16
|
-
|
17
|
+
Solis::LOGGER.level = Logger::DEBUG if ConfigFile[:debug]
|
18
|
+
|
19
|
+
if @graph_name
|
20
|
+
client = SPARQL::Client.new(@endpoint, graph: @graph_name, read_timeout: @read_timeout, logger: @logger)
|
21
|
+
else
|
22
|
+
client = SPARQL::Client.new(@endpoint, read_timeout: @read_timeout, logger: @logger)
|
23
|
+
end
|
24
|
+
|
25
|
+
client
|
17
26
|
end
|
18
27
|
end
|
19
28
|
|
data/lib/solis/version.rb
CHANGED
data/solis.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_runtime_dependency 'activesupport', '~> 8.0'
|
31
31
|
spec.add_runtime_dependency 'http', '~> 5.2'
|
32
|
-
spec.add_runtime_dependency 'graphiti', '~> 1.
|
32
|
+
spec.add_runtime_dependency 'graphiti', '~> 1.8'
|
33
33
|
spec.add_runtime_dependency 'moneta', '~> 1.6'
|
34
34
|
spec.add_runtime_dependency 'linkeddata', '~> 3.3'
|
35
35
|
spec.add_runtime_dependency 'google_drive', '~> 3.0'
|
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.
|
4
|
+
version: 0.94.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mehmet Celik
|
@@ -43,14 +43,14 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '1.
|
46
|
+
version: '1.8'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '1.
|
53
|
+
version: '1.8'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: moneta
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|