rdf-kv 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ace8319f10ea7f736fc8881d6546b19c908284189e5a40f1d0e08659bad5b19
4
- data.tar.gz: f38dd9a9e778c037aad1199d6fc753bf6c037ba00acf0d6ee6e437e81efc0034
3
+ metadata.gz: e5e9ee04b73aea9ca848276b9e7c28efe2e42a7617b4c4be587f26a262d1e487
4
+ data.tar.gz: 90a5036bbb9d090c1859c7fd1069dba484b4533ee3bcbbfb53751e7c792494e5
5
5
  SHA512:
6
- metadata.gz: efc28fc50193b33e5b461e053eff1e2eed46da55e29dd569b0546b0ef606f05b71dc36430eefed20031b35c25d5a2f455edcebda07f7fe327de7d43cf9373a68
7
- data.tar.gz: 053f381f9cf6d907183103f50e47ffd2e5a3f5f85c86b7017dfca0d7733b993cc5994e37feb4890183a8c9f3bbfe7dd5c63829fb9e0b39ccc63b25747c5bc3c4
6
+ metadata.gz: 13160ab47776b4fc531de45f341f0d05e7cb5eb04886b541aaf1f6418bf1aeaf5943bd2b9bfca8da0054af2f2cc964a79401757ac3d5482454fb0dd2f1d3dedd
7
+ data.tar.gz: 67da241b365cb8d278b0d0588fe3dc5df93984e1734c0c865d0b76a04e8fb34bfddf93f7357bca85119f649441da768ef104fd46a22479202e278b9c05fca932
data/Gemfile CHANGED
@@ -2,6 +2,3 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in rdf-kv.gemspec
4
4
  gemspec
5
-
6
- gem "rake", "~> 12.0"
7
- gem "rspec", "~> 3.0"
@@ -1,5 +1,5 @@
1
1
  module RDF
2
2
  class KV
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
data/lib/rdf/kv.rb CHANGED
@@ -52,14 +52,17 @@ class RDF::KV
52
52
  },
53
53
  }.freeze
54
54
 
55
+ def random_uuid_ncname
56
+ UUID::NCName.to_ncname_64 UUIDTools::UUID.random_create.to_s, version: 1
57
+ end
58
+
55
59
  # macros are initially represented as a pair: the macro value and a
56
60
  # flag denoting whether or not the macro itself contains macros and to
57
61
  # try to dereference it.
58
62
  GENERATED = {
59
63
  NEW_UUID: [[-> { UUIDTools::UUID.random_create.to_s }, false]],
60
64
  NEW_UUID_URN: [[-> { UUIDTools::UUID.random_create.to_uri }, false]],
61
- NEW_BNODE: [[-> { "_:#{UUID::NCName.to_ncname_64(
62
- UUIDTools::UUID.random_create.to_s, version: 1) }" }, false]],
65
+ NEW_BNODE: [[-> { "_:#{random_uuid_ncname}" }, false]],
63
66
  }.freeze
64
67
 
65
68
  # just the classics
@@ -389,7 +392,10 @@ class RDF::KV
389
392
  o = contents[:term2] || subject
390
393
  else
391
394
  s, p = (contents[:term2] ? contents.values_at(:term1, :term2) :
392
- [subject, contents[:term1]]).map { |t| resolve_term t }
395
+ [subject, contents[:term1]]).map do |t|
396
+ t = resolve_term t
397
+ callback ? callback.call(t) : t
398
+ end
393
399
  end
394
400
 
395
401
  # the operation depends on whether the `-` modifier is present
@@ -399,9 +405,13 @@ class RDF::KV
399
405
  # string then we're deleting a wildcard, same if we `=` overwrite
400
406
  if !reverse and op == :delete && values.include?('') ||
401
407
  contents[:modifier][?=]
408
+
409
+ # create a random variable name so we don't pass in a nil
410
+ var = RDF::Query::Variable.new random_uuid_ncname
411
+
402
412
  # i can't remember why we don't do this in reverse, probably
403
413
  # because it is too easy to shoot yourself in the foot
404
- patch.delete RDF::Statement(s, p, nil, graph_name: g)
414
+ patch.delete RDF::Statement(s, p, var, graph_name: g)
405
415
 
406
416
  # nuke these since it will be pointless to evaluate further
407
417
  values.clear if op == :delete
data/rdf-kv.gemspec CHANGED
@@ -32,6 +32,8 @@ RDF::Changeset.
32
32
  spec.required_ruby_version = Gem::Requirement.new('>= 2.7')
33
33
  # dev/test dependencies
34
34
  spec.add_development_dependency 'bundler', '~> 2'
35
+ spec.add_development_dependency 'rake', '~> 13'
36
+ spec.add_development_dependency 'rspec', '~> 3'
35
37
  spec.add_development_dependency 'rdf-vocab', '~> 3'
36
38
 
37
39
  # stuff we use
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-kv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Taylor
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-18 00:00:00.000000000 Z
11
+ date: 2024-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '13'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '13'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rdf-vocab
29
57
  requirement: !ruby/object:Gem::Requirement