ld-patch 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -20
- data/VERSION +1 -1
- data/lib/ld/patch/algebra/cut.rb +1 -1
- data/lib/ld/patch/algebra/patch.rb +9 -2
- data/lib/ld/patch/algebra/path.rb +2 -2
- data/lib/ld/patch/algebra/prefix.rb +1 -1
- data/lib/ld/patch/algebra/reverse.rb +1 -1
- data/lib/ld/patch/algebra/update_list.rb +1 -1
- data/lib/ld/patch/format.rb +1 -1
- metadata +30 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46e9bfef3644f0df10aa5ce6982b92937a26d06690d5b4fd2501e7a5621c4a08
|
4
|
+
data.tar.gz: 9be7cca783ee609fed0036c7d01312c3db4c909ef3efd4e9582620eab9c78c7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4655de47eef299a1dd9cebcddd7e021c0068aa1021be7297b9280de8bc0958e6295069b05db0bc3b89ae6be1cf4f411032e658248d46c162e3e1f335319da371
|
7
|
+
data.tar.gz: 239cd62208a2ed21165b09eb78b57d4f3a2427bce5f1b883cda545367d36a08b83b93321ba65dd44847b1678cecb40b63cd021095b1521e220f4b3928507e647
|
data/README.md
CHANGED
@@ -2,9 +2,10 @@
|
|
2
2
|
|
3
3
|
This is a [Ruby][] implementation of [LD Patch][] for [RDF.rb][].
|
4
4
|
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/ld-patch.png)](
|
6
|
-
[![Build Status](https://
|
7
|
-
[![Coverage Status](https://coveralls.io/repos/ruby-rdf/ld-patch/badge.svg)](https://coveralls.io/
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/ld-patch.png)](https://badge.fury.io/rb/ld-patch)
|
6
|
+
[![Build Status](https://github.com/ruby-rdf/ld-patch/workflows/CI/badge.svg?branch=develop)](https://github.com/ruby-rdf/ld-patch/actions?query=workflow%3ACI)
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/ruby-rdf/ld-patch/badge.svg?branch=develop)](https://coveralls.io/github/ruby-rdf/ld-patch?branch=develop)
|
8
|
+
[![Gitter chat](https://badges.gitter.im/ruby-rdf/rdf.png)](https://gitter.im/ruby-rdf/rdf)
|
8
9
|
|
9
10
|
## Description
|
10
11
|
|
@@ -24,7 +25,7 @@ This gem implements the [LD Patch][] specification with a couple of changes and/
|
|
24
25
|
* 100% free and unencumbered [public domain](http://unlicense.org/) software.
|
25
26
|
* Complete [Linked Data Patch Format][LD Patch] parsing and execution
|
26
27
|
* Implementation Report: {file:etc/earl.html EARL}
|
27
|
-
* Compatible with Ruby >= 2.
|
28
|
+
* Compatible with Ruby >= 2.6.
|
28
29
|
|
29
30
|
## Documentation
|
30
31
|
Full documentation available on [Rubydoc.info][LD-Patch doc]
|
@@ -50,7 +51,7 @@ Full documentation available on [Rubydoc.info][LD-Patch doc]
|
|
50
51
|
Bind ?ruby <> / doap:programming-language .
|
51
52
|
Cut ?ruby .
|
52
53
|
)
|
53
|
-
operator = LD::Patch.parse(patch, base_uri: "
|
54
|
+
operator = LD::Patch.parse(patch, base_uri: "https://rubygems.org/gems/ld-patch")
|
54
55
|
operator.execute(queryable) # alternatively queryable.query(operator)
|
55
56
|
|
56
57
|
## Command Line
|
@@ -73,18 +74,18 @@ The parser takes branch and follow tables generated from the [LD Patch Grammar](
|
|
73
74
|
|
74
75
|
## Dependencies
|
75
76
|
|
76
|
-
* [Ruby](http://ruby-lang.org/) (>= 2.
|
77
|
-
* [RDF.rb](
|
78
|
-
* [EBNF][] (~> 1.
|
79
|
-
* [SPARQL][] (~> 3.
|
80
|
-
* [SXP][] (~> 1.
|
81
|
-
* [RDF::XSD][] (~> 3.
|
77
|
+
* [Ruby](http://ruby-lang.org/) (>= 2.6)
|
78
|
+
* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.2)
|
79
|
+
* [EBNF][] (~> 1.3)
|
80
|
+
* [SPARQL][] (~> 3.2)
|
81
|
+
* [SXP][] (~> 1.2)
|
82
|
+
* [RDF::XSD][] (~> 3.2)
|
82
83
|
|
83
84
|
## Mailing List
|
84
85
|
* <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
|
85
86
|
|
86
87
|
## Author
|
87
|
-
* [Gregg Kellogg](
|
88
|
+
* [Gregg Kellogg](https://github.com/gkellogg) - <http://greggkellogg.net/>
|
88
89
|
|
89
90
|
## Contributing
|
90
91
|
This repository uses [Git Flow](https://github.com/nvie/gitflow) to mange development and release activity. All submissions _must_ be on a feature branch based on the _develop_ branch to ease staging and integration.
|
@@ -94,7 +95,11 @@ This repository uses [Git Flow](https://github.com/nvie/gitflow) to mange develo
|
|
94
95
|
* Do document every method you add using [YARD][] annotations. Read the [tutorial][YARD-GS] or just look at the existing code for examples.
|
95
96
|
* Don't touch the `.gemspec`, `VERSION` or `AUTHORS` files. If you need to change them, do so on your private branch only.
|
96
97
|
* Do feel free to add yourself to the `CREDITS` file and the corresponding list in the the `README`. Alphabetical order applies.
|
97
|
-
* Do note that in order for us to merge any non-trivial changes (as a rule
|
98
|
+
* Do note that in order for us to merge any non-trivial changes (as a rule
|
99
|
+
of thumb, additions larger than about 15 lines of code), we need an
|
100
|
+
explicit [public domain dedication][PDD] on record from you,
|
101
|
+
which you will be asked to agree to on the first commit to a repo within the organization.
|
102
|
+
Note that the agreement applies to all repos in the [Ruby RDF](https://github.com/ruby-rdf/) organization.
|
98
103
|
|
99
104
|
## License
|
100
105
|
This is free and unencumbered public domain software. For more information,
|
@@ -106,13 +111,13 @@ A copy of the [LD Patch EBNF](file:etc/ld-patch.ebnf) and derived parser files a
|
|
106
111
|
[RDF]: http://www.w3.org/RDF/
|
107
112
|
[YARD]: http://yardoc.org/
|
108
113
|
[YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
|
109
|
-
[PDD]:
|
110
|
-
[RDF.rb]:
|
111
|
-
[RDF::XSD]:
|
112
|
-
[EBNF]:
|
113
|
-
[SPARQL]:
|
114
|
-
[Linked Data]:
|
114
|
+
[PDD]: https://unlicense.org/#unlicensing-contributions
|
115
|
+
[RDF.rb]: https://rubygems.org/gems/rdf
|
116
|
+
[RDF::XSD]: https://rubygems.org/gems/rdf-xsd
|
117
|
+
[EBNF]: https://rubygems.org/gems/ebnf
|
118
|
+
[SPARQL]: https://rubygems.org/gems/sparql
|
119
|
+
[Linked Data]: https://rubygems.org/gems/linkeddata
|
115
120
|
[SSE]: http://openjena.org/wiki/SSE
|
116
|
-
[SXP]:
|
121
|
+
[SXP]: https://rubygems.org/gems/sxp-ruby
|
117
122
|
[LD Patch]: http://www.w3.org/TR/ldpatch/
|
118
123
|
[LD-Patch doc]: http://rubydoc.info/github/ruby-rdf/ld-patch
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.2.0
|
data/lib/ld/patch/algebra/cut.rb
CHANGED
@@ -23,10 +23,17 @@ module LD::Patch::Algebra
|
|
23
23
|
def execute(graph, options = {})
|
24
24
|
debug(options) {"Delete"}
|
25
25
|
|
26
|
-
graph.
|
26
|
+
if graph.respond_to?(:transaction)
|
27
|
+
graph.transaction(mutable: true) do |tx|
|
28
|
+
operands.inject(RDF::Query::Solutions.new([RDF::Query::Solution.new])) do |bindings, op|
|
29
|
+
# Invoke operand using bindings from prvious operation
|
30
|
+
op.execute(tx, options.merge(bindings: bindings))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
else
|
27
34
|
operands.inject(RDF::Query::Solutions.new([RDF::Query::Solution.new])) do |bindings, op|
|
28
35
|
# Invoke operand using bindings from prvious operation
|
29
|
-
op.execute(
|
36
|
+
op.execute(graph, options.merge(bindings: bindings))
|
30
37
|
end
|
31
38
|
end
|
32
39
|
end
|
@@ -52,11 +52,11 @@ module LD::Patch::Algebra
|
|
52
52
|
case op
|
53
53
|
when RDF::URI
|
54
54
|
terms.map do |subject|
|
55
|
-
queryable.query(subject: subject, predicate: op).map(&:object)
|
55
|
+
queryable.query({subject: subject, predicate: op}).map(&:object)
|
56
56
|
end.flatten
|
57
57
|
when SPARQL::Algebra::Query
|
58
58
|
# Get path solutions for each term for op
|
59
|
-
op.execute(queryable, options.merge(terms: terms)).map do |soln|
|
59
|
+
op.execute(queryable, **options.merge(terms: terms)).map do |soln|
|
60
60
|
soln.path
|
61
61
|
end.flatten
|
62
62
|
else
|
@@ -31,7 +31,7 @@ module LD::Patch::Algebra
|
|
31
31
|
# @see http://www.w3.org/TR/rdf-sparql-query/#sparqlAlgebra
|
32
32
|
def execute(queryable, options = {}, &block)
|
33
33
|
debug(options) {"Prefix"}
|
34
|
-
@solutions = queryable.query(operands.last, options.merge(depth: options[:depth].to_i + 1), &block)
|
34
|
+
@solutions = queryable.query(operands.last, **options.merge(depth: options[:depth].to_i + 1), &block)
|
35
35
|
end
|
36
36
|
|
37
37
|
##
|
@@ -30,7 +30,7 @@ module LD::Patch::Algebra
|
|
30
30
|
terms = Array(options.fetch(:terms))
|
31
31
|
|
32
32
|
results = terms.map do |object|
|
33
|
-
queryable.query(object: object, predicate: op).map(&:subject)
|
33
|
+
queryable.query({object: object, predicate: op}).map(&:subject)
|
34
34
|
end.flatten
|
35
35
|
|
36
36
|
RDF::Query::Solutions.new(results.map {|t| RDF::Query::Solution.new(path: t)})
|
@@ -35,7 +35,7 @@ module LD::Patch::Algebra
|
|
35
35
|
var_or_iri = solution[var_or_iri]
|
36
36
|
end
|
37
37
|
|
38
|
-
list_heads = queryable.query(subject: var_or_iri, predicate: predicate).map {|s| s.object}
|
38
|
+
list_heads = queryable.query({subject: var_or_iri, predicate: predicate}).map {|s| s.object}
|
39
39
|
|
40
40
|
raise LD::Patch::Error, "UpdateList ambigious value for #{var_or_iri.to_ntriples} and #{predicate.to_ntriples}" if list_heads.length > 1
|
41
41
|
raise LD::Patch::Error, "UpdateList no value found for #{var_or_iri.to_ntriples} and #{predicate.to_ntriples}" if list_heads.empty?
|
data/lib/ld/patch/format.rb
CHANGED
@@ -31,7 +31,7 @@ module LD::Patch
|
|
31
31
|
end
|
32
32
|
raise ArgumentError, "Patching requires a patch or reference to patch resource" unless opts[:patch_input]
|
33
33
|
opts[:logger].info "Patch"
|
34
|
-
patch = LD::Patch.parse(opts[:patch_input], base_uri: opts.fetch(:patch_file, "
|
34
|
+
patch = LD::Patch.parse(opts[:patch_input], base_uri: opts.fetch(:patch_file, "https://rubygems.org/gems/ld-patch"))
|
35
35
|
opts[:messages][:reasoner] = {"S-Expression": [patch.to_sse]} if opts[:to_sxp]
|
36
36
|
RDF::CLI.repository.query(patch)
|
37
37
|
end,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ld-patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Kellogg
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
@@ -16,146 +16,126 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
26
|
+
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ebnf
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sparql
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sxp
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.2'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
68
|
+
version: '1.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rdf-xsd
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '3.
|
75
|
+
version: '3.2'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '3.
|
82
|
+
version: '3.2'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: json-ld
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.2'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.2'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rack
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '2.
|
103
|
+
version: '2.2'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '2.
|
110
|
+
version: '2.2'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rdf-spec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '3.
|
117
|
+
version: '3.2'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '3.
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: open-uri-cached
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0.0'
|
132
|
-
- - ">="
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
version: 0.0.5
|
135
|
-
type: :development
|
136
|
-
prerelease: false
|
137
|
-
version_requirements: !ruby/object:Gem::Requirement
|
138
|
-
requirements:
|
139
|
-
- - "~>"
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0.0'
|
142
|
-
- - ">="
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: 0.0.5
|
124
|
+
version: '3.2'
|
145
125
|
- !ruby/object:Gem::Dependency
|
146
126
|
name: rspec
|
147
127
|
requirement: !ruby/object:Gem::Requirement
|
148
128
|
requirements:
|
149
129
|
- - "~>"
|
150
130
|
- !ruby/object:Gem::Version
|
151
|
-
version: '3.
|
131
|
+
version: '3.10'
|
152
132
|
type: :development
|
153
133
|
prerelease: false
|
154
134
|
version_requirements: !ruby/object:Gem::Requirement
|
155
135
|
requirements:
|
156
136
|
- - "~>"
|
157
137
|
- !ruby/object:Gem::Version
|
158
|
-
version: '3.
|
138
|
+
version: '3.10'
|
159
139
|
- !ruby/object:Gem::Dependency
|
160
140
|
name: rspec-its
|
161
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,28 +156,28 @@ dependencies:
|
|
176
156
|
requirements:
|
177
157
|
- - "~>"
|
178
158
|
- !ruby/object:Gem::Version
|
179
|
-
version: 0.9
|
159
|
+
version: '0.9'
|
180
160
|
type: :development
|
181
161
|
prerelease: false
|
182
162
|
version_requirements: !ruby/object:Gem::Requirement
|
183
163
|
requirements:
|
184
164
|
- - "~>"
|
185
165
|
- !ruby/object:Gem::Version
|
186
|
-
version: 0.9
|
166
|
+
version: '0.9'
|
187
167
|
- !ruby/object:Gem::Dependency
|
188
168
|
name: webmock
|
189
169
|
requirement: !ruby/object:Gem::Requirement
|
190
170
|
requirements:
|
191
171
|
- - "~>"
|
192
172
|
- !ruby/object:Gem::Version
|
193
|
-
version: '3.
|
173
|
+
version: '3.11'
|
194
174
|
type: :development
|
195
175
|
prerelease: false
|
196
176
|
version_requirements: !ruby/object:Gem::Requirement
|
197
177
|
requirements:
|
198
178
|
- - "~>"
|
199
179
|
- !ruby/object:Gem::Version
|
200
|
-
version: '3.
|
180
|
+
version: '3.11'
|
201
181
|
description: |2-
|
202
182
|
|
203
183
|
Implements the W3C Linked Data Patch Format and operations for RDF.rb.
|
@@ -230,11 +210,11 @@ files:
|
|
230
210
|
- lib/ld/patch/parser.rb
|
231
211
|
- lib/ld/patch/terminals.rb
|
232
212
|
- lib/ld/patch/version.rb
|
233
|
-
homepage:
|
213
|
+
homepage: https://github.com/ruby-rdf/ld-patch
|
234
214
|
licenses:
|
235
215
|
- Unlicense
|
236
216
|
metadata: {}
|
237
|
-
post_install_message:
|
217
|
+
post_install_message:
|
238
218
|
rdoc_options: []
|
239
219
|
require_paths:
|
240
220
|
- lib
|
@@ -242,15 +222,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
242
222
|
requirements:
|
243
223
|
- - ">="
|
244
224
|
- !ruby/object:Gem::Version
|
245
|
-
version: '2.
|
225
|
+
version: '2.6'
|
246
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
247
227
|
requirements:
|
248
228
|
- - ">="
|
249
229
|
- !ruby/object:Gem::Version
|
250
230
|
version: '0'
|
251
231
|
requirements: []
|
252
|
-
rubygems_version: 3.
|
253
|
-
signing_key:
|
232
|
+
rubygems_version: 3.3.3
|
233
|
+
signing_key:
|
254
234
|
specification_version: 4
|
255
235
|
summary: W3C Linked Data Patch Format for RDF.rb.
|
256
236
|
test_files: []
|