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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98bf1114b6fa4d5f10d0fde294d1b0c7986a2f7c
4
- data.tar.gz: c388729988814df066130c18f813d56a95c683fd
3
+ metadata.gz: f6a98adc5516082d31f711b399c152f140a02bb5
4
+ data.tar.gz: 39fa2fc036816834e1bdf676ed4d7ad0898cce28
5
5
  SHA512:
6
- metadata.gz: 9ff5f740202cc21c91ff93c02ff59a2f1f441dc921a538315c2b974096158c53faf247fffd46e03370f42740dafe7240ce12499713e242620f9d4fdeed58c4cb
7
- data.tar.gz: 13bf06917afbbe5a9e89d3bf877ef9908f9a671de38018049aebb89c8003e39fc16361ef6d21f7e10dcea0b9cfea267cd3d033b394ffeea4e28e6639c545d479
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.4
1
+ 0.1.0
@@ -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
- types.include?(RDF::SCHEMA.Role) &&
160
- queryable.query(subject: resource, predicate: self).any? do |stmt|
161
- acc = self.range_compatible_schema?(stmt.object, queryable)
162
- acc
163
- end
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
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-07-28 00:00:00.000000000 Z
11
+ date: 2014-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf