rdf-reasoner 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rdf/reasoner/rdfs.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6837a878051e36a7e39b6c1136ce45a36bd72e29def693d42350fde2e562334f
|
4
|
+
data.tar.gz: 38d1644db1d9960f71d8865bfe15bd7975712cc1d21438fbeb2aad99eb3a4e88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10211fe77a23baf6c13a1e075704dc5a597e91d249508c9dbe5d97c20e780ddc0e61ed50e1b100148c2a2d8a2902fc4616e87bf3c8813beec57e511ad3d7a2e2
|
7
|
+
data.tar.gz: c17e45cc44b94d7b0af58a33f506b37e118e68dd152c35410bf7c03cb13e4d6da86d38c36d256608fcdcae6edebeae396fa18fc8a7f50bb02d61977e7052597f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.1
|
data/lib/rdf/reasoner/rdfs.rb
CHANGED
@@ -37,6 +37,7 @@ module RDF::Reasoner
|
|
37
37
|
##
|
38
38
|
# 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
39
|
# For a Statement: if predicate is `rdf:types`, yield or return inferred statements having a subClassOf relationship to the type of this statement
|
40
|
+
# @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
41
|
# @private
|
41
42
|
def _entail_subClassOf
|
42
43
|
case self
|
@@ -58,6 +59,7 @@ module RDF::Reasoner
|
|
58
59
|
if self.predicate == RDF.type
|
59
60
|
if term = (RDF::Vocabulary.find_term(self.object) rescue nil)
|
60
61
|
term._entail_subClassOf do |t|
|
62
|
+
next if t.node? # Don't entail BNodes
|
61
63
|
statements << RDF::Statement(self.to_h.merge(object: t, inferred: true))
|
62
64
|
end
|
63
65
|
end
|
@@ -139,6 +141,7 @@ module RDF::Reasoner
|
|
139
141
|
|
140
142
|
##
|
141
143
|
# For a Statement: yield or return inferred statements having an rdf:type of the domain of the statement predicate
|
144
|
+
# @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
145
|
# @private
|
143
146
|
def _entail_domain
|
144
147
|
case self
|
@@ -146,6 +149,7 @@ module RDF::Reasoner
|
|
146
149
|
statements = []
|
147
150
|
if term = (RDF::Vocabulary.find_term(self.predicate) rescue nil)
|
148
151
|
term.domain.each do |t|
|
152
|
+
next if t.node? # Don't entail BNodes
|
149
153
|
statements << RDF::Statement(self.to_h.merge(predicate: RDF.type, object: t, inferred: true))
|
150
154
|
end
|
151
155
|
end
|
@@ -158,6 +162,7 @@ module RDF::Reasoner
|
|
158
162
|
|
159
163
|
##
|
160
164
|
# For a Statement: if object is a resource, yield or return inferred statements having an rdf:type of the range of the statement predicate
|
165
|
+
# @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
166
|
# @private
|
162
167
|
def _entail_range
|
163
168
|
case self
|
@@ -165,6 +170,7 @@ module RDF::Reasoner
|
|
165
170
|
statements = []
|
166
171
|
if object.resource? && term = (RDF::Vocabulary.find_term(self.predicate) rescue nil)
|
167
172
|
term.range.each do |t|
|
173
|
+
next if t.node? # Don't entail BNodes
|
168
174
|
statements << RDF::Statement(self.to_h.merge(subject: self.object, predicate: RDF.type, object: t, inferred: true))
|
169
175
|
end
|
170
176
|
end
|
@@ -187,7 +193,7 @@ module RDF::Reasoner
|
|
187
193
|
# Fully entailed types of resource, if not provided, they are queried
|
188
194
|
def domain_compatible_rdfs?(resource, queryable, options = {})
|
189
195
|
raise RDF::Reasoner::Error, "#{self} can't get domains" unless property?
|
190
|
-
domains = Array(self.domain) - [RDF::OWL.Thing, RDF::RDFS.Resource]
|
196
|
+
domains = Array(self.domain).reject(&:node?) - [RDF::OWL.Thing, RDF::RDFS.Resource]
|
191
197
|
|
192
198
|
# Fully entailed types of the resource
|
193
199
|
types = options.fetch(:types) do
|
@@ -214,7 +220,7 @@ module RDF::Reasoner
|
|
214
220
|
# Fully entailed types of resource, if not provided, they are queried
|
215
221
|
def range_compatible_rdfs?(resource, queryable, options = {})
|
216
222
|
raise RDF::Reasoner::Error, "#{self} can't get ranges" unless property?
|
217
|
-
if !(ranges = Array(self.range) - [RDF::OWL.Thing, RDF::RDFS.Resource]).empty?
|
223
|
+
if !(ranges = Array(self.range).reject(&:node?) - [RDF::OWL.Thing, RDF::RDFS.Resource]).empty?
|
218
224
|
if resource.literal?
|
219
225
|
ranges.all? do |range|
|
220
226
|
if [RDF::RDFS.Literal, RDF.XMLLiteral, RDF.HTML].include?(range)
|
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.
|
4
|
+
version: 0.5.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-
|
11
|
+
date: 2017-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|