rdf-reasoner 0.2.1 → 0.2.2
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/schema.rb +33 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1980413b4fbf92e655601081fbc493d9a5dcb77
|
4
|
+
data.tar.gz: 545ce25a9e024691ee7b8d7e0166921bfa0f876a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4e95ad17224135fee1f801455eaa802a277efb82227f9d4837f3eccdeeb6b5a3c7c5a4f9686ca6dbed50afd3ea67dd625d30150b2299ff15ac56d45fef4f883
|
7
|
+
data.tar.gz: 19fb975b67c1e0aaff517e98f9513c42b6ca618272d8d862fbcc44b104ad62f33fc2442ae9d835ac70dc724bc24ba6d9ccd55ddc061e1d0e56798a781477ddd5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/lib/rdf/reasoner/schema.rb
CHANGED
@@ -125,6 +125,21 @@ module RDF::Reasoner
|
|
125
125
|
end
|
126
126
|
elsif %w(True False).map {|v| RDF::SCHEMA[v]}.include?(resource) && ranges.include?(RDF::SCHEMA.Boolean)
|
127
127
|
true # Special case for schema boolean resources
|
128
|
+
elsif ranges.include?(RDF::SCHEMA.URL) && resource.uri?
|
129
|
+
true # schema:URL matches URI resources
|
130
|
+
elsif ranges.include?(RDF::SCHEMA.Text) && resource.uri?
|
131
|
+
# Allowed if resource is untyped
|
132
|
+
# Fully entailed types of the resource
|
133
|
+
types = options.fetch(:types) do
|
134
|
+
queryable.query(:subject => resource, :predicate => RDF.type).
|
135
|
+
map {|s| (t = (RDF::Vocabulary.find_term(s.object) rescue nil)) && t.entail(:subClassOf)}.
|
136
|
+
flatten.
|
137
|
+
uniq.
|
138
|
+
compact
|
139
|
+
end
|
140
|
+
types.empty?
|
141
|
+
elsif literal_range?(ranges)
|
142
|
+
false # If resource isn't literal, this is a range violation
|
128
143
|
else
|
129
144
|
# Fully entailed types of the resource
|
130
145
|
types = options.fetch(:types) do
|
@@ -156,7 +171,24 @@ module RDF::Reasoner
|
|
156
171
|
true
|
157
172
|
end
|
158
173
|
end
|
159
|
-
|
174
|
+
|
175
|
+
# Are all ranges literal?
|
176
|
+
# @param [Array<RDF::UR>] ranges
|
177
|
+
# @return [Boolean]
|
178
|
+
def literal_range?(ranges)
|
179
|
+
ranges.all? do |range|
|
180
|
+
case range
|
181
|
+
when RDF::RDFS.Literal, RDF::SCHEMA.Text, RDF::SCHEMA.Boolean, RDF::SCHEMA.Date,
|
182
|
+
RDF::SCHEMA.DateTime, RDF::SCHEMA.Time, RDF::SCHEMA.URL,
|
183
|
+
RDF::SCHEMA.Number, RDF::SCHEMA.Float, RDF::SCHEMA.Integer
|
184
|
+
true
|
185
|
+
else
|
186
|
+
# If this is an XSD range, look for appropriate literal
|
187
|
+
range.start_with?(RDF::XSD.to_s)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
160
192
|
def self.included(mod)
|
161
193
|
end
|
162
194
|
end
|
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.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Kellogg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '1.1'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rdf-vocab
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0.8'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0.8'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: linkeddata
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
167
|
version: '0'
|
154
168
|
requirements: []
|
155
169
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.4.
|
170
|
+
rubygems_version: 2.4.7
|
157
171
|
signing_key:
|
158
172
|
specification_version: 4
|
159
173
|
summary: RDFS/OWL Reasoner for RDF.rb
|