shex 0.5.2 → 0.6.0

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
- SHA1:
3
- metadata.gz: fdc22fc0cbd72f02a6a807fb42af927c8b775a50
4
- data.tar.gz: 28cf889e643e7132959045b03142efd0a20397f7
2
+ SHA256:
3
+ metadata.gz: d590c5b6411af716a57b781db5d2957701c197f1ee0a35ade6934b9012f8a4ea
4
+ data.tar.gz: f8ebee1f895654763ce8bc69b400aef5aaf5f57e36ccddbdb3326cbb0da5c863
5
5
  SHA512:
6
- metadata.gz: e54c857b51c4ac594df2809b97e358bb2bd2fe4e83a1ad7ec91da1022ef9b2293f71de5cb2d88f1b3a529dd053bda53d65961ab9bab20f07f756c22947fe26a3
7
- data.tar.gz: '058b65943bf484559158f249abbbdce55ce725759ac9312a06f8e56ed86eb3170e5a3a941388f38260e982cec18d02b592e89cafe96e2c1df133e97b7e908736'
6
+ metadata.gz: afb67c8fcb7c69393d60e70a8035e7066e5a4fcb4009a64232d82cc3b724758bd2cdcc42774e49765a32d2b15b87b9dd5a74ae593b840f969022ba9def8ae89c
7
+ data.tar.gz: d8c30c1ae94fcbd59cdb17f8190daf2cda101471e5076d76b81f80645fe8b26d72eca48c385ee0e73c5772f15415511b16883527c9401aa010b2a72f299976c6
data/README.md CHANGED
@@ -8,6 +8,7 @@ This is a pure-Ruby library for working with the [Shape Expressions Language][Sh
8
8
  [![Build Status](https://travis-ci.org/ruby-rdf/shex.png?branch=master)](http://travis-ci.org/ruby-rdf/shex)
9
9
  [![Coverage Status](https://coveralls.io/repos/ruby-rdf/shex/badge.svg)](https://coveralls.io/r/ruby-rdf/shex)
10
10
  [![Join the chat at https://gitter.im/ruby-rdf/rdf](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ruby-rdf/rdf?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
11
+ [![DOI](https://zenodo.org/badge/74419330.svg)](https://zenodo.org/badge/latestdoi/74419330)
11
12
 
12
13
  ## Features
13
14
 
@@ -192,8 +193,8 @@ The result of parsing either ShExC or ShExJ is the creation of a set of executab
192
193
 
193
194
  ## Dependencies
194
195
 
195
- * [Ruby](http://ruby-lang.org/) (>= 2.2.2)
196
- * [RDF.rb](http://rubygems.org/gems/rdf) (~> 2.2)
196
+ * [Ruby](http://ruby-lang.org/) (>= 2.4)
197
+ * [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.1)
197
198
 
198
199
  ## Installation
199
200
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.2
1
+ 0.6.0
@@ -33,13 +33,13 @@ module ShEx
33
33
  # @raise (see ShEx::Parser#parse)
34
34
  def self.parse(expression, format: 'shexc', **options)
35
35
  case format.to_s
36
- when 'shexc' then Parser.new(expression, options).parse
36
+ when 'shexc' then Parser.new(expression, **options).parse
37
37
  when 'shexj'
38
38
  expression = expression.read if expression.respond_to?(:read)
39
- Algebra.from_shexj(JSON.parse(expression), options)
39
+ Algebra.from_shexj(JSON.parse(expression), **options)
40
40
  when 'sxp'
41
41
  expression = expression.read if expression.respond_to?(:read)
42
- Algebra.from_sxp(expression, options)
42
+ Algebra.from_sxp(expression, **options)
43
43
  else raise "Unknown expression format: #{format.inspect}"
44
44
  end
45
45
  end
@@ -56,8 +56,8 @@ module ShEx
56
56
  # @return (see ShEx::Parser#parse)
57
57
  # @raise (see ShEx::Parser#parse)
58
58
  def self.open(filename, format: 'shexc', **options, &block)
59
- RDF::Util::File.open_file(filename, options) do |file|
60
- self.parse(file, options.merge(format: format))
59
+ RDF::Util::File.open_file(filename, **options) do |file|
60
+ self.parse(file, format: format, **options)
61
61
  end
62
62
  end
63
63
 
@@ -73,10 +73,10 @@ module ShEx
73
73
  # @return (see ShEx::Algebra::Schema#execute)
74
74
  # @raise (see ShEx::Algebra::Schema#execute)
75
75
  def self.execute(expression, queryable, map, format: 'shexc', **options)
76
- shex = self.parse(expression, options.merge(format: format))
76
+ shex = self.parse(expression, format: format, **options)
77
77
  queryable = queryable || RDF::Graph.new
78
78
 
79
- shex.execute(queryable, map, options)
79
+ shex.execute(queryable, map, **options)
80
80
  end
81
81
 
82
82
  ##
@@ -91,10 +91,10 @@ module ShEx
91
91
  # @return (see ShEx::Algebra::Schema#satisfies?)
92
92
  # @raise (see ShEx::Algebra::Schema#satisfies?)
93
93
  def self.satisfies?(expression, queryable, map, format: 'shexc', **options)
94
- shex = self.parse(expression, options.merge(format: format))
94
+ shex = self.parse(expression, format: format, **options)
95
95
  queryable = queryable || RDF::Graph.new
96
96
 
97
- shex.satisfies?(queryable, map, options)
97
+ shex.satisfies?(queryable, map, **options)
98
98
  end
99
99
 
100
100
  ##
@@ -116,7 +116,7 @@ module ShEx
116
116
  # @param [String, #to_s] message
117
117
  # @param [Hash{Symbol => Object}] options
118
118
  # @option options [Integer] :code (422)
119
- def initialize(message, options = {})
119
+ def initialize(message, **options)
120
120
  @code = options.fetch(:status_code, 422)
121
121
  super(message.to_s)
122
122
  end
@@ -50,7 +50,7 @@ module ShEx
50
50
  # @option options [RDF::URI] :base
51
51
  # @option options [Hash{String => RDF::URI}] :prefixes
52
52
  # @return [Operator]
53
- def self.from_shexj(operator, options = {})
53
+ def self.from_shexj(operator, **options)
54
54
  raise ArgumentError unless operator.is_a?(Hash)
55
55
  klass = case operator['type']
56
56
  when 'Annotation' then Annotation
@@ -76,7 +76,7 @@ module ShEx
76
76
  else raise ArgumentError, "unknown type #{operator['type'].inspect}"
77
77
  end
78
78
 
79
- klass.from_shexj(operator, options)
79
+ klass.from_shexj(operator, **options)
80
80
  end
81
81
  end
82
82
  end
@@ -19,7 +19,7 @@ module ShEx::Algebra
19
19
  # Creates an operator instance from a parsed ShExJ representation
20
20
  # @param (see Operator#from_shexj)
21
21
  # @return [Operator]
22
- def self.from_shexj(operator, options = {})
22
+ def self.from_shexj(operator, **options)
23
23
  raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == 'ShapeAnd'
24
24
  raise ArgumentError, "missing shapeExprs in #{operator.inspect}" unless operator.has_key?('shapeExprs')
25
25
  super
@@ -7,7 +7,7 @@ module ShEx::Algebra
7
7
  # Creates an operator instance from a parsed ShExJ representation
8
8
  # @param (see Operator#from_shexj)
9
9
  # @return [Operator]
10
- def self.from_shexj(operator, options = {})
10
+ def self.from_shexj(operator, **options)
11
11
  raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == "Annotation"
12
12
  raise ArgumentError, "missing predicate in #{operator.inspect}" unless operator.has_key?('predicate')
13
13
  raise ArgumentError, "missing object in #{operator.inspect}" unless operator.has_key?('object')
@@ -8,7 +8,7 @@ module ShEx::Algebra
8
8
  # Creates an operator instance from a parsed ShExJ representation
9
9
  # @param (see Operator#from_shexj)
10
10
  # @return [Operator]
11
- def self.from_shexj(operator, options = {})
11
+ def self.from_shexj(operator, **options)
12
12
  raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == 'EachOf'
13
13
  raise ArgumentError, "missing expressions in #{operator.inspect}" unless operator.has_key?('expressions')
14
14
  super
@@ -9,7 +9,7 @@ module ShEx::Algebra
9
9
  # Creates an operator instance from a parsed ShExJ representation
10
10
  # @param (see Operator#from_shexj)
11
11
  # @return [Operator]
12
- def self.from_shexj(operator, options = {})
12
+ def self.from_shexj(operator, **options)
13
13
  raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == 'NodeConstraint'
14
14
  super
15
15
  end
@@ -8,7 +8,7 @@ module ShEx::Algebra
8
8
  # Creates an operator instance from a parsed ShExJ representation
9
9
  # @param (see Operator#from_shexj)
10
10
  # @return [Operator]
11
- def self.from_shexj(operator, options = {})
11
+ def self.from_shexj(operator, **options)
12
12
  raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == 'ShapeNot'
13
13
  raise ArgumentError, "missing shapeExpr in #{operator.inspect}" unless operator.has_key?('shapeExpr')
14
14
  super
@@ -8,7 +8,7 @@ module ShEx::Algebra
8
8
  # Creates an operator instance from a parsed ShExJ representation
9
9
  # @param (see Operator#from_shexj)
10
10
  # @return [Operator]
11
- def self.from_shexj(operator, options = {})
11
+ def self.from_shexj(operator, **options)
12
12
  raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == 'OneOf'
13
13
  raise ArgumentError, "missing expressions in #{operator.inspect}" unless operator.has_key?('expressions')
14
14
  super
@@ -26,7 +26,7 @@ module ShEx::Algebra
26
26
  # @overload initialize(*operands)
27
27
  # @param [Array<RDF::Term>] operands
28
28
  #
29
- # @overload initialize(*operands, options)
29
+ # @overload initialize(*operands, **options)
30
30
  # @param [Array<RDF::Term>] operands
31
31
  # @param [Hash{Symbol => Object}] options
32
32
  # any additional options
@@ -260,7 +260,7 @@ module ShEx::Algebra
260
260
  # @option options [RDF::URI] :base
261
261
  # @option options [Hash{String => RDF::URI}] :prefixes
262
262
  # @return [Operator]
263
- def self.from_shexj(operator, options = {})
263
+ def self.from_shexj(operator, **options)
264
264
  options[:context] ||= JSON::LD::Context.parse(ShEx::CONTEXT)
265
265
  operands = []
266
266
  id = nil
@@ -268,21 +268,21 @@ module ShEx::Algebra
268
268
  operator.each do |k, v|
269
269
  case k
270
270
  when /length|clusive|digits/ then operands << [k.to_sym, RDF::Literal(v)]
271
- when 'id' then id = iri(v, options)
271
+ when 'id' then id = iri(v, **options)
272
272
  when 'flags' then ; # consumed in pattern below
273
273
  when 'min', 'max' then operands << [k.to_sym, (v == -1 ? '*' : v)]
274
274
  when 'inverse', 'closed' then operands << k.to_sym
275
275
  when 'nodeKind' then operands << v.to_sym
276
- when 'object' then operands << value(v, options)
276
+ when 'object' then operands << value(v, **options)
277
277
  when 'languageTag' then operands << v
278
278
  when 'pattern'
279
279
  # Include flags as well
280
280
  operands << [:pattern, RDF::Literal(v), operator['flags']].compact
281
281
  when 'start'
282
282
  if v.is_a?(String)
283
- operands << Start.new(iri(v, options))
283
+ operands << Start.new(iri(v, **options))
284
284
  else
285
- operands << Start.new(ShEx::Algebra.from_shexj(v, options))
285
+ operands << Start.new(ShEx::Algebra.from_shexj(v, **options))
286
286
  end
287
287
  when '@context' then
288
288
  options[:context] = JSON::LD::Context.parse(v)
@@ -290,47 +290,47 @@ module ShEx::Algebra
290
290
  when 'shapes'
291
291
  operands << case v
292
292
  when Array
293
- [:shapes] + v.map {|vv| ShEx::Algebra.from_shexj(vv, options)}
293
+ [:shapes] + v.map {|vv| ShEx::Algebra.from_shexj(vv, **options)}
294
294
  else
295
295
  raise "Expected value of shapes #{v.inspect}"
296
296
  end
297
297
  when 'stem', 'name'
298
298
  # Value may be :wildcard for stem
299
299
  if [IriStem, IriStemRange, SemAct].include?(self)
300
- operands << (v.is_a?(Symbol) ? v : value(v, options))
300
+ operands << (v.is_a?(Symbol) ? v : value(v, **options))
301
301
  else
302
302
  operands << v
303
303
  end
304
- when 'predicate' then operands << [:predicate, iri(v, options)]
304
+ when 'predicate' then operands << [:predicate, iri(v, **options)]
305
305
  when 'extra', 'datatype'
306
306
  v = [v] unless v.is_a?(Array)
307
- operands << (v.map {|op| iri(op, options)}).unshift(k.to_sym)
307
+ operands << (v.map {|op| iri(op, **options)}).unshift(k.to_sym)
308
308
  when 'exclusions'
309
309
  v = [v] unless v.is_a?(Array)
310
310
  operands << v.map do |op|
311
311
  if op.is_a?(Hash) && op.has_key?('type')
312
- ShEx::Algebra.from_shexj(op, options)
312
+ ShEx::Algebra.from_shexj(op, **options)
313
313
  elsif [IriStem, IriStemRange].include?(self)
314
- value(op, options)
314
+ value(op, **options)
315
315
  else
316
316
  RDF::Literal(op)
317
317
  end
318
318
  end.unshift(:exclusions)
319
319
  when 'semActs', 'startActs', 'annotations'
320
320
  v = [v] unless v.is_a?(Array)
321
- operands += v.map {|op| ShEx::Algebra.from_shexj(op, options)}
321
+ operands += v.map {|op| ShEx::Algebra.from_shexj(op, **options)}
322
322
  when 'expression', 'expressions', 'shapeExpr', 'shapeExprs', 'valueExpr'
323
323
  v = [v] unless v.is_a?(Array)
324
324
  operands += v.map do |op|
325
325
  # It's a URI reference to a Shape
326
- op.is_a?(String) ? iri(op, options) : ShEx::Algebra.from_shexj(op, options)
326
+ op.is_a?(String) ? iri(op, **options) : ShEx::Algebra.from_shexj(op, **options)
327
327
  end
328
328
  when 'code'
329
329
  operands << v
330
330
  when 'values'
331
331
  v = [v] unless v.is_a?(Array)
332
332
  operands += v.map do |op|
333
- Value.new(value(op, options))
333
+ Value.new(value(op, **options))
334
334
  end
335
335
  end
336
336
  end
@@ -476,14 +476,14 @@ module ShEx::Algebra
476
476
  # @option options [JSON::LD::Context] :context
477
477
  # @return [RDF::Value]
478
478
  def iri(value, options = @options)
479
- self.class.iri(value, options)
479
+ self.class.iri(value, **options)
480
480
  end
481
481
 
482
482
  # Create URIs
483
483
  # @param (see #iri)
484
484
  # @option (see #iri)
485
485
  # @return (see #iri)
486
- def self.iri(value, options)
486
+ def self.iri(value, **options)
487
487
  # If we have a base URI, use that when constructing a new URI
488
488
  base_uri = options[:base_uri]
489
489
 
@@ -492,7 +492,7 @@ module ShEx::Algebra
492
492
  # A JSON-LD node reference
493
493
  v = options[:context].expand_value(value)
494
494
  raise "Expected #{value.inspect} to be a JSON-LD Node Reference" unless JSON::LD::Utils.node_reference?(v)
495
- self.iri(v['@id'], options)
495
+ self.iri(v['@id'], **options)
496
496
  when RDF::URI
497
497
  if base_uri && value.relative?
498
498
  base_uri.join(value)
@@ -530,26 +530,26 @@ module ShEx::Algebra
530
530
  # @option options [Hash{String => RDF::URI}] :prefixes
531
531
  # @return [RDF::Value]
532
532
  def value(value, options = @options)
533
- self.class.value(value, options)
533
+ self.class.value(value, **options)
534
534
  end
535
535
 
536
536
  # Create Values, with "clever" matching to see if it might be a value, IRI or BNode.
537
537
  # @param (see #value)
538
538
  # @option (see #value)
539
539
  # @return (see #value)
540
- def self.value(value, options)
540
+ def self.value(value, **options)
541
541
  # If we have a base URI, use that when constructing a new URI
542
542
  case value
543
543
  when Hash
544
544
  # Either a value object or a node reference
545
545
  if value['uri'] || value['@id']
546
- iri(value['uri'] || value['@id'], options)
546
+ iri(value['uri'] || value['@id'], **options)
547
547
  elsif value['value'] || value['@value']
548
548
  RDF::Literal(value['value'] || value['@value'], datatype: value['type'] || value['@type'], language: value['language'] || value['@language'])
549
549
  else
550
- ShEx::Algebra.from_shexj(value, options)
550
+ ShEx::Algebra.from_shexj(value, **options)
551
551
  end
552
- else iri(value, options)
552
+ else iri(value, **options)
553
553
  end
554
554
  end
555
555
 
@@ -681,7 +681,7 @@ module ShEx::Algebra
681
681
  # the first operand
682
682
  # @param [Hash{Symbol => Object}] options
683
683
  # any additional options (see {Operator#initialize})
684
- def initialize(arg1, options = {})
684
+ def initialize(arg1, **options)
685
685
  raise ArgumentError, "wrong number of arguments (given 2, expected 1)" unless options.is_a?(Hash)
686
686
  super
687
687
  end
@@ -703,7 +703,7 @@ module ShEx::Algebra
703
703
  # the second operand
704
704
  # @param [Hash{Symbol => Object}] options
705
705
  # any additional options (see {Operator#initialize})
706
- def initialize(arg1, arg2, options = {})
706
+ def initialize(arg1, arg2, **options)
707
707
  raise ArgumentError, "wrong number of arguments (given 3, expected 2)" unless options.is_a?(Hash)
708
708
  super
709
709
  end
@@ -19,7 +19,7 @@ module ShEx::Algebra
19
19
  # Creates an operator instance from a parsed ShExJ representation
20
20
  # @param (see Operator#from_shexj)
21
21
  # @return [Operator]
22
- def self.from_shexj(operator, options = {})
22
+ def self.from_shexj(operator, **options)
23
23
  raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == 'ShapeOr'
24
24
  raise ArgumentError, "missing shapeExprs in #{operator.inspect}" unless operator.is_a?(Hash) && operator.has_key?('shapeExprs')
25
25
  super
@@ -19,7 +19,7 @@ module ShEx::Algebra
19
19
  # Creates an operator instance from a parsed ShExJ representation
20
20
  # @param (see Operator#from_shexj)
21
21
  # @return [Operator]
22
- def self.from_shexj(operator, options = {})
22
+ def self.from_shexj(operator, **options)
23
23
  raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == "Schema"
24
24
  super
25
25
  end
@@ -51,7 +51,7 @@ module ShEx::Algebra
51
51
  @graph, @shapes_entered, results = graph, {}, {}
52
52
  @external_schemas = shapeExterns
53
53
  @extensions = {}
54
- focus = Array(focus).map {|f| value(f, options)}
54
+ focus = Array(focus).map {|f| value(f, **options)}
55
55
 
56
56
  logger = options[:logger] || @options[:logger]
57
57
  each_descendant do |op|
@@ -7,7 +7,7 @@ module ShEx::Algebra
7
7
  # Creates an operator instance from a parsed ShExJ representation
8
8
  # @param (see Operator#from_shexj)
9
9
  # @return [Operator]
10
- def self.from_shexj(operator, options = {})
10
+ def self.from_shexj(operator, **options)
11
11
  raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == "SemAct"
12
12
  raise ArgumentError, "missing name in #{operator.inspect}" unless operator.has_key?('name')
13
13
  code = operator.delete('code')
@@ -23,7 +23,7 @@ module ShEx::Algebra
23
23
  # Creates an operator instance from a parsed ShExJ representation
24
24
  # @param (see Operator#from_shexj)
25
25
  # @return [Operator]
26
- def self.from_shexj(operator, options = {})
26
+ def self.from_shexj(operator, **options)
27
27
  raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == "Shape"
28
28
  super
29
29
  end
@@ -7,7 +7,7 @@ module ShEx::Algebra
7
7
  # Creates an operator instance from a parsed ShExJ representation
8
8
  # @param (see Operator#from_shexj)
9
9
  # @return [Operator]
10
- def self.from_shexj(operator, options = {})
10
+ def self.from_shexj(operator, **options)
11
11
  raise ArgumentError unless operator.is_a?(Hash) && %w(IriStem LiteralStem LanguageStem).include?(operator['type'])
12
12
  raise ArgumentError, "missing stem in #{operator.inspect}" unless operator.has_key?('stem')
13
13
  super
@@ -7,7 +7,7 @@ module ShEx::Algebra
7
7
  # Creates an operator instance from a parsed ShExJ representation
8
8
  # @param (see Operator#from_shexj)
9
9
  # @return [Operator]
10
- def self.from_shexj(operator, options = {})
10
+ def self.from_shexj(operator, **options)
11
11
  raise ArgumentError unless operator.is_a?(Hash) && %w(IriStemRange LiteralStemRange LanguageStemRange).include?(operator['type'])
12
12
  raise ArgumentError, "missing stem in #{operator.inspect}" unless operator.has_key?('stem')
13
13
 
@@ -21,11 +21,11 @@ module ShEx::Algebra
21
21
  # Remove "Range" from type
22
22
  case operator['type']
23
23
  when 'IriStemRange'
24
- IriStem.from_shexj(operator.merge('type' => 'IriStem'), options)
24
+ IriStem.from_shexj(operator.merge('type' => 'IriStem'), **options)
25
25
  when 'LiteralStemRange'
26
- LiteralStem.from_shexj(operator.merge('type' => 'LiteralStem'), options)
26
+ LiteralStem.from_shexj(operator.merge('type' => 'LiteralStem'), **options)
27
27
  when 'LanguageStemRange'
28
- LanguageStem.from_shexj(operator.merge('type' => 'LanguageStem'), options)
28
+ LanguageStem.from_shexj(operator.merge('type' => 'LanguageStem'), **options)
29
29
  end
30
30
  end
31
31
  end
@@ -8,7 +8,7 @@ module ShEx::Algebra
8
8
  # Creates an operator instance from a parsed ShExJ representation
9
9
  # @param (see Operator#from_shexj)
10
10
  # @return [Operator]
11
- def self.from_shexj(operator, options = {})
11
+ def self.from_shexj(operator, **options)
12
12
  raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == 'TripleConstraint'
13
13
  raise ArgumentError unless operator.has_key?('predicate')
14
14
  super
@@ -25,7 +25,7 @@ module ShEx
25
25
  description: "Validate repository given shape",
26
26
  help: "shex [--shape Resource] [--focus Resource] [--schema-input STRING] [--schema STRING] file",
27
27
  parse: true,
28
- lambda: -> (argv, options) do
28
+ lambda: -> (argv, **options) do
29
29
  options[:schema_input] ||= case options[:schema]
30
30
  when IO, StringIO then options[:schema]
31
31
  else RDF::Util::File.open_file(options[:schema]) {|f| f.read}
@@ -44,7 +44,7 @@ module ShEx
44
44
  shape = options.delete(:shape)
45
45
  map = shape ? {focus => shape} : {}
46
46
  begin
47
- res = shex.execute(RDF::CLI.repository, map, options.merge(focus: focus))
47
+ res = shex.execute(RDF::CLI.repository, map, focus: focus, **options)
48
48
  options[:messages][:shex] = {
49
49
  result: ["Satisfied shape."],
50
50
  detail: [SXP::Generator.string(res.to_sxp_bin)]
@@ -178,7 +178,7 @@ module ShEx
178
178
  expressions << Algebra::Start.new(data[:start]) if data[:start]
179
179
  expressions << data[:shapes].unshift(:shapes) if data[:shapes]
180
180
 
181
- input[:schema] = Algebra::Schema.new(*expressions, options)
181
+ input[:schema] = Algebra::Schema.new(*expressions, **options)
182
182
  self
183
183
  end
184
184
 
@@ -730,7 +730,7 @@ module ShEx
730
730
  # @raise [ShEx::NotSatisfied] if not satisfied
731
731
  # @raise [ShEx::ParseError] when a syntax error is detected
732
732
  # @raise [ShEx::StructureError, ArgumentError] on structural problems with schema
733
- def initialize(input = nil, options = {}, &block)
733
+ def initialize(input = nil, **options, &block)
734
734
  @input = case input
735
735
  when IO, StringIO then input.read
736
736
  else input.to_s.dup
@@ -778,10 +778,13 @@ module ShEx
778
778
  # @see http://www.w3.org/TR/sparql11-query/#sparqlAlgebra
779
779
  # @see http://axel.deri.ie/sparqltutorial/ESWC2007_SPARQL_Tutorial_unit2b.pdf
780
780
  def parse(prod = START)
781
- ll1_parse(@input, prod.to_sym, @options.merge(branch: BRANCH,
782
- first: FIRST,
783
- follow: FOLLOW,
784
- whitespace: WS)
781
+ ll1_parse(@input,
782
+ prod.to_sym,
783
+ branch: BRANCH,
784
+ first: FIRST,
785
+ follow: FOLLOW,
786
+ whitespace: WS,
787
+ **@options
785
788
  ) do |context, *data|
786
789
  case context
787
790
  when :trace
@@ -929,7 +932,7 @@ module ShEx
929
932
  end
930
933
 
931
934
  # Create a literal
932
- def literal(value, options = {})
935
+ def literal(value, **options)
933
936
  options = options.dup
934
937
  # Internal representation is to not use xsd:string, although it could arguably go the other way.
935
938
  options.delete(:datatype) if options[:datatype] == RDF::XSD.string
metadata CHANGED
@@ -1,225 +1,183 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Kellogg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-14 00:00:00.000000000 Z
11
+ date: 2019-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '2.2'
20
- - - "<"
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: '4.0'
19
+ version: '3.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '2.2'
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '4.0'
26
+ version: '3.1'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: json-ld
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '2.2'
40
- - - "<"
31
+ - - "~>"
41
32
  - !ruby/object:Gem::Version
42
- version: '4.0'
33
+ version: '3.1'
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: '2.2'
50
- - - "<"
38
+ - - "~>"
51
39
  - !ruby/object:Gem::Version
52
- version: '4.0'
40
+ version: '3.1'
53
41
  - !ruby/object:Gem::Dependency
54
42
  name: json-ld-preloaded
55
43
  requirement: !ruby/object:Gem::Requirement
56
44
  requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: '2.2'
60
- - - "<"
45
+ - - "~>"
61
46
  - !ruby/object:Gem::Version
62
- version: '4.0'
47
+ version: '3.1'
63
48
  type: :runtime
64
49
  prerelease: false
65
50
  version_requirements: !ruby/object:Gem::Requirement
66
51
  requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '2.2'
70
- - - "<"
52
+ - - "~>"
71
53
  - !ruby/object:Gem::Version
72
- version: '4.0'
54
+ version: '3.1'
73
55
  - !ruby/object:Gem::Dependency
74
56
  name: ebnf
75
57
  requirement: !ruby/object:Gem::Requirement
76
58
  requirements:
77
59
  - - "~>"
78
60
  - !ruby/object:Gem::Version
79
- version: '1.1'
61
+ version: '1.2'
80
62
  type: :runtime
81
63
  prerelease: false
82
64
  version_requirements: !ruby/object:Gem::Requirement
83
65
  requirements:
84
66
  - - "~>"
85
67
  - !ruby/object:Gem::Version
86
- version: '1.1'
68
+ version: '1.2'
87
69
  - !ruby/object:Gem::Dependency
88
70
  name: sxp
89
71
  requirement: !ruby/object:Gem::Requirement
90
72
  requirements:
91
73
  - - "~>"
92
74
  - !ruby/object:Gem::Version
93
- version: '1.0'
75
+ version: '1.1'
94
76
  type: :runtime
95
77
  prerelease: false
96
78
  version_requirements: !ruby/object:Gem::Requirement
97
79
  requirements:
98
80
  - - "~>"
99
81
  - !ruby/object:Gem::Version
100
- version: '1.0'
82
+ version: '1.1'
101
83
  - !ruby/object:Gem::Dependency
102
84
  name: rdf-xsd
103
85
  requirement: !ruby/object:Gem::Requirement
104
86
  requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- version: '2.2'
108
- - - "<"
87
+ - - "~>"
109
88
  - !ruby/object:Gem::Version
110
- version: '4.0'
89
+ version: '3.1'
111
90
  type: :runtime
112
91
  prerelease: false
113
92
  version_requirements: !ruby/object:Gem::Requirement
114
93
  requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '2.2'
118
- - - "<"
94
+ - - "~>"
119
95
  - !ruby/object:Gem::Version
120
- version: '4.0'
96
+ version: '3.1'
121
97
  - !ruby/object:Gem::Dependency
122
98
  name: sparql
123
99
  requirement: !ruby/object:Gem::Requirement
124
100
  requirements:
125
- - - ">="
126
- - !ruby/object:Gem::Version
127
- version: '2.2'
128
- - - "<"
101
+ - - "~>"
129
102
  - !ruby/object:Gem::Version
130
- version: '4.0'
103
+ version: '3.1'
131
104
  type: :runtime
132
105
  prerelease: false
133
106
  version_requirements: !ruby/object:Gem::Requirement
134
107
  requirements:
135
- - - ">="
136
- - !ruby/object:Gem::Version
137
- version: '2.2'
138
- - - "<"
108
+ - - "~>"
139
109
  - !ruby/object:Gem::Version
140
- version: '4.0'
110
+ version: '3.1'
141
111
  - !ruby/object:Gem::Dependency
142
112
  name: rdf-spec
143
113
  requirement: !ruby/object:Gem::Requirement
144
114
  requirements:
145
- - - ">="
146
- - !ruby/object:Gem::Version
147
- version: '2.2'
148
- - - "<"
115
+ - - "~>"
149
116
  - !ruby/object:Gem::Version
150
- version: '4.0'
117
+ version: '3.1'
151
118
  type: :development
152
119
  prerelease: false
153
120
  version_requirements: !ruby/object:Gem::Requirement
154
121
  requirements:
155
- - - ">="
156
- - !ruby/object:Gem::Version
157
- version: '2.2'
158
- - - "<"
122
+ - - "~>"
159
123
  - !ruby/object:Gem::Version
160
- version: '4.0'
124
+ version: '3.1'
161
125
  - !ruby/object:Gem::Dependency
162
126
  name: rdf-turtle
163
127
  requirement: !ruby/object:Gem::Requirement
164
128
  requirements:
165
- - - ">="
166
- - !ruby/object:Gem::Version
167
- version: '2.2'
168
- - - "<"
129
+ - - "~>"
169
130
  - !ruby/object:Gem::Version
170
- version: '4.0'
131
+ version: '3.1'
171
132
  type: :development
172
133
  prerelease: false
173
134
  version_requirements: !ruby/object:Gem::Requirement
174
135
  requirements:
175
- - - ">="
176
- - !ruby/object:Gem::Version
177
- version: '2.2'
178
- - - "<"
136
+ - - "~>"
179
137
  - !ruby/object:Gem::Version
180
- version: '4.0'
138
+ version: '3.1'
181
139
  - !ruby/object:Gem::Dependency
182
140
  name: rspec
183
141
  requirement: !ruby/object:Gem::Requirement
184
142
  requirements:
185
143
  - - "~>"
186
144
  - !ruby/object:Gem::Version
187
- version: '3.7'
145
+ version: '3.9'
188
146
  type: :development
189
147
  prerelease: false
190
148
  version_requirements: !ruby/object:Gem::Requirement
191
149
  requirements:
192
150
  - - "~>"
193
151
  - !ruby/object:Gem::Version
194
- version: '3.7'
152
+ version: '3.9'
195
153
  - !ruby/object:Gem::Dependency
196
154
  name: rspec-its
197
155
  requirement: !ruby/object:Gem::Requirement
198
156
  requirements:
199
157
  - - "~>"
200
158
  - !ruby/object:Gem::Version
201
- version: '1.2'
159
+ version: '1.3'
202
160
  type: :development
203
161
  prerelease: false
204
162
  version_requirements: !ruby/object:Gem::Requirement
205
163
  requirements:
206
164
  - - "~>"
207
165
  - !ruby/object:Gem::Version
208
- version: '1.2'
166
+ version: '1.3'
209
167
  - !ruby/object:Gem::Dependency
210
168
  name: yard
211
169
  requirement: !ruby/object:Gem::Requirement
212
170
  requirements:
213
171
  - - "~>"
214
172
  - !ruby/object:Gem::Version
215
- version: '0.9'
173
+ version: 0.9.20
216
174
  type: :development
217
175
  prerelease: false
218
176
  version_requirements: !ruby/object:Gem::Requirement
219
177
  requirements:
220
178
  - - "~>"
221
179
  - !ruby/object:Gem::Version
222
- version: '0.9'
180
+ version: 0.9.20
223
181
  description: Implements ShExC and ShEx JSON.
224
182
  email: public-rdf-ruby@w3.org
225
183
  executables: []
@@ -275,15 +233,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
275
233
  requirements:
276
234
  - - ">="
277
235
  - !ruby/object:Gem::Version
278
- version: 2.2.2
236
+ version: '2.4'
279
237
  required_rubygems_version: !ruby/object:Gem::Requirement
280
238
  requirements:
281
239
  - - ">="
282
240
  - !ruby/object:Gem::Version
283
241
  version: '0'
284
242
  requirements: []
285
- rubyforge_project: rdf
286
- rubygems_version: 2.6.14
243
+ rubygems_version: 3.0.6
287
244
  signing_key:
288
245
  specification_version: 4
289
246
  summary: Implementation of Shape Expressions (ShEx) for RDF.rb