shacl 0.1.0 → 0.1.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
  SHA256:
3
- metadata.gz: bfd8b2e322078d6c7126673e51557abbc932f0d73adf40746993fe17dc37b052
4
- data.tar.gz: 9bdf6b6f5c5a5690021dc1ce567a0ef38b5fee7246ac25b04d8333de8e1736ca
3
+ metadata.gz: 3b8c0531333caf832e7bc49672c567cae4444736c389c569069b0abc24921a80
4
+ data.tar.gz: ba80d251ecbe6168a4f8aec684381a9c5121d35473c6b6a7ef5a521ec91873fe
5
5
  SHA512:
6
- metadata.gz: 41394099ad2f1f10a36ba2e6d47412c214194ece2310388fcbf5981f91e8aaa5be05db05a15bdbadf4895f33c17aa815c96b65eda387f0cc052a3e56ad01c144
7
- data.tar.gz: 795668e35a3493338b45c0e9021bd23a8b5901fe930f8365f3676ee3ab1dd6bd5ee3efb456ae3c3673e475f3ac53850dd7c107d6c11a84ccb294f33966082a53
6
+ metadata.gz: e4b437531b70b4e58802aabcc01cde88dee8297e54df9971400c0a7cb816d119f39848afcaa06fb5b295fa606383ab92b2dd3c41a624fea6c81f20897be13c09
7
+ data.tar.gz: 346ad2a174f973879e93b0b61890a0a1694673b8f9e104f4efda68781ca9337a0ba7fbc3e04f43ee8db172ce731791fffaeb54e6f3dfc6ff0d96d7d972258a12
data/README.md CHANGED
@@ -4,7 +4,7 @@ This is a pure-Ruby library for working with the [Shape Constraint Language][SHA
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/shacl.png)](https://badge.fury.io/rb/shacl)
6
6
  [![Build Status](https://github.com/ruby-rdf/shacl/workflows/CI/badge.svg?branch=develop)](https://github.com/ruby-rdf/shacl/actions?query=workflow%3ACI)
7
- [![Coverage Status](https://coveralls.io/repos/ruby-rdf/shacl/badge.svg)](https://coveralls.io/github/ruby-rdf/shacl)
7
+ [![Coverage Status](https://coveralls.io/repos/github/ruby-rdf/shacl/badge.svg?branch=develop)](https://coveralls.io/github/ruby-rdf/shacl?branch=develop)
8
8
  [![Gitter chat](https://badges.gitter.im/ruby-rdf/rdf.png)](https://gitter.im/ruby-rdf/rdf)
9
9
 
10
10
  ## Features
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/etc/doap.ttl CHANGED
@@ -10,11 +10,11 @@
10
10
 
11
11
  <https://rubygems.org/gems/shacl> a doap:Project, earl:TestSubject, earl:Software ;
12
12
  sh:shapesGraph <doap-shacl.ttl>;
13
- doap:name "Ruby SHACL" ;
13
+ doap:name "SHACL" ;
14
14
  doap:homepage <https://ruby-rdf.github.com/shacl> ;
15
15
  doap:license <https://unlicense.org/1.0/> ;
16
- doap:shortdesc "shacl is a Shapes Constraint engine for Ruby."@en ;
17
- doap:description "shacl is an Shape Constraint engine for the RDF.rb library suite."@en ;
16
+ doap:shortdesc "SHACL is a Shapes Constraint engine for Ruby."@en ;
17
+ doap:description "SHACL is a Shape Constraint engine for the Ruby RDF.rb library suite."@en ;
18
18
  doap:created "2020-11-26"^^xsd:date ;
19
19
  doap:programming-language "Ruby" ;
20
20
  doap:implements <https://www.w3.org/TR/shacl/> ;
@@ -28,8 +28,5 @@
28
28
  doap:maintainer <https://greggkellogg.net/foaf#me> ;
29
29
  doap:documenter <https://greggkellogg.net/foaf#me> ;
30
30
  foaf:maker <https://greggkellogg.net/foaf#me> ;
31
- dc:title "Ruby SHACL" ;
32
- dc:description "shacl is an Shape Constraint engine for the RDF.rb library suite."@en ;
33
- dc:date "2020-11-26"^^xsd:date ;
34
31
  dc:creator <https://greggkellogg.net/foaf#me> ;
35
32
  dc:isPartOf <https://rubygems.org/gems/rdf> .
@@ -43,7 +43,7 @@ module SHACL::Algebra
43
43
  shape_properties = shape_paths.select {|p| p.is_a?(RDF::URI)}
44
44
  shape_properties += Array(@options[:ignoredProperties])
45
45
 
46
- closed_results = graph.query(subject: node).map do |statement|
46
+ closed_results = graph.query({subject: node}).map do |statement|
47
47
  next if shape_properties.include?(statement.predicate)
48
48
  not_satisfied(focus: node,
49
49
  value: statement.object,
@@ -35,7 +35,7 @@ module SHACL::Algebra
35
35
 
36
36
  # Turn the `path` attribute into a SPARQL Property Path and evaluate to find related nodes.
37
37
  value_nodes = if path.is_a?(RDF::URI)
38
- graph.query(subject: node, predicate: path).objects
38
+ graph.query({subject: node, predicate: path}).objects
39
39
  elsif path.evaluatable?
40
40
  path.execute(graph,
41
41
  subject: node,
@@ -100,7 +100,7 @@ module SHACL::Algebra
100
100
  # @param [Array<RDF::Term>] value_nodes
101
101
  # @return [Array<SHACL::ValidationResult>]
102
102
  def builtin_lessThan(property, node, path, value_nodes, **options)
103
- terms = graph.query(subject: node, predicate: property).objects
103
+ terms = graph.query({subject: node, predicate: property}).objects
104
104
  compare(:<, terms, node, path, value_nodes,
105
105
  RDF::Vocab::SHACL.LessThanConstraintComponent, **options)
106
106
  end
@@ -113,7 +113,7 @@ module SHACL::Algebra
113
113
  # @param [Array<RDF::Term>] value_nodes
114
114
  # @return [Array<SHACL::ValidationResult>]
115
115
  def builtin_lessThanOrEquals(property, node, path, value_nodes, **options)
116
- terms = graph.query(subject: node, predicate: property).objects
116
+ terms = graph.query({subject: node, predicate: property}).objects
117
117
  compare(:<=, terms, node, path, value_nodes,
118
118
  RDF::Vocab::SHACL.LessThanOrEqualsConstraintComponent, **options)
119
119
  end
@@ -15,16 +15,16 @@ module SHACL::Algebra
15
15
  def targetNodes
16
16
  (Array(@options[:targetNode]) +
17
17
  Array(@options[:targetClass]).map do |cls|
18
- graph.query(predicate: RDF.type, object: cls).subjects
18
+ graph.query({predicate: RDF.type, object: cls}).subjects
19
19
  end +
20
20
  Array(@options[:targetSubjectsOf]).map do |pred|
21
- graph.query(predicate: pred).subjects
21
+ graph.query({predicate: pred}).subjects
22
22
  end +
23
23
  Array(@options[:targetObjectsOf]).map do |pred|
24
- graph.query(predicate: pred).objects
24
+ graph.query({predicate: pred}).objects
25
25
  end + (
26
26
  Array(type).include?(RDF::RDFS.Class) ?
27
- graph.query(predicate: RDF.type, object: id).subjects :
27
+ graph.query({predicate: RDF.type, object: id}).subjects :
28
28
  []
29
29
  )).flatten.uniq
30
30
  end
@@ -52,7 +52,7 @@ module SHACL::Algebra
52
52
  def builtin_class(types, node, path, value_nodes, **options)
53
53
  value_nodes.map do |n|
54
54
  has_type = n.resource? && begin
55
- objects = graph.query(subject: n, predicate: RDF.type).objects
55
+ objects = graph.query({subject: n, predicate: RDF.type}).objects
56
56
  types.all? {|t| objects.include?(t)}
57
57
  end
58
58
  satisfy(focus: node, path: path,
@@ -110,7 +110,7 @@ module SHACL::Algebra
110
110
  # @return [Array<SHACL::ValidationResult>]
111
111
  def builtin_disjoint(properties, node, path, value_nodes, **options)
112
112
  disjoint_nodes = properties.map do |prop|
113
- graph.query(subject: node, predicate: prop).objects
113
+ graph.query({subject: node, predicate: prop}).objects
114
114
  end.flatten.compact
115
115
  value_nodes.map do |n|
116
116
  has_value = disjoint_nodes.include?(n)
@@ -140,7 +140,7 @@ module SHACL::Algebra
140
140
  # @param [Array<RDF::Term>] value_nodes
141
141
  # @return [Array<SHACL::ValidationResult>]
142
142
  def builtin_equals(property, node, path, value_nodes, **options)
143
- equal_nodes = graph.query(subject: node, predicate: property).objects
143
+ equal_nodes = graph.query({subject: node, predicate: property}).objects
144
144
  (value_nodes.map do |n|
145
145
  has_value = equal_nodes.include?(n)
146
146
  satisfy(focus: node, path: path,
@@ -36,7 +36,7 @@ module SHACL::Algebra
36
36
  log_debug(NAME, depth: depth) {SXP::Generator.string({node: node}.to_sxp_bin)}
37
37
  num_conform = operands.inject(0) do |memo, op|
38
38
  results = op.conforms(node, depth: depth + 1, **options)
39
- memo += (results.all?(&:conform?) ? 1 : 0)
39
+ memo += (results.flatten.all?(&:conform?) ? 1 : 0)
40
40
  end
41
41
  case num_conform
42
42
  when 0
data/lib/shacl/shapes.rb CHANGED
@@ -35,7 +35,7 @@ module SHACL
35
35
  @loded_graphs = loaded_graphs
36
36
 
37
37
  import_count = 0
38
- while (imports = graph.query(predicate: RDF::OWL.imports).map(&:object)).count > import_count
38
+ while (imports = graph.query({predicate: RDF::OWL.imports}).map(&:object)).count > import_count
39
39
  # Load each imported graph
40
40
  imports.each do |ref|
41
41
  graph.load(imports)
@@ -65,7 +65,7 @@ module SHACL
65
65
  # @raise [SHACL::Error]
66
66
  def self.from_queryable(queryable, **options)
67
67
  # Query queryable to find one ore more shapes graphs
68
- graphs = queryable.query(predicate: RDF::Vocab::SHACL.shapesGraph).objects
68
+ graphs = queryable.query({predicate: RDF::Vocab::SHACL.shapesGraph}).objects
69
69
  graph = RDF::Graph.new do |g|
70
70
  graphs.each {|iri| g.load(iri)}
71
71
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shacl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.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: 2020-12-29 00:00:00.000000000 Z
11
+ date: 2021-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf
@@ -162,7 +162,7 @@ dependencies:
162
162
  - - "~>"
163
163
  - !ruby/object:Gem::Version
164
164
  version: '0.9'
165
- description: Implements SHACL Core and SHACL-SPARQL within the RDF.rb ecosystem.
165
+ description: SHACL is an Shape Constraint engine for the Ruby RDF.rb library suite.
166
166
  email: public-rdf-ruby@w3.org
167
167
  executables: []
168
168
  extensions: []
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  - !ruby/object:Gem::Version
211
211
  version: '0'
212
212
  requirements: []
213
- rubygems_version: 3.1.4
213
+ rubygems_version: 3.2.3
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Implementation of Shapes Constraint Language (SHACL) for RDF.rb