rdf-reasoner 0.5.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
2
  SHA256:
3
- metadata.gz: 23cf1038b49812deb6c2fb5095635f0fe97f415b4338f1f5f734dd9c53643995
4
- data.tar.gz: 95755ad7c6c666a994ca7a89780214681f02727d517e836b3a8fe69e4bb07ce4
3
+ metadata.gz: 26101b5bc2906c68b13c457e2ee25578a2bc8f6700715d2bcd6e70f1d2de732e
4
+ data.tar.gz: a2563cf37bf602d5e34ab3df7aee8d343c4239c3cafdd45266f221754a3b5fa7
5
5
  SHA512:
6
- metadata.gz: 6965cd311294b46d9b93a6a9be69da05538e59037efde845eae1c6ec626e8e01710026dc957746e31d1fb63413cffcf514c05832665c3c316d0d0cc15f45e90c
7
- data.tar.gz: 91db92c27cb62d60a2f630be5343fb83704f532a64ba5bacbfd8c37fde2f024a9ab4422a6729a6d4abcb8e4334575f83dee30bf261c78f8132907c3efa2c4e5f
6
+ metadata.gz: 9c8b47333f2b39171e3c9d84af5e4cdf440a6920d757a9f06a6b13058f147663adeb18ecd54aa934f8d56d690fe979c2dd9075a6e3153657aaf6346f237a988a
7
+ data.tar.gz: 6cb109135c9f9bf62223462ff96ad2a6b567f63f38916675c4090b9e4cb2539340c207bcabe28263f8478c157fcf033c9ccb082440620e864fa5f2902a71a2a2
data/README.md CHANGED
@@ -8,6 +8,7 @@ Reasons over RDFS/OWL vocabularies and schema.org to generate statements which a
8
8
  * Entail `rdfs:subPropertyOf` generating an array of terms which are ancestors of the subject.
9
9
  * Entail `rdfs:domain` and `rdfs:range` adding `rdf:type` assertions on the subject or object.
10
10
  * Inverse `rdfs:subClassOf` entailment, to find descendant classes of the subject term.
11
+ * Inverse `rdfs:subPropertyOf` entailment, to find descendant properties of the subject term.
11
12
  * Entail `owl:equivalentClass` generating an array of terms equivalent to the subject.
12
13
  * Entail `owl:equivalentProperty` generating an array of terms equivalent to the subject.
13
14
  * `domainCompatible?` determines if a particular resource is compatible with the domain definition of a given predicate, based on the intersection of entailed subclasses with the property domain.
@@ -21,6 +22,14 @@ Domain and Range entailment include specific rules for schema.org vocabularies.
21
22
  * If `resource` is of type `schema:Role`, it is range acceptable if it has the same property with an acceptable value.
22
23
  * If `resource` is of type `rdf:List` (must be previously entailed), it is range acceptable if all members of the list are otherwise range acceptable on the same property.
23
24
 
25
+ ### Limiting vocabularies used for reasoning
26
+
27
+ As loading vocabularies can dominate processing time, the `RDF::Vocabulary.limit_vocabs` method can be used to set a specific set of vocabularies over which to reason. For example:
28
+
29
+ RDF::Vocabulary.limit_vocabs(:rdf, :rdf, :schema)
30
+
31
+ will limit the vocabularies which are returned from `RDF::Vocabulary.each`, which is used for reasoning and other operations over vocabularies and terms.
32
+
24
33
  ## Examples
25
34
  ### Determine super-classes of a class
26
35
 
@@ -51,7 +60,7 @@ Domain and Range entailment include specific rules for schema.org vocabularies.
51
60
 
52
61
  RDF::Reasoner.apply(:rdfs)
53
62
  graph = RDF::Graph.load("etc/doap.ttl")
54
- subj = RDF::URI("http://rubygems.org/gems/rdf-reasoner")
63
+ subj = RDF::URI("https://rubygems.org/gems/rdf-reasoner")
55
64
  RDF::Vocab::DOAP.name.domain_compatible?(subj, graph) # => true
56
65
 
57
66
  ### Determine if a resource is compatible with the ranges of a property
@@ -103,16 +112,16 @@ The `rdf` command-line interface is extended with `entail` and `lint` commands.
103
112
 
104
113
  ## Dependencies
105
114
 
