ld-patch 0.3.0 → 0.3.1

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
  SHA1:
3
- metadata.gz: 7e9c3a738e91fa305a522a8191d1fb0a8aaa9a2c
4
- data.tar.gz: 6affef3f6d8bcc87e50d91fe7501a4a65d654b32
3
+ metadata.gz: 487103c7936e34423555d2da4dcdee60ef0b882f
4
+ data.tar.gz: d394490da8bea83bc4198e7bb9a278ef4719aeb3
5
5
  SHA512:
6
- metadata.gz: 35f504ef3c67100e4ae541bfbd92e2e735c6bb2a52b41c5b88b4639b95e19c29f2f4287ef5281d4bd5dad8450e20b177ccb4ce25bc735b8a66a9ad3091321cd9
7
- data.tar.gz: 9632fac7d95bb231792e4805c4e73fe21162f9086e549c0c959785f1fec80ad91e50eb7c69e064f7188bce47d756e227068ebfc93bf8503441b9fd3544970ec5
6
+ metadata.gz: 363c254bb67028732686af8e1ce2808a9250b93d400f16c4c3e4b0ac32a133d94e80f5e22a0483b3e6e3b27a48de92fe9f5d5f3c2064476fcbd23a156ed419b1
7
+ data.tar.gz: a1aff9d1f218b27ccd9a77f9a6bccacc7c57d2d656ba608235ff772d06b4acda023c7d9734941e5d37666a9ae6fea7fc39ea6596c168f21274b8c3947d8e64f4
data/README.md CHANGED
@@ -24,7 +24,7 @@ This gem implements the [LD Patch][] specification with a couple of changes and/
24
24
  * 100% free and unencumbered [public domain](http://unlicense.org/) software.
25
25
  * Complete [Linked Data Patch Format][LD Patch] parsing and execution
26
26
  * Implementation Report: {file:etc/earl.html EARL}
27
- * Compatible with Ruby >= 2.0.0.
27
+ * Compatible with Ruby >= 2.2.2.
28
28
 
29
29
  ## Documentation
30
30
  Full documentation available on [Rubydoc.info][LD-Patch doc]
@@ -60,7 +60,7 @@ The parser takes branch and follow tables generated from the [LD Patch Grammar](
60
60
 
61
61
  ## Dependencies
62
62
 
63
- * [Ruby](http://ruby-lang.org/) (>= 2.0.0)
63
+ * [Ruby](http://ruby-lang.org/) (>= 2.2.2)
64
64
  * [RDF.rb](http://rubygems.org/gems/rdf) (~> 2.0)
65
65
  * [EBNF][] (~> 1.0)
66
66
  * [SPARQL][] (~> 2.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
data/lib/ld/patch.rb CHANGED
@@ -14,7 +14,7 @@ module LD
14
14
  autoload :Meta, 'ld/patch/meta'
15
15
  autoload :Parser, 'ld/patch/parser'
16
16
  autoload :Terminals, 'ld/patch/terminals'
17
- autoload :Version, 'ld/patch/version'
17
+ autoload :VERSION, 'ld/patch/version'
18
18
 
19
19
  ##
20
20
  # Parse the given LD Patch `input` string.
data/lib/ld/patch/meta.rb CHANGED
@@ -1,4 +1,4 @@
1
- # This file is automatically generated by /Users/gregg/.rvm/gems/ruby-2.1.5/bundler/gems/ebnf-41d77406ce61/lib/ebnf/base.rb
1
+ # This file is automatically generated by /Users/gregg/.rvm/gems/ruby-2.3.3/bundler/gems/ebnf-7d5f4b7c477c/lib/ebnf/base.rb
2
2
  # BRANCH derived from etc/ld-patch.ebnf
3
3
  module LD::Patch::Meta
4
4
  START = :ldpatch
@@ -2662,5 +2662,29 @@ module LD::Patch::Meta
2662
2662
  :STRING_LITERAL_LONG_SINGLE_QUOTE,
2663
2663
  :STRING_LITERAL_LONG_QUOTE],
2664
2664
  }.freeze
2665
+ CLEANUP = {
2666
+ :_RDFLiteral_1 => :opt,
2667
+ :_bind_2 => :opt,
2668
+ :_collection_1 => :star,
2669
+ :_collection_2 => :merge,
2670
+ :_constraint_2 => :opt,
2671
+ :_graph_1 => :star,
2672
+ :_graph_3 => :merge,
2673
+ :_graph_4 => :opt,
2674
+ :_ldpatch_1 => :star,
2675
+ :_ldpatch_2 => :merge,
2676
+ :_objectList_1 => :star,
2677
+ :_objectList_3 => :merge,
2678
+ :path => :star,
2679
+ :_path_2 => :merge,
2680
+ :_predicateObjectList_1 => :star,
2681
+ :_predicateObjectList_3 => :merge,
2682
+ :_predicateObjectList_4 => :opt,
2683
+ :prologue => :star,
2684
+ :_prologue_1 => :merge,
2685
+ :_slice_1 => :opt,
2686
+ :_slice_2 => :opt,
2687
+ :_triples_3 => :opt,
2688
+ }.freeze
2665
2689
  end
2666
2690
 
@@ -177,11 +177,11 @@ module LD::Patch
177
177
  end
178
178
 
179
179
  # [13] path ::= ( '/' step | constraint )*
180
- # ( '/' step | constraint )
181
- production(:_path_1) do |input, current, callback|
180
+
181
+ # [14] step ::= '^' iri | iri | INTEGER
182
+ production(:step) do |input, current, callback|
182
183
  step = case
183
184
  when current[:literal] then Algebra::Index.new(current[:literal])
184
- when current[:constraint] then current[:constraint]
185
185
  when current[:reverse] then Algebra::Reverse.new(current[:iri])
186
186
  else current[:iri]
187
187
  end
@@ -191,7 +191,7 @@ module LD::Patch
191
191
  # [15] constraint ::= '[' path ( '=' value )? ']' | '!'
192
192
  production(:constraint) do |input, current, callback|
193
193
  path = Algebra::Path.new(*Array(current[:path]))
194
- input[:constraint] = if current[:value]
194
+ (input[:path] ||= []) << if current[:value]
195
195
  Algebra::Constraint.new(path, current[:value])
196
196
  elsif current[:path]
197
197
  Algebra::Constraint.new(path)
@@ -349,26 +349,6 @@ module LD::Patch
349
349
  end
350
350
  end
351
351
 
352
- ##
353
- # Returns `true` if the input string is syntactically valid.
354
- #
355
- # @return [Boolean]
356
- def valid?
357
- parse
358
- true
359
- rescue ParseError
360
- false
361
- end
362
-
363
- # @return [String]
364
- def to_sxp_bin
365
- @result
366
- end
367
-
368
- def to_s
369
- @result.to_sxp
370
- end
371
-
372
352
  ##
373
353
  # Accumulated errors found during processing
374
354
  # @return [Array<String>]
@@ -514,57 +494,26 @@ module LD::Patch
514
494
  # Return variable allocated to an ID.
515
495
  # If no ID is provided, a new variable
516
496
  # is allocated. Otherwise, any previous assignment will be used.
517
- #
518
- # The variable has a #distinguished? method applied depending on if this
519
- # is a disinguished or non-distinguished variable. Non-distinguished
520
- # variables are effectively the same as BNodes.
521
497
  # @return [RDF::Query::Variable]
522
498
  def variable(id, distinguished = true)
523
- id = nil if id.to_s.empty?
524
-
525
- if id
526
- @vars[id] ||= begin
527
- v = RDF::Query::Variable.new(id)
528
- v.distinguished = distinguished
529
- v
530
- end
531
- else
532
- unless distinguished
533
- # Allocate a non-distinguished variable identifier
534
- id = @nd_var_gen
535
- @nd_var_gen = id.succ
536
- end
499
+ @vars[id] ||= begin
537
500
  v = RDF::Query::Variable.new(id)
538
501
  v.distinguished = distinguished
539
502
  v
540
503
  end
541
504
  end
542
505
 
543
- # Used for generating BNode labels
544
- attr_accessor :nd_var_gen
545
-
546
- # Reset the bnode cache, always generating new nodes, and start generating BNodes instead of non-distinguished variables
547
- def clear_bnode_cache
548
- @nd_var_gen = false
549
- @bnode_cache = {}
550
- end
551
-
552
506
  # Generate a BNode identifier
553
507
  def bnode(id = nil)
554
- if @nd_var_gen
555
- # Use non-distinguished variables within patterns
556
- variable(id, false)
557
- else
558
- unless id
559
- id = @options[:anon_base]
560
- @options[:anon_base] = @options[:anon_base].succ
561
- end
562
- # Don't use provided ID to avoid aliasing issues when re-serializing the graph, when the bnode identifiers are re-used
563
- (@bnode_cache ||= {})[id.to_s] ||= begin
564
- new_bnode = RDF::Node.new
565
- new_bnode.lexical = "_:#{id}"
566
- new_bnode
567
- end
508
+ unless id
509
+ id = @options[:anon_base]
510
+ @options[:anon_base] = @options[:anon_base].succ
511
+ end
512
+ # Don't use provided ID to avoid aliasing issues when re-serializing the graph, when the bnode identifiers are re-used
513
+ (@bnode_cache ||= {})[id.to_s] ||= begin
514
+ new_bnode = RDF::Node.new
515
+ new_bnode.lexical = "_:#{id}"
516
+ new_bnode
568
517
  end
569
518
  end
570
519
 
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: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Kellogg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-10 00:00:00.000000000 Z
11
+ date: 2016-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf
@@ -196,14 +196,14 @@ dependencies:
196
196
  requirements:
197
197
  - - "~>"
198
198
  - !ruby/object:Gem::Version
199
- version: '1.22'
199
+ version: '2.3'
200
200
  type: :development
201
201
  prerelease: false
202
202
  version_requirements: !ruby/object:Gem::Requirement
203
203
  requirements:
204
204
  - - "~>"
205
205
  - !ruby/object:Gem::Version
206
- version: '1.22'
206
+ version: '2.3'
207
207
  description: |2-
208
208
 
209
209
  Implements the W3C Linked Data Patch Format and operations for RDF.rb.
@@ -248,7 +248,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
248
248
  requirements:
249
249
  - - ">="
250
250
  - !ruby/object:Gem::Version
251
- version: 2.0.0
251
+ version: 2.2.2
252
252
  required_rubygems_version: !ruby/object:Gem::Requirement
253
253
  requirements:
254
254
  - - ">="
@@ -256,9 +256,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
256
  version: '0'
257
257
  requirements: []
258
258
  rubyforge_project: ld-patch
259
- rubygems_version: 2.4.8
259
+ rubygems_version: 2.6.8
260
260
  signing_key:
261
261
  specification_version: 4
262
262
  summary: W3C Linked Data Patch Format for RDF.rb.
263
263
  test_files: []
264
- has_rdoc: false