shex 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -8
- data/VERSION +1 -1
- data/etc/doap.ttl +3 -5
- data/lib/shex/algebra/operator.rb +1 -1
- data/lib/shex/algebra/shape.rb +2 -2
- data/lib/shex/format.rb +2 -2
- data/lib/shex/parser.rb +11 -11
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d91d9cf7282456c7a61fba4c17609eda22851232c5bfe7be75518c0bb1ea354
|
4
|
+
data.tar.gz: b465b287f74cd1efaa8788ad80a9a0e4ee78e89d6a8ea061445de526f8b78edf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 695c099ae0fb5899086f50296293610c3f6f1a82a361ed5da953fd1495cc38a538a26048fcdf8b329a6313e7e81abd1e102883523ad12c3b5e360cdcee0686df
|
7
|
+
data.tar.gz: 7dd2fe93e6cf93b1afca58d09d79ea318d71314759e0b790b524fe58fdee7bd5954d2950ea67cee69b1953b25bc612d54a9a6bcb0b7ef74c0061555f61f68700
|
data/README.md
CHANGED
@@ -2,12 +2,10 @@
|
|
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
|
-
<https://ruby-rdf.github.com/shex>
|
6
|
-
|
7
5
|
[![Gem Version](https://badge.fury.io/rb/shex.png)](https://badge.fury.io/rb/shex)
|
8
|
-
[![Build Status](https://
|
9
|
-
[![Coverage Status](https://coveralls.io/repos/ruby-rdf/shex/badge.svg)](https://coveralls.io/
|
10
|
-
[![
|
6
|
+
[![Build Status](https://github.com/ruby-rdf/shex/workflows/CI/badge.svg?branch=develop)](https://github.com/ruby-rdf/shex/actions?query=workflow%3ACI)
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/ruby-rdf/shex/badge.svg?branch=develop)](https://coveralls.io/github/ruby-rdf/shex?branch=develop)
|
8
|
+
[![Gitter chat](https://badges.gitter.im/ruby-rdf/rdf.png)](https://gitter.im/ruby-rdf/rdf)
|
11
9
|
[![DOI](https://zenodo.org/badge/74419330.svg)](https://zenodo.org/badge/latestdoi/74419330)
|
12
10
|
|
13
11
|
## Features
|
@@ -18,7 +16,7 @@ This is a pure-Ruby library for working with the [Shape Expressions Language][Sh
|
|
18
16
|
|
19
17
|
## Description
|
20
18
|
|
21
|
-
The ShEx gem implements a [ShEx][ShExSpec] Shape Expression engine.
|
19
|
+
The ShEx gem implements a [ShEx][ShExSpec] Shape Expression engine version 2.0.
|
22
20
|
|
23
21
|
* `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).
|
24
22
|
* `ShEx::Algebra` executes operators against Any `RDF::Graph`, including compliant [RDF.rb][].
|
@@ -195,6 +193,7 @@ The result of parsing either ShExC or ShExJ is the creation of a set of executab
|
|
195
193
|
|
196
194
|
* [Ruby](https://ruby-lang.org/) (>= 2.4)
|
197
195
|
* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.1)
|
196
|
+
* [SPARQL gem](https://rubygems.org/gems/sparql) (~> 3.1)
|
198
197
|
|
199
198
|
## Installation
|
200
199
|
|
@@ -245,14 +244,19 @@ This repository uses [Git Flow](https://github.com/nvie/gitflow) to mange develo
|
|
245
244
|
enough, be assured we will eventually add you in there.
|
246
245
|
* Do note that in order for us to merge any non-trivial changes (as a rule
|
247
246
|
of thumb, additions larger than about 15 lines of code), we need an
|
248
|
-
explicit [public domain dedication][PDD] on record from you
|
247
|
+
explicit [public domain dedication][PDD] on record from you,
|
248
|
+
which you will be asked to agree to on the first commit to a repo within the organization.
|
249
|
+
Note that the agreement applies to all repos in the [Ruby RDF](https://github.com/ruby-rdf/) organization.
|
249
250
|
|
250
251
|
## License
|
251
252
|
|
252
253
|
This is free and unencumbered public domain software. For more information,
|
253
254
|
see <https://unlicense.org/> or the accompanying {file:LICENSE} file.
|
254
255
|
|
255
|
-
[ShExSpec]:
|
256
|
+
[ShExSpec]: http://shex.io/shex-semantics-20170713/
|
256
257
|
[RDF]: https://www.w3.org/RDF/
|
257
258
|
[RDF.rb]: https://rubydoc.info/github/ruby-rdf/rdf
|
258
259
|
[EBNF]: https://rubygems.org/gems/ebnf
|
260
|
+
[YARD]: https://yardoc.org/
|
261
|
+
[YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
|
262
|
+
[PDD]: https://unlicense.org/#unlicensing-contributions
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.2
|
data/etc/doap.ttl
CHANGED
@@ -9,11 +9,11 @@
|
|
9
9
|
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
10
10
|
|
11
11
|
<https://rubygems.org/gems/shex> a doap:Project, earl:TestSubject, earl:Software ;
|
12
|
-
doap:name "ShEx
|
12
|
+
doap:name "ShEx" ;
|
13
13
|
doap:homepage <https://ruby-rdf.github.com/shex> ;
|
14
14
|
doap:license <https://unlicense.org/1.0/> ;
|
15
|
-
doap:shortdesc "ShEx is a Shape Expression engine for Ruby."@en ;
|
16
|
-
doap:description "ShEx is an Shape Expression engine for the RDF.rb library suite."@en ;
|
15
|
+
doap:shortdesc "ShEx is a Shape Expression engine for Ruby RDF.rb."@en ;
|
16
|
+
doap:description "ShEx is an Shape Expression engine for the Ruby RDF.rb library suite."@en ;
|
17
17
|
doap:created "2016-12-09"^^xsd:date ;
|
18
18
|
doap:programming-language "Ruby" ;
|
19
19
|
doap:implements <http://shex.io/shex-semantics/> ;
|
@@ -27,8 +27,6 @@
|
|
27
27
|
doap:maintainer <https://greggkellogg.net/foaf#me> ;
|
28
28
|
doap:documenter <https://greggkellogg.net/foaf#me> ;
|
29
29
|
foaf:maker <https://greggkellogg.net/foaf#me> ;
|
30
|
-
dc:title "ShEx.rb" ;
|
31
|
-
dc:description "ShEx is an Shape Expression engine for the RDF.rb library suite."@en ;
|
32
30
|
dc:date "2016-12-09"^^xsd:date ;
|
33
31
|
dc:creator <https://greggkellogg.net/foaf#me> ;
|
34
32
|
dc:isPartOf <https://rubygems.org/gems/rdf> .
|
data/lib/shex/algebra/shape.rb
CHANGED
@@ -36,8 +36,8 @@ module ShEx::Algebra
|
|
36
36
|
# neigh(G, n) is the neighbourhood of the node n in the graph G.
|
37
37
|
#
|
38
38
|
# neigh(G, n) = arcsOut(G, n) ∪ arcsIn(G, n)
|
39
|
-
arcs_in = schema.graph.query(object: focus).to_a.sort_by(&:to_sxp)
|
40
|
-
arcs_out = schema.graph.query(subject: focus).to_a.sort_by(&:to_sxp)
|
39
|
+
arcs_in = schema.graph.query({object: focus}).to_a.sort_by(&:to_sxp)
|
40
|
+
arcs_out = schema.graph.query({subject: focus}).to_a.sort_by(&:to_sxp)
|
41
41
|
neigh = (arcs_in + arcs_out).uniq
|
42
42
|
|
43
43
|
# `matched` is the subset of statements which match `expression`.
|
data/lib/shex/format.rb
CHANGED
@@ -4,8 +4,8 @@ module ShEx
|
|
4
4
|
##
|
5
5
|
# ShEx format specification. Note that this format does not define any readers or writers.
|
6
6
|
#
|
7
|
-
# @example Obtaining an
|
8
|
-
# RDF::Format.for(:shex) #=>
|
7
|
+
# @example Obtaining an ShEx format class
|
8
|
+
# RDF::Format.for(:shex) #=> ShEx::Format
|
9
9
|
# RDF::Format.for("etc/foaf.shex")
|
10
10
|
# RDF::Format.for(file_name: "etc/foaf.shex")
|
11
11
|
# RDF::Format.for(file_extension: "shex")
|
data/lib/shex/parser.rb
CHANGED
@@ -256,7 +256,7 @@ module ShEx
|
|
256
256
|
def shape_or(input, data)
|
257
257
|
input.merge!(data.dup.keep_if {|k, v| [:closed, :extraPropertySet, :codeDecl].include?(k)})
|
258
258
|
expression = if Array(data[:shapeExpression]).length > 1
|
259
|
-
Algebra::Or.new(*data[:shapeExpression]
|
259
|
+
Algebra::Or.new(*data[:shapeExpression])
|
260
260
|
else
|
261
261
|
Array(data[:shapeExpression]).first
|
262
262
|
end
|
@@ -282,7 +282,7 @@ module ShEx
|
|
282
282
|
end
|
283
283
|
|
284
284
|
expression = if expressions.length > 1
|
285
|
-
Algebra::And.new(*expressions
|
285
|
+
Algebra::And.new(*expressions)
|
286
286
|
else
|
287
287
|
expressions.first
|
288
288
|
end
|
@@ -341,7 +341,7 @@ module ShEx
|
|
341
341
|
expression = case expression.length
|
342
342
|
when 0 then nil
|
343
343
|
when 1 then expression.first
|
344
|
-
else Algebra::And.new(*expression
|
344
|
+
else Algebra::And.new(*expression)
|
345
345
|
end
|
346
346
|
|
347
347
|
(input[:shapeExpression] ||= []) << expression if expression
|
@@ -389,7 +389,7 @@ module ShEx
|
|
389
389
|
attrs += Array(data[:numericFacet])
|
390
390
|
attrs += Array(data[:stringFacet])
|
391
391
|
|
392
|
-
input[:nodeConstraint] = Algebra::NodeConstraint.new(*attrs.compact
|
392
|
+
input[:nodeConstraint] = Algebra::NodeConstraint.new(*attrs.compact)
|
393
393
|
end
|
394
394
|
|
395
395
|
# [25] nonLitNodeConstraint ::= nonLiteralKind stringFacet*
|
@@ -401,7 +401,7 @@ module ShEx
|
|
401
401
|
attrs += Array(data[:nonLiteralKind])
|
402
402
|
attrs += Array(data[:stringFacet])
|
403
403
|
|
404
|
-
input[:nodeConstraint] = Algebra::NodeConstraint.new(*attrs.compact
|
404
|
+
input[:nodeConstraint] = Algebra::NodeConstraint.new(*attrs.compact)
|
405
405
|
end
|
406
406
|
|
407
407
|
# [26] nonLiteralKind ::= "IRI" | "BNODE" | "NONLITERAL"
|
@@ -469,7 +469,7 @@ module ShEx
|
|
469
469
|
attrs += Array(data[:annotation])
|
470
470
|
attrs += Array(data[:codeDecl])
|
471
471
|
|
472
|
-
input[:shape] = Algebra::Shape.new(*attrs
|
472
|
+
input[:shape] = Algebra::Shape.new(*attrs)
|
473
473
|
end
|
474
474
|
private :shape_definition
|
475
475
|
|
@@ -482,7 +482,7 @@ module ShEx
|
|
482
482
|
# [37] oneOfTripleExpr ::= groupTripleExpr ('|' groupTripleExpr)*
|
483
483
|
production(:oneOfTripleExpr) do |input, data, callback|
|
484
484
|
expression = if Array(data[:tripleExpression]).length > 1
|
485
|
-
Algebra::OneOf.new(*data[:tripleExpression]
|
485
|
+
Algebra::OneOf.new(*data[:tripleExpression])
|
486
486
|
else
|
487
487
|
Array(data[:tripleExpression]).first
|
488
488
|
end
|
@@ -492,7 +492,7 @@ module ShEx
|
|
492
492
|
# [40] groupTripleExpr ::= unaryTripleExpr (';' unaryTripleExpr?)*
|
493
493
|
production(:groupTripleExpr) do |input, data, callback|
|
494
494
|
expression = if Array(data[:tripleExpression]).length > 1
|
495
|
-
Algebra::EachOf.new(*data[:tripleExpression]
|
495
|
+
Algebra::EachOf.new(*data[:tripleExpression])
|
496
496
|
else
|
497
497
|
Array(data[:tripleExpression]).first
|
498
498
|
end
|
@@ -545,7 +545,7 @@ module ShEx
|
|
545
545
|
attrs += Array(data[:codeDecl])
|
546
546
|
attrs += Array(data[:annotation])
|
547
547
|
|
548
|
-
input[:tripleExpression] = Algebra::TripleConstraint.new(*attrs
|
548
|
+
input[:tripleExpression] = Algebra::TripleConstraint.new(*attrs) unless attrs.empty?
|
549
549
|
end
|
550
550
|
|
551
551
|
# [46] cardinality ::= '*' | '+' | '?' | REPEAT_RANGE
|
@@ -666,7 +666,7 @@ module ShEx
|
|
666
666
|
|
667
667
|
# [60] codeDecl ::= '%' iri (CODE | "%")
|
668
668
|
production(:codeDecl) do |input, data, callback|
|
669
|
-
(input[:codeDecl] ||= []) << Algebra::SemAct.new(*[data[:iri], data[:code]].compact
|
669
|
+
(input[:codeDecl] ||= []) << Algebra::SemAct.new(*[data[:iri], data[:code]].compact)
|
670
670
|
end
|
671
671
|
|
672
672
|
# [13t] literal ::= rdfLiteral | numericLiteral | booleanLiteral
|
@@ -941,7 +941,7 @@ module ShEx
|
|
941
941
|
"options: #{options.inspect}, " +
|
942
942
|
"validate: #{validate?.inspect}, "
|
943
943
|
end
|
944
|
-
RDF::Literal.new(value, options.merge(validate: validate?))
|
944
|
+
RDF::Literal.new(value, **options.merge(validate: validate?))
|
945
945
|
end
|
946
946
|
end # class Parser
|
947
947
|
end # module ShEx
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
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-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2.
|
61
|
+
version: '2.1'
|
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: '2.
|
68
|
+
version: '2.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sxp
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '3.
|
145
|
+
version: '3.10'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '3.
|
152
|
+
version: '3.10'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rspec-its
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.9
|
173
|
+
version: '0.9'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.9
|
180
|
+
version: '0.9'
|
181
181
|
description: Implements ShExC and ShEx JSON.
|
182
182
|
email: public-rdf-ruby@w3.org
|
183
183
|
executables: []
|
@@ -225,7 +225,7 @@ licenses:
|
|
225
225
|
- Unlicense
|
226
226
|
metadata:
|
227
227
|
yard.run: yri
|
228
|
-
post_install_message:
|
228
|
+
post_install_message:
|
229
229
|
rdoc_options: []
|
230
230
|
require_paths:
|
231
231
|
- lib
|
@@ -240,8 +240,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
240
|
- !ruby/object:Gem::Version
|
241
241
|
version: '0'
|
242
242
|
requirements: []
|
243
|
-
rubygems_version: 3.
|
244
|
-
signing_key:
|
243
|
+
rubygems_version: 3.2.15
|
244
|
+
signing_key:
|
245
245
|
specification_version: 4
|
246
246
|
summary: Implementation of Shape Expressions (ShEx) for RDF.rb
|
247
247
|
test_files: []
|