shex 0.4.0 → 0.6.1

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: 96423cdff8bd77f2573ab32cd954d5217b2dfe20
4
- data.tar.gz: 510d72ce00605e864b37af848f39c54f19de96b8
2
+ SHA256:
3
+ metadata.gz: e10c5d06f3b45a96dc3f2437680bde6eb406fad42c44efce5102d2d763da3281
4
+ data.tar.gz: 70afaf45c7d88efb782e85d3de232ec48484d2d69683070920ab1b905e94d790
5
5
  SHA512:
6
- metadata.gz: 7af06418271fa283bf833b837b546a10870af1e6f60fea90099d8a75d8dc4097f1fce6c7800b0874b50efcddbafe97abe5e30888c51f1d97f62e46298b2c5e86
7
- data.tar.gz: 5c9a7e9c9f7373a64a4c0722edefb6d2c9c20e5a9aaad8920f539641ddca97d5499dec2d3c2f1aa719122405b381a2d52bf536f4bcabb71ea41702eafeb4aabc
6
+ metadata.gz: c5b825dd6fe24fc3ceaee231942756eecb30883650dfb67aa8ae590e5a089a795211b51afac134f8e8ed62161b6a2de13dd2e787da810fd05c771bd29af77481
7
+ data.tar.gz: 1f6c4189937468a6c0e7505a16f7e8f432beb8f308645c6ef96609f9e570eef30504fd5eac969f156bfd9f5cd95b814f51940b514dc4e024e32d084228e6a28d
data/AUTHORS CHANGED
@@ -1 +1 @@
1
- * Gregg Kellogg <gregg@kellogg-assoc.com>
1
+ * Gregg Kellogg <gregg@greggkellogg.net>
data/LICENSE CHANGED
@@ -21,4 +21,4 @@ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
21
  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
22
  OTHER DEALINGS IN THE SOFTWARE.
23
23
 
24
- For more information, please refer to <http://unlicense.org>
24
+ For more information, please refer to <https://unlicense.org>
data/README.md CHANGED
@@ -2,24 +2,25 @@
2
2
 
3
3
  This is a pure-Ruby library for working with the [Shape Expressions Language][ShExSpec] to validate the shape of [RDF][] graphs.
4
4
 
5
- <http://ruby-rdf.github.com/shex>
5
+ <https://ruby-rdf.github.com/shex>
6
6
 
7
- [![Gem Version](https://badge.fury.io/rb/shex.png)](http://badge.fury.io/rb/shex)
8
- [![Build Status](https://travis-ci.org/ruby-rdf/shex.png?branch=master)](http://travis-ci.org/ruby-rdf/shex)
7
+ [![Gem Version](https://badge.fury.io/rb/shex.png)](https://badge.fury.io/rb/shex)
8
+ [![Build Status](https://travis-ci.org/ruby-rdf/shex.png?branch=master)](https://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
 
14
15
  * 100% pure Ruby with minimal dependencies and no bloat.
15
16
  * Fully compatible with [ShEx][ShExSpec] specifications.
16
- * 100% free and unencumbered [public domain](http://unlicense.org/) software.
17
+ * 100% free and unencumbered [public domain](https://unlicense.org/) software.
17
18
 
18
19
  ## Description
19
20
 
20
21
  The ShEx gem implements a [ShEx][ShExSpec] Shape Expression engine.
21
22
 
22
- * `ShEx::Parser` parses ShExC and ShExJ formatted documents generating executable operators which can be serialized as [S-Expressions](http://en.wikipedia.org/wiki/S-expression).
23
+ * `ShEx::Parser` parses ShExC and ShExJ formatted documents generating executable operators which can be serialized as [S-Expressions](https://en.wikipedia.org/wiki/S-expression).
23
24
  * `ShEx::Algebra` executes operators against Any `RDF::Graph`, including compliant [RDF.rb][].
24
25
  * [Implementation Report](file.earl.html)
25
26
 
@@ -38,15 +39,15 @@ The ShEx gem implements a [ShEx][ShExSpec] Shape Expression engine.
38
39
  (doap:name;doap:description|dc:title;dc:description)+;
39
40
  doap:category*;
40
41
  doap:developer IRI;
41
- doap:implements [<https://shexspec.github.io/spec/>]
42
+ doap:implements [<http://shex.io/shex-semantics/>]
42
43
  }
43
44
  )
44
45
  graph = RDF::Graph.load("etc/doap.ttl")
45
46
  schema = ShEx.parse(shexc)
46
47
  map = {
47
- "http://rubygems.org/gems/shex" => "TestShape"
48
+ "https://rubygems.org/gems/shex" => "TestShape"
48
49
  }
49
- schema.satisfies?("http://rubygems.org/gems/shex", graph, map)
50
+ schema.satisfies?("https://rubygems.org/gems/shex", graph, map)
50
51
  # => true
51
52
  ### Validating a node using ShExJ
52
53
 
@@ -109,26 +110,26 @@ The ShEx gem implements a [ShEx][ShExSpec] Shape Expression engine.
109
110
  ]
110
111
  }
111
112
  ],
112
- "min": 1, "max": "*"
113
+ "min": 1, "max": -1
113
114
  },
114
115
  {
115
116
  "type": "TripleConstraint",
116
117
  "predicate": "http://usefulinc.com/ns/doap#category",
117
118
  "valueExpr": {"type": "NodeConstraint", "nodeKind": "iri"},
118
- "min": 0, "max": "*"
119
+ "min": 0, "max": -1
119
120
  },
120
121
  {
121
122
  "type": "TripleConstraint",
122
123
  "predicate": "http://usefulinc.com/ns/doap#developer",
123
124
  "valueExpr": {"type": "NodeConstraint", "nodeKind": "iri"},
124
- "min": 1, "max": "*"
125
+ "min": 1, "max": -1
125
126
  },
126
127
  {
127
128
  "type": "TripleConstraint",
128
129
  "predicate": "http://usefulinc.com/ns/doap#implements",
129
130
  "valueExpr": {
130
131
  "type": "NodeConstraint",
131
- "values": ["https://shexspec.github.io/spec/"]
132
+ "values": ["http://shex.io/shex-semantics/"]
132
133
  }
133
134
  }
134
135
  ]
@@ -138,12 +139,12 @@ The ShEx gem implements a [ShEx][ShExSpec] Shape Expression engine.
138
139
  })
139
140
  graph = RDF::Graph.load("etc/doap.ttl")
140
141
  schema = ShEx.parse(shexj, format: :shexj)
141
- map = {"http://rubygems.org/gems/shex" => "TestShape"}
142
- schema.satisfies?("http://rubygems.org/gems/shex", graph, map)
142
+ map = {"https://rubygems.org/gems/shex" => "TestShape"}
143
+ schema.satisfies?("https://rubygems.org/gems/shex", graph, map)
143
144
  # => true
144
145
 
145
146
  ## Extensions
146
- ShEx has an extension mechanism using [Semantic Actions](https://shexspec.github.io/spec/#semantic-actions). Extensions may be implemented in Ruby ShEx by sub-classing {ShEx::Extension} and implementing {ShEx::Extension#visit} and possibly {ShEx::Extension#initialize}, {ShEx::Extension#enter}, {ShEx::Extension#exit}, and {ShEx::Extension#close}. The `#visit` method will be called as part of the `#satisfies?` operation.
147
+ ShEx has an extension mechanism using [Semantic Actions](http://shex.io/shex-semantics/#semantic-actions). Extensions may be implemented in Ruby ShEx by sub-classing {ShEx::Extension} and implementing {ShEx::Extension#visit} and possibly {ShEx::Extension#initialize}, {ShEx::Extension#enter}, {ShEx::Extension#exit}, and {ShEx::Extension#close}. The `#visit` method will be called as part of the `#satisfies?` operation.
147
148
 
148
149
  require 'shex'
149
150
  class ShEx::Test < ShEx::Extension("http://shex.io/extensions/Test/")
@@ -164,9 +165,23 @@ The `#initialize` method is called when {ShEx::Algebra::Schema#execute} starts a
164
165
 
165
166
  To make sure your extension is found, make sure to require it before the shape is executed.
166
167
 
168
+ ## Command Line
169
+ When the `linkeddata` gem is installed, RDF.rb includes a `rdf` executable which acts as a wrapper to perform a number of different
170
+ operations on RDF files, including ShEx. The commands specific to ShEx is
171
+
172
+ * `shex`: Validate repository given shape
173
+
174
+ Using this command requires either a `shex-input` where the ShEx schema is URI encoded, or `shex`, which references a URI or file path to the schema. Other required options are `shape` and `focus`.
175
+
176
+ Example usage:
177
+
178
+ rdf shex https://raw.githubusercontent.com/ruby-rdf/shex/develop/etc/doap.ttl \
179
+ --schema https://raw.githubusercontent.com/ruby-rdf/shex/develop/etc/doap.shex \
180
+ --focus https://rubygems.org/gems/shex
181
+
167
182
  ## Documentation
168
183
 
169
- <http://rubydoc.info/github/ruby-rdf/shex>
184
+ <https://rubydoc.info/github/ruby-rdf/shex>
170
185
 
171
186
 
172
187
  ## Implementation Notes
@@ -178,12 +193,12 @@ The result of parsing either ShExC or ShExJ is the creation of a set of executab
178
193
 
179
194
  ## Dependencies
180
195
 
181
- * [Ruby](http://ruby-lang.org/) (>= 2.2.2)
182
- * [RDF.rb](http://rubygems.org/gems/rdf) (>= 2.2)
196
+ * [Ruby](https://ruby-lang.org/) (>= 2.4)
197
+ * [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.1)
183
198
 
184
199
  ## Installation
185
200
 
186
- The recommended installation method is via [RubyGems](http://rubygems.org/).
201
+ The recommended installation method is via [RubyGems](https://rubygems.org/).
187
202
  To install the latest official release of RDF.rb, do:
188
203
 
189
204
  % [sudo] gem install shex
@@ -197,21 +212,21 @@ To get a local working copy of the development repository, do:
197
212
  Alternatively, download the latest development version as a tarball as
198
213
  follows:
199
214
 
200
- % wget http://github.com/ruby-rdf/shex/tarball/master
215
+ % wget https://github.com/ruby-rdf/shex/tarball/master
201
216
 
202
217
  ## Resources
203
218
 
204
- * <http://rubydoc.info/github/ruby-rdf/shex>
205
- * <http://github.com/ruby-rdf/shex>
206
- * <http://rubygems.org/gems/shex>
219
+ * <https://rubydoc.info/github/ruby-rdf/shex>
220
+ * <https://github.com/ruby-rdf/shex>
221
+ * <https://rubygems.org/gems/shex>
207
222
 
208
223
  ## Mailing List
209
224
 
210
- * <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
225
+ * <https://lists.w3.org/Archives/Public/public-rdf-ruby/>
211
226
 
212
227
  ## Author
213
228
 
214
- * [Gregg Kellogg](http://github.com/gkellogg) - <http://greggkellogg.net/>
229
+ * [Gregg Kellogg](https://github.com/gkellogg) - <https://greggkellogg.net/>
215
230
 
216
231
  ## Contributing
217
232
 
@@ -235,9 +250,9 @@ This repository uses [Git Flow](https://github.com/nvie/gitflow) to mange develo
235
250
  ## License
236
251
 
237
252
  This is free and unencumbered public domain software. For more information,
238
- see <http://unlicense.org/> or the accompanying {file:LICENSE} file.
253
+ see <https://unlicense.org/> or the accompanying {file:LICENSE} file.
239
254
 
240
- [ShExSpec]: https://shexspec.github.io/spec/
241
- [RDF]: http://www.w3.org/RDF/
242
- [RDF.rb]: http://rubydoc.info/github/ruby-rdf/rdf
243
- [EBNF]: http://rubygems.org/gems/ebnf
255
+ [ShExSpec]: https://shex.io/shex-semantics/
256
+ [RDF]: https://www.w3.org/RDF/
257
+ [RDF.rb]: https://rubydoc.info/github/ruby-rdf/rdf
258
+ [EBNF]: https://rubygems.org/gems/ebnf
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.6.1
@@ -1,3 +1,4 @@
1
+ @base <https://rubygems.org/gems/shex> .
1
2
  @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
3
  @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
4
  @prefix dc: <http://purl.org/dc/terms/> .
@@ -7,27 +8,27 @@
7
8
  @prefix ex: <http://example.org/> .
8
9
  @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
9
10
 
10
- <http://rubygems.org/gems/shex> a doap:Project, earl:TestSubject, earl:Software ;
11
+ <https://rubygems.org/gems/shex> a doap:Project, earl:TestSubject, earl:Software ;
11
12
  doap:name "ShEx.rb" ;
12
- doap:homepage <http://ruby-rdf.github.com/shex> ;
13
- doap:license <http://creativecommons.org/licenses/publicdomain/> ;
13
+ doap:homepage <https://ruby-rdf.github.com/shex> ;
14
+ doap:license <https://unlicense.org/1.0/> ;
14
15
  doap:shortdesc "ShEx is a Shape Expression engine for Ruby."@en ;
15
16
  doap:description "ShEx is an Shape Expression engine for the RDF.rb library suite."@en ;
16
17
  doap:created "2016-12-09"^^xsd:date ;
17
18
  doap:programming-language "Ruby" ;
18
- doap:implements <https://shexspec.github.io/spec/> ;
19
+ doap:implements <http://shex.io/shex-semantics/> ;
19
20
  doap:category <http://dbpedia.org/resource/Resource_Description_Framework>,
20
21
  <http://dbpedia.org/resource/Ruby_(programming_language)> ;
21
- doap:download-page <http://rubygems.org/gems/shex> ;
22
- doap:mailing-list <http://lists.w3.org/Archives/Public/public-rdf-ruby/> ;
23
- doap:bug-database <http://github.com/ruby-rdf/shex/issues> ;
24
- doap:blog <http://greggkellogg.net/> ;
25
- doap:developer <http://greggkellogg.net/foaf#me> ;
26
- doap:maintainer <http://greggkellogg.net/foaf#me> ;
27
- doap:documenter <http://greggkellogg.net/foaf#me> ;
28
- foaf:maker <http://greggkellogg.net/foaf#me> ;
22
+ doap:download-page <https://rubygems.org/gems/shex> ;
23
+ doap:mailing-list <https://lists.w3.org/Archives/Public/public-rdf-ruby/> ;
24
+ doap:bug-database <https://github.com/ruby-rdf/shex/issues> ;
25
+ doap:blog <https://greggkellogg.net/> ;
26
+ doap:developer <https://greggkellogg.net/foaf#me> ;
27
+ doap:maintainer <https://greggkellogg.net/foaf#me> ;
28
+ doap:documenter <https://greggkellogg.net/foaf#me> ;
29
+ foaf:maker <https://greggkellogg.net/foaf#me> ;
29
30
  dc:title "ShEx.rb" ;
30
31
  dc:description "ShEx is an Shape Expression engine for the RDF.rb library suite."@en ;
31
32
  dc:date "2016-12-09"^^xsd:date ;
32
- dc:creator <http://greggkellogg.net/foaf#me> ;
33
- dc:isPartOf <http://rubygems.org/gems/rdf> .
33
+ dc:creator <https://greggkellogg.net/foaf#me> ;
34
+ dc:isPartOf <https://rubygems.org/gems/rdf> .
@@ -1,8 +1,9 @@
1
1
  ##
2
2
  # A ShEx runtime for RDF.rb.
3
3
  #
4
- # @see https://shexspec.github.io/spec/#shexc
4
+ # @see https://shex.io/shex-semantics/#shexc
5
5
  module ShEx
6
+ require 'shex/format'
6
7
  autoload :Algebra, 'shex/algebra'
7
8
  autoload :Meta, 'shex/meta'
8
9
  autoload :Parser, 'shex/parser'
@@ -11,7 +12,7 @@ module ShEx
11
12
  autoload :VERSION, 'shex/version'
12
13
 
13
14
  # Location of the ShEx JSON-LD context
14
- CONTEXT = "https://shexspec.github.io/context.jsonld"
15
+ CONTEXT = "http://www.w3.org/ns/shex.jsonld"
15
16
 
16
17
  # Extensions defined in this gem
17
18
  EXTENSIONS = %w{test}
@@ -32,13 +33,13 @@ module ShEx
32
33
  # @raise (see ShEx::Parser#parse)
33
34
  def self.parse(expression, format: 'shexc', **options)
34
35
  case format.to_s
35
- when 'shexc' then Parser.new(expression, options).parse
36
+ when 'shexc' then Parser.new(expression, **options).parse
36
37
  when 'shexj'
37
38
  expression = expression.read if expression.respond_to?(:read)
38
- Algebra.from_shexj(JSON.parse(expression), options)
39
+ Algebra.from_shexj(JSON.parse(expression), **options)
39
40
  when 'sxp'
40
41
  expression = expression.read if expression.respond_to?(:read)
41
- Algebra.from_sxp(expression, options)
42
+ Algebra.from_sxp(expression, **options)
42
43
  else raise "Unknown expression format: #{format.inspect}"
43
44
  end
44
45
  end
@@ -55,8 +56,8 @@ module ShEx
55
56
  # @return (see ShEx::Parser#parse)
56
57
  # @raise (see ShEx::Parser#parse)
57
58
  def self.open(filename, format: 'shexc', **options, &block)
58
- RDF::Util::File.open_file(filename, options) do |file|
59
- self.parse(file, options.merge(format: format))
59
+ RDF::Util::File.open_file(filename, **options) do |file|
60
+ self.parse(file, format: format, **options)
60
61
  end
61
62
  end
62
63
 
@@ -65,17 +66,17 @@ module ShEx
65
66
  #
66
67
  # @example executing a ShExC schema
67
68
  # graph = RDF::Graph.load("etc/doap.ttl")
68
- # ShEx.execute('etc/doap.shex', graph, "http://rubygems.org/gems/shex", "")
69
+ # ShEx.execute('etc/doap.shex', graph, "https://rubygems.org/gems/shex", "")
69
70
  #
70
71
  # @param [IO, StringIO, String, #to_s] expression (ShExC or ShExJ)
71
72
  # @param (see ShEx::Algebra::Schema#execute)
72
73
  # @return (see ShEx::Algebra::Schema#execute)
73
74
  # @raise (see ShEx::Algebra::Schema#execute)
74
- def self.execute(expression, queryable, focus, shape, format: 'shexc', **options)
75
- shex = self.parse(expression, options.merge(format: format))
75
+ def self.execute(expression, queryable, map, format: 'shexc', **options)
76
+ shex = self.parse(expression, format: format, **options)
76
77
  queryable = queryable || RDF::Graph.new
77
78
 
78
- shex.execute(focus, queryable, {focus => shape}, options)
79
+ shex.execute(queryable, map, **options)
79
80
  end
80
81
 
81
82
  ##
@@ -83,17 +84,17 @@ module ShEx
83
84
  #
84
85
  # @example executing a ShExC schema
85
86
  # graph = RDF::Graph.load("etc/doap.ttl")
86
- # ShEx.execute('etc/doap.shex', graph, "http://rubygems.org/gems/shex", "")
87
+ # ShEx.execute('etc/doap.shex', graph, "https://rubygems.org/gems/shex", "")
87
88
  #
88
89
  # @param [IO, StringIO, String, #to_s] expression (ShExC or ShExJ)
89
90
  # @param (see ShEx::Algebra::Schema#satisfies?)
90
91
  # @return (see ShEx::Algebra::Schema#satisfies?)
91
92
  # @raise (see ShEx::Algebra::Schema#satisfies?)
92
- def self.satisfies?(expression, queryable, focus, shape, format: 'shexc', **options)
93
- shex = self.parse(expression, options.merge(format: format))
93
+ def self.satisfies?(expression, queryable, map, format: 'shexc', **options)
94
+ shex = self.parse(expression, format: format, **options)
94
95
  queryable = queryable || RDF::Graph.new
95
96
 
96
- shex.satisfies?(focus, queryable, {focus => shape}, options)
97
+ shex.satisfies?(queryable, map, **options)
97
98
  end
98
99
 
99
100
  ##
@@ -115,7 +116,7 @@ module ShEx
115
116
  # @param [String, #to_s] message
116
117
  # @param [Hash{Symbol => Object}] options
117
118
  # @option options [Integer] :code (422)
118
- def initialize(message, options = {})
119
+ def initialize(message, **options)
119
120
  @code = options.fetch(:status_code, 422)
120
121
  super(message.to_s)
121
122
  end
@@ -129,14 +130,14 @@ module ShEx
129
130
  class NotSatisfied < Error
130
131
  ##
131
132
  # The expression which was not satified
132
- # @return [ShEx::Satisfiable]
133
+ # @return [ShEx::Algebra::ShapeExpression]
133
134
  attr_reader :expression
134
135
 
135
136
  ##
136
137
  # Initializes a new parser error instance.
137
138
  #
138
- # @param [String, #to_s] message
139
- # @param [Satisfiable] expression (self)
139
+ # @param [String, #to_s] message
140
+ # @param [ShEx::Algebra::ShapeExpression] expression
140
141
  def initialize(message, expression: self)
141
142
  @expression = expression
142
143
  super(message.to_s)
@@ -157,8 +158,8 @@ module ShEx
157
158
  ##
158
159
  # Initializes a new parser error instance.
159
160
  #
160
- # @param [String, #to_s] message
161
- # @param [Satisfiable] expression (self)
161
+ # @param [String, #to_s] message
162
+ # @param [ShEx::Algebra::TripleExpression] expression
162
163
  def initialize(message, expression: self)
163
164
  @expression = expression
164
165
  super(message.to_s)
@@ -5,27 +5,34 @@ require 'sxp'
5
5
  module ShEx
6
6
  # Based on the SPARQL Algebra, operators for executing a patch
7
7
  #
8
- # @author [Gregg Kellogg](http://greggkellogg.net/)
8
+ # @author [Gregg Kellogg](https://greggkellogg.net/)
9
9
  module Algebra
10
- autoload :And, 'shex/algebra/and'
11
- autoload :Annotation, 'shex/algebra/annotation'
12
- autoload :EachOf, 'shex/algebra/each_of'
13
- autoload :External, 'shex/algebra/external'
14
- autoload :Not, 'shex/algebra/not'
15
- autoload :NodeConstraint, 'shex/algebra/node_constraint'
16
- autoload :OneOf, 'shex/algebra/one_of'
17
- autoload :Operator, 'shex/algebra/operator'
18
- autoload :Or, 'shex/algebra/or'
19
- autoload :Schema, 'shex/algebra/schema'
20
- autoload :SemAct, 'shex/algebra/semact'
21
- autoload :ShapeExpression, 'shex/algebra/shape_expression'
22
- autoload :Shape, 'shex/algebra/shape'
23
- autoload :Start, 'shex/algebra/start'
24
- autoload :Stem, 'shex/algebra/stem'
25
- autoload :StemRange, 'shex/algebra/stem_range'
10
+ autoload :And, 'shex/algebra/and'
11
+ autoload :Annotation, 'shex/algebra/annotation'
12
+ autoload :EachOf, 'shex/algebra/each_of'
13
+ autoload :External, 'shex/algebra/external'
14
+ autoload :IriStem, 'shex/algebra/stem'
15
+ autoload :IriStemRange, 'shex/algebra/stem_range'
16
+ autoload :Language, 'shex/algebra/language'
17
+ autoload :LanguageStem, 'shex/algebra/stem'
18
+ autoload :LanguageStemRange,'shex/algebra/stem_range'
19
+ autoload :LiteralStem, 'shex/algebra/stem'
20
+ autoload :LiteralStemRange, 'shex/algebra/stem_range'
21
+ autoload :NodeConstraint, 'shex/algebra/node_constraint'
22
+ autoload :Not, 'shex/algebra/not'
23
+ autoload :OneOf, 'shex/algebra/one_of'
24
+ autoload :Operator, 'shex/algebra/operator'
25
+ autoload :Or, 'shex/algebra/or'
26
+ autoload :Schema, 'shex/algebra/schema'
27
+ autoload :SemAct, 'shex/algebra/semact'
28
+ autoload :Shape, 'shex/algebra/shape'
29
+ autoload :ShapeExpression, 'shex/algebra/shape_expression'
30
+ autoload :Start, 'shex/algebra/start'
31
+ autoload :Stem, 'shex/algebra/stem'
32
+ autoload :StemRange, 'shex/algebra/stem_range'
26
33
  autoload :TripleConstraint, 'shex/algebra/triple_constraint'
27
34
  autoload :TripleExpression, 'shex/algebra/triple_expression'
28
- autoload :Value, 'shex/algebra/value'
35
+ autoload :Value, 'shex/algebra/value'
29
36
 
30
37
 
31
38
  ##
@@ -43,28 +50,33 @@ module ShEx
43
50
  # @option options [RDF::URI] :base
44
51
  # @option options [Hash{String => RDF::URI}] :prefixes
45
52
  # @return [Operator]
46
- def self.from_shexj(operator, options = {})
53
+ def self.from_shexj(operator, **options)
47
54
  raise ArgumentError unless operator.is_a?(Hash)
48
55
  klass = case operator['type']
49
- when 'Annotation' then Annotation
50
- when 'EachOf' then EachOf
51
- when 'NodeConstraint' then NodeConstraint
52
- when 'OneOf' then OneOf
53
- when 'Schema' then Schema
54
- when 'SemAct' then SemAct
55
- when 'Shape' then Shape
56
- when 'ShapeAnd' then And
57
- when 'ShapeExternal' then External
58
- when 'ShapeNot' then Not
59
- when 'ShapeOr' then Or
60
- when 'Stem' then Stem
61
- when 'StemRange' then StemRange
62
- when 'TripleConstraint' then TripleConstraint
63
- when 'Wildcard' then StemRange
64
- else raise ArgumentError, "unknown type #{operator['type']}"
56
+ when 'Annotation' then Annotation
57
+ when 'EachOf' then EachOf
58
+ when 'IriStem' then IriStem
59
+ when 'IriStemRange' then IriStemRange
60
+ when 'Language' then Language
61
+ when 'LanguageStem' then LanguageStem
62
+ when 'LanguageStemRange' then LanguageStemRange
63
+ when 'LiteralStem' then LiteralStem
64
+ when 'LiteralStemRange' then LiteralStemRange
65
+ when 'NodeConstraint' then NodeConstraint
66
+ when 'OneOf' then OneOf
67
+ when 'Schema' then Schema
68
+ when 'SemAct' then SemAct
69
+ when 'Shape' then Shape
70
+ when 'ShapeAnd' then And
71
+ when 'ShapeExternal' then External
72
+ when 'ShapeNot' then Not
73
+ when 'ShapeOr' then Or
74
+ when 'TripleConstraint' then TripleConstraint
75
+ when 'Wildcard' then StemRange
76
+ else raise ArgumentError, "unknown type #{operator['type'].inspect}"
65
77
  end
66
78
 
67
- klass.from_shexj(operator, options)
79
+ klass.from_shexj(operator, **options)
68
80
  end
69
81
  end
70
82
  end