stardog-rb 0.0.3 → 0.0.4
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.
- data/lib/stardog.rb +53 -0
- metadata +1 -4
data/lib/stardog.rb
CHANGED
@@ -328,6 +328,59 @@ module Stardog
|
|
328
328
|
(res.body == "true" ? true : false)
|
329
329
|
end
|
330
330
|
|
331
|
+
########################
|
332
|
+
# Integrity Constraints
|
333
|
+
########################
|
334
|
+
|
335
|
+
def list_icvs(database, options = {})
|
336
|
+
accept = options[:accept] || "application/x-turtle"
|
337
|
+
http_request("GET", "#{database}/icv", accept, {}, nil, false)
|
338
|
+
end
|
339
|
+
|
340
|
+
def add_icv(database, body, content_type = "text/plain")
|
341
|
+
|
342
|
+
if(File.exists?(body))
|
343
|
+
body = File.open(body,"r").read
|
344
|
+
elsif(body =~ /^https?:\/\/[\S]+$/)
|
345
|
+
result = http_request("GET", body, (content_type == "text/plain" ? "*/*" : content_type), {}, nil, false)
|
346
|
+
raise Exception.new("Error adding data from remote URL #{body} => #{result.status} : #{result}") if result.status != 200
|
347
|
+
body = result.body
|
348
|
+
end
|
349
|
+
|
350
|
+
is_json = (content_type.index("json") ? true : false)
|
351
|
+
http_request("POST", "#{database}/icv/add", "*/*", {}, body, is_json, content_type, nil)
|
352
|
+
end
|
353
|
+
|
354
|
+
def remove_icv(database, body, content_type = "text/plain")
|
355
|
+
if(File.exists?(body))
|
356
|
+
body = File.open(body,"r").read
|
357
|
+
elsif(body =~ /^https?:\/\/[\S]+$/)
|
358
|
+
result = http_request("GET", body, (content_type == "text/plain" ? "*/*" : content_type), {}, nil, false)
|
359
|
+
raise Exception.new("Error adding data from remote URL #{body} => #{result.status} : #{result}") if result.status != 200
|
360
|
+
body = result.body
|
361
|
+
end
|
362
|
+
|
363
|
+
is_json = (content_type.index("json") ? true : false)
|
364
|
+
http_request("POST", "#{database}/icv/remove", "*/*", {}, body, is_json, content_type, nil)
|
365
|
+
end
|
366
|
+
|
367
|
+
def clear_icvs(database)
|
368
|
+
http_request("POST", "#{database}/icv/clear", "*/*", {}, "", false, "text/plain", nil)
|
369
|
+
end
|
370
|
+
|
371
|
+
def convert_icv(database, body, content_type = "text/plain")
|
372
|
+
if(File.exists?(body))
|
373
|
+
body = File.open(body,"r").read
|
374
|
+
elsif(body =~ /^https?:\/\/[\S]+$/)
|
375
|
+
result = http_request("GET", body, (content_type == "text/plain" ? "*/*" : content_type), {}, nil, false)
|
376
|
+
raise Exception.new("Error adding data from remote URL #{body} => #{result.status} : #{result}") if result.status != 200
|
377
|
+
body = result.body
|
378
|
+
end
|
379
|
+
|
380
|
+
is_json = (content_type.index("json") ? true : false)
|
381
|
+
http_request("POST", "#{database}/icv/convert", "*/*", {}, body, is_json, content_type, nil)
|
382
|
+
end
|
383
|
+
|
331
384
|
#######################
|
332
385
|
# Database Operations
|
333
386
|
#######################
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stardog-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -63,9 +63,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
63
|
- - ! '>='
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: '0'
|
66
|
-
segments:
|
67
|
-
- 0
|
68
|
-
hash: -4293871523762893836
|
69
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
67
|
none: false
|
71
68
|
requirements:
|