106
- * [Ruby](http://ruby-lang.org/) (>= 2.2.2)
107
- * [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.0)
115
+ * [Ruby](https://ruby-lang.org/) (>= 2.4)
116
+ * [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.1)
108
117
 
109
118
  ## Mailing List
110
119
 
111
- * <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
120
+ * <https://lists.w3.org/Archives/Public/public-rdf-ruby/>
112
121
 
113
122
  ## Authors
114
123
 
115
- * [Gregg Kellogg](http://github.com/gkellogg) - <http://greggkellogg.net/>
124
+ * [Gregg Kellogg](https://github.com/gkellogg) - <https://greggkellogg.net/>
116
125
 
117
126
  ## Contributing
118
127
 
@@ -132,17 +141,17 @@ The `rdf` command-line interface is extended with `entail` and `lint` commands.
132
141
  ## License
133
142
 
134
143
  This is free and unencumbered public domain software. For more information,
135
- see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
136
-
137
- [Ruby]: http://ruby-lang.org/
138
- [RDF]: http://www.w3.org/RDF/
139
- [YARD]: http://yardoc.org/
140
- [YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
141
- [PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
142
- [SPARQL]: http://en.wikipedia.org/wiki/SPARQL
143
- [SPARQL Query]: http://www.w3.org/TR/2013/REC-sparql11-query-20130321/
144
- [SPARQL Entailment]:http://www.w3.org/TR/sparql11-entailment/
145
- [RDF 1.1]: http://www.w3.org/TR/rdf11-concepts
146
- [RDF.rb]: http://www.rubydoc.info/github/ruby-rdf/rdf/
147
- [RDF Schema]: http://www.w3.org/TR/rdf-schema/
144
+ see <https://unlicense.org/> or the accompanying {file:UNLICENSE} file.
145
+
146
+ [Ruby]: https://ruby-lang.org/
147
+ [RDF]: https://www.w3.org/RDF/
148
+ [YARD]: https://yardoc.org/
149
+ [YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
150
+ [PDD]: https://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
151
+ [SPARQL]: https://en.wikipedia.org/wiki/SPARQL
152
+ [SPARQL Query]: https://www.w3.org/TR/2013/REC-sparql11-query-20130321/
153
+ [SPARQL Entailment]:https://www.w3.org/TR/sparql11-entailment/
154
+ [RDF 1.1]: https://www.w3.org/TR/rdf11-concepts
155
+ [RDF.rb]: https://www.rubydoc.info/github/ruby-rdf/rdf/
156
+ [RDF Schema]: https://www.w3.org/TR/rdf-schema/
148
157
  [Rack]: https://rack.github.io/
data/UNLICENSE 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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.6.1
@@ -6,8 +6,8 @@ module RDF
6
6
  ##
7
7
  # RDFS/OWL reasonsing for RDF.rb.
8
8
  #
9
- # @see http://www.w3.org/TR/2013/REC-sparql11-entailment-20130321/
10
- # @author [Gregg Kellogg](http://greggkellogg.net/)
9
+ # @see https://www.w3.org/TR/2013/REC-sparql11-entailment-20130321/
10
+ # @author [Gregg Kellogg](https://greggkellogg.net/)
11
11
  module Reasoner
12
12
  require 'rdf/reasoner/format'
13
13
  autoload :OWL, 'rdf/reasoner/owl'
@@ -15,7 +15,7 @@ module RDF
15
15
  autoload :Schema, 'rdf/reasoner/schema'
16
16
  autoload :VERSION, 'rdf/reasoner/version'
17
17
 
18
- # See http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
18
+ # See https://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
19
19
  #
20
20
  #
21
21
  ISO_8601 = %r(^
@@ -91,7 +91,7 @@ module RDF
91
91
  # Fully entailed types of resource, if not provided, they are queried
92
92
  def domain_compatible?(resource, queryable, options = {})
93
93
  %w(owl rdfs schema).map {|r| "domain_compatible_#{r}?".to_sym}.all? do |meth|
94
- !self.respond_to?(meth) || self.send(meth, resource, queryable, options)
94
+ !self.respond_to?(meth) || self.send(meth, resource, queryable, **options)
95
95
  end
96
96
  end
97
97
 
@@ -233,7 +233,7 @@ module RDF
233
233
  messages = {}
234
234
 
235
235
  # Check for defined classes in known vocabularies
236
- self.query(predicate: RDF.type) do |stmt|
236
+ self.query({predicate: RDF.type}) do |stmt|
237
237
  vocab = RDF::Vocabulary.find(stmt.object)
238
238
  term = (RDF::Vocabulary.find_term(stmt.object) rescue nil) if vocab
239
239
  pname = term ? term.pname : stmt.object.pname
@@ -275,7 +275,7 @@ module RDF
275
275
  end
276
276
 
277
277
  # See if type of the subject is in the domain of this predicate
278
- resource_types[stmt.subject] ||= self.query(subject: stmt.subject, predicate: RDF.type).
278
+ resource_types[stmt.subject] ||= self.query({subject: stmt.subject, predicate: RDF.type}).
279
279
  map {|s| (t = (RDF::Vocabulary.find_term(s.object) rescue nil)) && t.entail(:subClassOf)}.
280
280
  flatten.
281
281
  uniq.
@@ -290,7 +290,7 @@ module RDF
290
290
  end
291
291
 
292
292
  # Make sure that if ranges are defined, the object has an appropriate type
293
- resource_types[stmt.object] ||= self.query(subject: stmt.object, predicate: RDF.type).
293
+ resource_types[stmt.object] ||= self.query({subject: stmt.object, predicate: RDF.type}).
294
294
  map {|s| (t = (RDF::Vocabulary.find_term(s.object) rescue nil)) && t.entail(:subClassOf)}.
295
295
  flatten.
296
296
  uniq.
@@ -316,7 +316,7 @@ module RDF
316
316
  def show_resource(resource)
317
317
  if resource.node?
318
318
  resource.to_ntriples + '(' +
319
- self.query(subject: resource, predicate: RDF.type).
319
+ self.query({subject: resource, predicate: RDF.type}).
320
320
  map {|s| s.object.uri? ? s.object.pname : s.object.to_ntriples}
321
321
  .join(',') +
322
322
  ')'
@@ -5,7 +5,7 @@ module RDF::Reasoner
5
5
  # @example Obtaining an LD Patch format class
6
6
  # RDF::Format.for(:reasoner) #=> RDF::Reasoner::Format
7
7
  #
8
- # @see http://www.w3.org/TR/ldpatch/
8
+ # @see https://www.w3.org/TR/ldpatch/
9
9
  class Format < RDF::Format
10
10
 
11
11
  ##
@@ -50,7 +50,7 @@ module RDF::Reasoner
50
50
  if self.predicate == RDF.type
51
51
  if term = (RDF::Vocabulary.find_term(self.object) rescue nil)
52
52
  term._entail_equivalentClass do |t|
53
- statements << RDF::Statement(self.to_h.merge(object: t, inferred: true))
53
+ statements << RDF::Statement(**self.to_h.merge(object: t, inferred: true))
54
54
  end
55
55
  end
56
56
  end
@@ -89,7 +89,7 @@ module RDF::Reasoner
89
89
  statements = []
90
90
  if term = (RDF::Vocabulary.find_term(self.predicate) rescue nil)
91
91
  term._entail_equivalentProperty do |t|
92
- statements << RDF::Statement(self.to_h.merge(predicate: t, inferred: true))
92
+ statements << RDF::Statement(**self.to_h.merge(predicate: t, inferred: true))
93
93
  end
94
94
  end
95
95
  statements.each {|s| yield s} if block_given?
@@ -34,9 +34,24 @@ module RDF::Reasoner
34
34
  @@subPropertyOf_cache ||= RDF::Util::Cache.new(-1)
35
35
  end
36
36
 
37
+ ##
38
+ # @return [RDF::Util::Cache]
39
+ # @private
40
+ def subProperty_cache
41
+ @@subProperty_cache ||= RDF::Util::Cache.new(-1)
42
+ end
43
+
44
+ ##
45
+ # @return [RDF::Util::Cache]
46
+ # @private
47
+ def descendant_property_cache
48
+ @@descendant_property_cache ||= RDF::Util::Cache.new(-1)
49
+ end
50
+
37
51
  ##
38
52
  # For a Term: yield or return inferred subClassOf relationships by recursively applying to named super classes to get a complete set of classes in the ancestor chain of this class
39
53
  # For a Statement: if predicate is `rdf:types`, yield or return inferred statements having a subClassOf relationship to the type of this statement
54
+ # @todo Should be able to entail owl:Restriction, which is a BNode. This should be allowed, and also add BNode values of that node, recursively, similar to SPARQL concise_bounded_description.uu
40
55
  # @private
41
56
  def _entail_subClassOf
42
57
  case self
@@ -58,7 +73,8 @@ module RDF::Reasoner
58
73
  if self.predicate == RDF.type
59
74
  if term = (RDF::Vocabulary.find_term(self.object) rescue nil)
60
75
  term._entail_subClassOf do |t|
61
- statements << RDF::Statement(self.to_h.merge(object: t, inferred: true))
76
+ next if t.node? # Don't entail BNodes
77
+ statements << RDF::Statement(**self.to_h.merge(object: t, inferred: true))
62
78
  end
63
79
  end
64
80
  #$stderr.puts("subClassf(#{self.predicate.pname}): #{statements.map(&:object).map {|r| r.respond_to?(:pname) ? r.pname : r.to_ntriples}}}")
@@ -106,7 +122,7 @@ module RDF::Reasoner
106
122
 
107
123
  ##
108
124
  # For a Term: yield or return inferred subPropertyOf relationships by recursively applying to named super classes to get a complete set of classes in the ancestor chain of this class
109
- # For a Statement: yield or return inferred statements having a subPropertyOf relationship to predicate of this statement
125
+ # For a Statement: yield or return inferred statements having a subPropertyOf relationship to predicate of this statements
110
126
  # @private
111
127
  def _entail_subPropertyOf
112
128
  case self
@@ -127,7 +143,7 @@ module RDF::Reasoner
127
143
  statements = []
128
144
  if term = (RDF::Vocabulary.find_term(self.predicate) rescue nil)
129
145
  term._entail_subPropertyOf do |t|
130
- statements << RDF::Statement(self.to_h.merge(predicate: t, inferred: true))
146
+ statements << RDF::Statement(**self.to_h.merge(predicate: t, inferred: true))
131
147
  end
132
148
  #$stderr.puts("subPropertyOf(#{self.predicate.pname}): #{statements.map(&:object).map {|r| r.respond_to?(:pname) ? r.pname : r.to_ntriples}}}")
133
149
  end
@@ -137,8 +153,53 @@ module RDF::Reasoner
137
153
  end
138
154
  end
139
155
 
156
+ ##
157
+ # For a Term: yield or return inferred subProperty relationships
158
+ # by recursively applying to named subproperties to get a complete
159
+ # set of properties in the descendant chain of this property
160
+ #
161
+ # For a Statement: this is a no-op, as it's not useful in this context
162
+ # @private
163
+
164
+ def _entail_subProperty
165
+ case self
166
+ when RDF::URI, RDF::Node
167
+ unless property?
168
+ yield self if block_given?
169
+ return Array(self)
170
+ end
171
+
172
+ terms = descendant_property_cache[self] ||= (
173
+ Array(self.subProperty).map do |c|
174
+ c._entail_subProperty rescue c
175
+ end.flatten + Array(self)).compact
176
+
177
+ terms.each {|t| yield t } if block_given?
178
+ terms
179
+ else []
180
+ end
181
+ end
182
+
183
+ ##
184
+ # Get the immediate subproperties of this property.
185
+ #
186
+ # This iterates over terms defined in the vocabulary of this term,
187
+ # as well as the vocabularies imported by this vocabulary.
188
+ # @return [Array<RDF::Vocabulary::Term>]
189
+ def subProperty
190
+ raise RDF::Reasoner::Error,
191
+ "#{self} Can't entail subProperty" unless property?
192
+ vocabs = [self.vocab] + self.vocab.imported_from
193
+ subProperty_cache[self] ||= vocabs.map do |v|
194
+ Array(v.properties).select do |p|
195
+ p.property? && Array(p.subPropertyOf).include?(self)
196
+ end
197
+ end.flatten.compact
198
+ end
199
+
140
200
  ##
141
201
  # For a Statement: yield or return inferred statements having an rdf:type of the domain of the statement predicate
202
+ # @todo Should be able to entail owl:unionOf, which is a BNode. This should be allowed, and also add BNode values of that node, recursively, similar to SPARQL concise_bounded_description.uu
142
203
  # @private
143
204
  def _entail_domain
144
205
  case self
@@ -146,7 +207,8 @@ module RDF::Reasoner
146
207
  statements = []
147
208
  if term = (RDF::Vocabulary.find_term(self.predicate) rescue nil)
148
209
  term.domain.each do |t|
149
- statements << RDF::Statement(self.to_h.merge(predicate: RDF.type, object: t, inferred: true))
210
+ next if t.node? # Don't entail BNodes
211
+ statements << RDF::Statement(**self.to_h.merge(predicate: RDF.type, object: t, inferred: true))
150
212
  end
151
213
  end
152
214
  #$stderr.puts("domain(#{self.predicate.pname}): #{statements.map(&:object).map {|r| r.respond_to?(:pname) ? r.pname : r.to_ntriples}}}")
@@ -158,6 +220,7 @@ module RDF::Reasoner
158
220
 
159
221
  ##
160
222
  # For a Statement: if object is a resource, yield or return inferred statements having an rdf:type of the range of the statement predicate
223
+ # @todo Should be able to entail owl:unionOf, which is a BNode. This should be allowed, and also add BNode values of that node, recursively, similar to SPARQL concise_bounded_description.uu
161
224
  # @private
162
225
  def _entail_range
163
226
  case self
@@ -165,7 +228,8 @@ module RDF::Reasoner
165
228
  statements = []
166
229
  if object.resource? && term = (RDF::Vocabulary.find_term(self.predicate) rescue nil)
167
230
  term.range.each do |t|
168
- statements << RDF::Statement(self.to_h.merge(subject: self.object, predicate: RDF.type, object: t, inferred: true))
231
+ next if t.node? # Don't entail BNodes
232
+ statements << RDF::Statement(**self.to_h.merge(subject: self.object, predicate: RDF.type, object: t, inferred: true))
169
233
  end
170
234
  end
171
235
  #$stderr.puts("range(#{self.predicate.pname}): #{statements.map(&:object).map {|r| r.respond_to?(:pname) ? r.pname : r.to_ntriples}}")
@@ -187,11 +251,11 @@ module RDF::Reasoner
187
251
  # Fully entailed types of resource, if not provided, they are queried
188
252
  def domain_compatible_rdfs?(resource, queryable, options = {})
189
253
  raise RDF::Reasoner::Error, "#{self} can't get domains" unless property?
190
- domains = Array(self.domain) - [RDF::OWL.Thing, RDF::RDFS.Resource]
254
+ domains = Array(self.domain).reject(&:node?) - [RDF::OWL.Thing, RDF::RDFS.Resource]
191
255
 
192
256
  # Fully entailed types of the resource
193
257
  types = options.fetch(:types) do
194
- queryable.query(subject: resource, predicate: RDF.type).
258
+ queryable.query({subject: resource, predicate: RDF.type}).
195
259
  map {|s| (t = (RDF::Vocabulary.find_term(s.object)) rescue nil) && t.entail(:subClassOf)}.
196
260
  flatten.
197
261
  uniq.
@@ -214,7 +278,7 @@ module RDF::Reasoner
214
278
  # Fully entailed types of resource, if not provided, they are queried
215
279
  def range_compatible_rdfs?(resource, queryable, options = {})
216
280
  raise RDF::Reasoner::Error, "#{self} can't get ranges" unless property?
217
- if !(ranges = Array(self.range) - [RDF::OWL.Thing, RDF::RDFS.Resource]).empty?
281
+ if !(ranges = Array(self.range).reject(&:node?) - [RDF::OWL.Thing, RDF::RDFS.Resource]).empty?
218
282
  if resource.literal?
219
283
  ranges.all? do |range|
220
284
  if [RDF::RDFS.Literal, RDF.XMLLiteral, RDF.HTML].include?(range)
@@ -273,7 +337,7 @@ module RDF::Reasoner
273
337
  else
274
338
  # Fully entailed types of the resource
275
339
  types = options.fetch(:types) do
276
- queryable.query(subject: resource, predicate: RDF.type).
340
+ queryable.query({subject: resource, predicate: RDF.type}).
277
341
  map {|s| (t = (RDF::Vocabulary.find_term(s.object) rescue nil)) && t.entail(:subClassOf)}.
278
342
  flatten.
279
343
  uniq.
@@ -297,6 +361,7 @@ module RDF::Reasoner
297
361
  mod.add_entailment :subClassOf, :_entail_subClassOf
298
362
  mod.add_entailment :subClass, :_entail_subClass
299
363
  mod.add_entailment :subPropertyOf, :_entail_subPropertyOf
364
+ mod.add_entailment :subProperty, :_entail_subProperty
300
365
  mod.add_entailment :domain, :_entail_domain
301
366
  mod.add_entailment :range, :_entail_range
302
367
  end
@@ -313,4 +378,4 @@ module RDF::Reasoner
313
378
 
314
379
  # Extend Mutable with these methods
315
380
  ::RDF::Mutable.send(:include, RDFS)
316
- end
381
+ end
@@ -27,7 +27,7 @@ module RDF::Reasoner
27
27
  domains = Array(self.domainIncludes) - [RDF::OWL.Thing]
28
28
 
29
29
  # Fully entailed types of the resource
30
- types = entailed_types(resource, queryable, options) unless domains.empty?
30
+ types = entailed_types(resource, queryable, **options) unless domains.empty?
31
31
 
32
32
  # Every domain must match some entailed type
33
33
  resource_acceptable = Array(types).empty? || domains.any? {|d| types.include?(d)}
@@ -35,7 +35,7 @@ module RDF::Reasoner
35
35
  # Resource may still be acceptable if types include schema:Role, and any any other resource references `resource` using this property
36
36
  resource_acceptable ||
37
37
  types.include?(RDF::Vocab::SCHEMA.Role) &&
38
- !queryable.query(predicate: self, object: resource).empty?
38
+ !queryable.query({predicate: self, object: resource}).empty?
39
39
  end
40
40
 
41
41
  ##
@@ -123,12 +123,12 @@ module RDF::Reasoner
123
123
  true # schema:URL matches URI resources
124
124
  elsif ranges == [RDF::Vocab::SCHEMA.Text] && resource.uri?
125
125
  # Allowed if resource is untyped
126
- entailed_types(resource, queryable, options).empty?
126
+ entailed_types(resource, queryable, **options).empty?
127
127
  elsif literal_range?(ranges)
128
128
  false # If resource isn't literal, this is a range violation
129
129
  else
130
130
  # Fully entailed types of the resource
131
- types = entailed_types(resource, queryable, options)
131
+ types = entailed_types(resource, queryable, **options)
132
132
 
133
133
  # Every range must match some entailed type
134
134
  resource_acceptable = Array(types).empty? || ranges.any? {|d| types.include?(d)}
@@ -138,7 +138,7 @@ module RDF::Reasoner
138
138
 
139
139
  # Resource also acceptable if it is a Role, and the Role object contains the same predicate having a compatible object
140
140
  types.include?(RDF::Vocab::SCHEMA.Role) &&
141
- queryable.query(subject: resource, predicate: self).any? do |stmt|
141
+ queryable.query({subject: resource, predicate: self}).any? do |stmt|
142
142
  acc = self.range_compatible_schema?(stmt.object, queryable)
143
143
  acc
144
144
  end ||
@@ -174,9 +174,9 @@ module RDF::Reasoner
174
174
 
175
175
  private
176
176
  # Fully entailed types
177
- def entailed_types(resource, queryable, options = {})
177
+ def entailed_types(resource, queryable, **options)
178
178
  options.fetch(:types) do
179
- queryable.query(subject: resource, predicate: RDF.type).
179
+ queryable.query({subject: resource, predicate: RDF.type}).
180
180
  map {|s| (t = (RDF::Vocabulary.find_term(s.object) rescue nil)) && t.entail(:subClassOf)}.
181
181
  flatten.
182
182
  uniq.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-reasoner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.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: 2017-12-29 00:00:00.000000000 Z
11
+ date: 2020-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf
@@ -16,90 +16,96 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '3.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.1.2
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: '3.0'
29
+ version: '3.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.1.2
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rdf-vocab
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '3.0'
39
+ version: '3.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.1.5
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
47
  - - "~>"
39
48
  - !ruby/object:Gem::Version
40
- version: '3.0'
49
+ version: '3.1'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 3.1.5
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: rdf-xsd
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
45
57
  - - "~>"
46
58
  - !ruby/object:Gem::Version
47
- version: '3.0'
59
+ version: '3.1'
48
60
  type: :runtime
49
61
  prerelease: false
50
62
  version_requirements: !ruby/object:Gem::Requirement
51
63
  requirements:
52
64
  - - "~>"
53
65
  - !ruby/object:Gem::Version
54
- version: '3.0'
66
+ version: '3.1'
55
67
  - !ruby/object:Gem::Dependency
56
68
  name: rdf-spec
57
69
  requirement: !ruby/object:Gem::Requirement
58
70
  requirements:
59
71
  - - "~>"
60
72
  - !ruby/object:Gem::Version
61
- version: '3.0'
73
+ version: '3.1'
62
74
  type: :development
63
75
  prerelease: false
64
76
  version_requirements: !ruby/object:Gem::Requirement
65
77
  requirements:
66
78
  - - "~>"
67
79
  - !ruby/object:Gem::Version
68
- version: '3.0'
80
+ version: '3.1'
69
81
  - !ruby/object:Gem::Dependency
70
82
  name: rdf-turtle
71
83
  requirement: !ruby/object:Gem::Requirement
72
84
  requirements:
73
85
  - - "~>"
74
86
  - !ruby/object:Gem::Version
75
- version: '3.0'
87
+ version: '3.1'
76
88
  type: :development
77
89
  prerelease: false
78
90
  version_requirements: !ruby/object:Gem::Requirement
79
91
  requirements:
80
92
  - - "~>"
81
93
  - !ruby/object:Gem::Version
82
- version: '3.0'
94
+ version: '3.1'
83
95
  - !ruby/object:Gem::Dependency
84
96
  name: json-ld
85
97
  requirement: !ruby/object:Gem::Requirement
86
98
  requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '2.2'
90
- - - "<"
99
+ - - "~>"
91
100
  - !ruby/object:Gem::Version
92
- version: '4.0'
101
+ version: '3.1'
93
102
  type: :development
94
103
  prerelease: false
95
104
  version_requirements: !ruby/object:Gem::Requirement
96
105
  requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: '2.2'
100
- - - "<"
106
+ - - "~>"
101
107
  - !ruby/object:Gem::Version
102
- version: '4.0'
108
+ version: '3.1'
103
109
  - !ruby/object:Gem::Dependency
104
110
  name: equivalent-xml
105
111
  requirement: !ruby/object:Gem::Requirement
@@ -120,28 +126,28 @@ dependencies:
120
126
  requirements:
121
127
  - - "~>"
122
128
  - !ruby/object:Gem::Version
123
- version: '3.7'
129
+ version: '3.9'
124
130
  type: :development
125
131
  prerelease: false
126
132
  version_requirements: !ruby/object:Gem::Requirement
127
133
  requirements:
128
134
  - - "~>"
129
135
  - !ruby/object:Gem::Version
130
- version: '3.7'
136
+ version: '3.9'
131
137
  - !ruby/object:Gem::Dependency
132
138
  name: yard
133
139
  requirement: !ruby/object:Gem::Requirement
134
140
  requirements:
135
141
  - - "~>"
136
142
  - !ruby/object:Gem::Version
137
- version: 0.9.12
143
+ version: 0.9.20
138
144
  type: :development
139
145
  prerelease: false
140
146
  version_requirements: !ruby/object:Gem::Requirement
141
147
  requirements:
142
148
  - - "~>"
143
149
  - !ruby/object:Gem::Version
144
- version: 0.9.12
150
+ version: 0.9.20
145
151
  description: Reasons over RDFS/OWL vocabularies to generate statements which are entailed
146
152
  based on base RDFS/OWL rules along with vocabulary information. It can also be used
147
153
  to ask specific questions, such as if a given object is consistent with the vocabulary
@@ -162,7 +168,7 @@ files:
162
168
  - lib/rdf/reasoner/rdfs.rb
163
169
  - lib/rdf/reasoner/schema.rb
164
170
  - lib/rdf/reasoner/version.rb
165
- homepage: http://github.com/gkellogg/rdf-reasoner
171
+ homepage: https://github.com/ruby-rdf/rdf-reasoner
166
172
  licenses:
167
173
  - Unlicense
168
174
  metadata: {}
@@ -174,15 +180,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
180
  requirements:
175
181
  - - ">="
176
182
  - !ruby/object:Gem::Version
177
- version: 2.2.2
183
+ version: '2.4'
178
184
  required_rubygems_version: !ruby/object:Gem::Requirement
179
185
  requirements:
180
186
  - - ">="
181
187
  - !ruby/object:Gem::Version
182
188
  version: '0'
183
189
  requirements: []
184
- rubyforge_project:
185
- rubygems_version: 2.7.3
190
+ rubygems_version: 3.1.3
186
191
  signing_key:
187
192
  specification_version: 4
188
193
  summary: RDFS/OWL Reasoner for RDF.rb