rdf-reasoner 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/VERSION +1 -1
- data/lib/rdf/reasoner/schema.rb +13 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6a98adc5516082d31f711b399c152f140a02bb5
|
4
|
+
data.tar.gz: 39fa2fc036816834e1bdf676ed4d7ad0898cce28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 729ae98dd83b486197f0eb73d9465116dd40aa16d385b05c94c1228fa6ed0f882aeb85f84b0b492a0c1ba5931d231147cc36cce2a9c2c166d5af547971324ea3
|
7
|
+
data.tar.gz: 3c0a07eefe32d2e5e4afd983546e667028c48c050fde90cbd67ddaf9ea46ad6bc64ef143ea73db2078840eafbb27b4bd7ca5b6f7ff566ad5852705e605f71e79
|
data/README.md
CHANGED
@@ -12,6 +12,11 @@ Reasons over RDFS/OWL vocabularies and schema.org to generate statements which a
|
|
12
12
|
|
13
13
|
Domain and Range entailment include specific rules for schema.org vocabularies.
|
14
14
|
|
15
|
+
* A plain literal is an acceptable value for any property.
|
16
|
+
* If `resource` is of type `schema:Role`, `resource` is domain acceptable if any other resource references `resource` using the same property.
|
17
|
+
* If `resource` is of type `schema:Role`, it is range acceptable if it has the same property with an acceptable value.
|
18
|
+
* 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.
|
19
|
+
|
15
20
|
## Dependencies
|
16
21
|
|
17
22
|
* [Ruby](http://ruby-lang.org/) (>= 1.9.2)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/rdf/reasoner/schema.rb
CHANGED
@@ -67,6 +67,8 @@ module RDF::Reasoner
|
|
67
67
|
#
|
68
68
|
# If `resource` is of type `schema:Role`, it is range acceptable if it has the same property with an acceptable value.
|
69
69
|
#
|
70
|
+
# 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.
|
71
|
+
#
|
70
72
|
# Also, a plain literal (or schema:Text) is always compatible with an object range.
|
71
73
|
#
|
72
74
|
# @param [RDF::Resource] resource
|
@@ -156,11 +158,17 @@ module RDF::Reasoner
|
|
156
158
|
|
157
159
|
# Resource may still be acceptable if it has the same property with an acceptable value
|
158
160
|
resource_acceptable ||
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
161
|
+
|
162
|
+
# Resource also acceptable if it is a Role, and the Role object contains the same predicate having a compatible object
|
163
|
+
types.include?(RDF::SCHEMA.Role) &&
|
164
|
+
queryable.query(subject: resource, predicate: self).any? do |stmt|
|
165
|
+
acc = self.range_compatible_schema?(stmt.object, queryable)
|
166
|
+
acc
|
167
|
+
end ||
|
168
|
+
# Resource also acceptable if it is a List, and every member of the list is range compatible with the predicate
|
169
|
+
(list = RDF::List.new(resource, queryable)).valid? && list.all? do |member|
|
170
|
+
self.range_compatible_schema?(member, queryable)
|
171
|
+
end
|
164
172
|
end
|
165
173
|
else
|
166
174
|
true
|
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.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Kellogg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|