rdf-reasoner 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/VERSION +1 -1
- data/lib/rdf/reasoner.rb +2 -2
- data/lib/rdf/reasoner/extensions.rb +7 -7
- data/lib/rdf/reasoner/rdfs.rb +3 -3
- data/lib/rdf/reasoner/schema.rb +2 -2
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26101b5bc2906c68b13c457e2ee25578a2bc8f6700715d2bcd6e70f1d2de732e
|
4
|
+
data.tar.gz: a2563cf37bf602d5e34ab3df7aee8d343c4239c3cafdd45266f221754a3b5fa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c8b47333f2b39171e3c9d84af5e4cdf440a6920d757a9f06a6b13058f147663adeb18ecd54aa934f8d56d690fe979c2dd9075a6e3153657aaf6346f237a988a
|
7
|
+
data.tar.gz: 6cb109135c9f9bf62223462ff96ad2a6b567f63f38916675c4090b9e4cb2539340c207bcabe28263f8478c157fcf033c9ccb082440620e864fa5f2902a71a2a2
|
data/README.md
CHANGED
@@ -22,6 +22,14 @@ Domain and Range entailment include specific rules for schema.org vocabularies.
|
|
22
22
|
* If `resource` is of type `schema:Role`, it is range acceptable if it has the same property with an acceptable value.
|
23
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.
|
24
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
|
+
|
25
33
|
## Examples
|
26
34
|
### Determine super-classes of a class
|
27
35
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
data/lib/rdf/reasoner.rb
CHANGED
@@ -6,7 +6,7 @@ module RDF
|
|
6
6
|
##
|
7
7
|
# RDFS/OWL reasonsing for RDF.rb.
|
8
8
|
#
|
9
|
-
# @see
|
9
|
+
# @see https://www.w3.org/TR/2013/REC-sparql11-entailment-20130321/
|
10
10
|
# @author [Gregg Kellogg](https://greggkellogg.net/)
|
11
11
|
module Reasoner
|
12
12
|
require 'rdf/reasoner/format'
|
@@ -15,7 +15,7 @@ module RDF
|
|
15
15
|
autoload :Schema, 'rdf/reasoner/schema'
|
16
16
|
autoload :VERSION, 'rdf/reasoner/version'
|
17
17
|
|
18
|
-
# See
|
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(^
|
@@ -34,9 +34,9 @@ module RDF
|
|
34
34
|
# @param [Hash{Symbol => Object}] options ({})
|
35
35
|
# @option options [Array<RDF::Vocabulary::Term>] :types
|
36
36
|
# Fully entailed types of resource, if not provided, they are queried
|
37
|
-
def domain_compatible?(resource, queryable,
|
37
|
+
def domain_compatible?(resource, queryable, options = {})
|
38
38
|
%w(owl rdfs schema).map {|r| "domain_compatible_#{r}?".to_sym}.all? do |meth|
|
39
|
-
!self.respond_to?(meth) || self.send(meth, resource, queryable,
|
39
|
+
!self.respond_to?(meth) || self.send(meth, resource, queryable, options)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -50,9 +50,9 @@ module RDF
|
|
50
50
|
# @param [Hash{Symbol => Object}] options ({})
|
51
51
|
# @option options [Array<RDF::Vocabulary::Term>] :types
|
52
52
|
# Fully entailed types of resource, if not provided, they are queried
|
53
|
-
def range_compatible?(resource, queryable,
|
53
|
+
def range_compatible?(resource, queryable, options = {})
|
54
54
|
%w(owl rdfs schema).map {|r| "range_compatible_#{r}?".to_sym}.all? do |meth|
|
55
|
-
!self.respond_to?(meth) || self.send(meth, resource, queryable,
|
55
|
+
!self.respond_to?(meth) || self.send(meth, resource, queryable, options)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -89,7 +89,7 @@ module RDF
|
|
89
89
|
# @param [Hash{Symbol => Object}] options ({})
|
90
90
|
# @option options [Array<RDF::Vocabulary::Term>] :types
|
91
91
|
# Fully entailed types of resource, if not provided, they are queried
|
92
|
-
def domain_compatible?(resource, queryable,
|
92
|
+
def domain_compatible?(resource, queryable, options = {})
|
93
93
|
%w(owl rdfs schema).map {|r| "domain_compatible_#{r}?".to_sym}.all? do |meth|
|
94
94
|
!self.respond_to?(meth) || self.send(meth, resource, queryable, **options)
|
95
95
|
end
|
@@ -105,9 +105,9 @@ module RDF
|
|
105
105
|
# @param [Hash{Symbol => Object}] options ({})
|
106
106
|
# @option options [Array<RDF::Vocabulary::Term>] :types
|
107
107
|
# Fully entailed types of resource, if not provided, they are queried
|
108
|
-
def range_compatible?(resource, queryable,
|
108
|
+
def range_compatible?(resource, queryable, options = {})
|
109
109
|
%w(owl rdfs schema).map {|r| "range_compatible_#{r}?".to_sym}.all? do |meth|
|
110
|
-
!self.respond_to?(meth) || self.send(meth, resource, queryable,
|
110
|
+
!self.respond_to?(meth) || self.send(meth, resource, queryable, options)
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|
data/lib/rdf/reasoner/rdfs.rb
CHANGED
@@ -122,7 +122,7 @@ module RDF::Reasoner
|
|
122
122
|
|
123
123
|
##
|
124
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
|
125
|
-
# For a Statement: yield or return inferred statements having a subPropertyOf relationship to predicate of this
|
125
|
+
# For a Statement: yield or return inferred statements having a subPropertyOf relationship to predicate of this statements
|
126
126
|
# @private
|
127
127
|
def _entail_subPropertyOf
|
128
128
|
case self
|
@@ -249,7 +249,7 @@ module RDF::Reasoner
|
|
249
249
|
# @param [Hash{Symbol => Object}] options ({})
|
250
250
|
# @option options [Array<RDF::Vocabulary::Term>] :types
|
251
251
|
# Fully entailed types of resource, if not provided, they are queried
|
252
|
-
def domain_compatible_rdfs?(resource, queryable,
|
252
|
+
def domain_compatible_rdfs?(resource, queryable, options = {})
|
253
253
|
raise RDF::Reasoner::Error, "#{self} can't get domains" unless property?
|
254
254
|
domains = Array(self.domain).reject(&:node?) - [RDF::OWL.Thing, RDF::RDFS.Resource]
|
255
255
|
|
@@ -276,7 +276,7 @@ module RDF::Reasoner
|
|
276
276
|
# @param [Hash{Symbol => Object}] options ({})
|
277
277
|
# @option options [Array<RDF::Vocabulary::Term>] :types
|
278
278
|
# Fully entailed types of resource, if not provided, they are queried
|
279
|
-
def range_compatible_rdfs?(resource, queryable,
|
279
|
+
def range_compatible_rdfs?(resource, queryable, options = {})
|
280
280
|
raise RDF::Reasoner::Error, "#{self} can't get ranges" unless property?
|
281
281
|
if !(ranges = Array(self.range).reject(&:node?) - [RDF::OWL.Thing, RDF::RDFS.Resource]).empty?
|
282
282
|
if resource.literal?
|
data/lib/rdf/reasoner/schema.rb
CHANGED
@@ -22,7 +22,7 @@ module RDF::Reasoner
|
|
22
22
|
# @param [Hash{Symbol => Object}] options
|
23
23
|
# @option options [Array<RDF::Vocabulary::Term>] :types
|
24
24
|
# Fully entailed types of resource, if not provided, they are queried
|
25
|
-
def domain_compatible_schema?(resource, queryable,
|
25
|
+
def domain_compatible_schema?(resource, queryable, options = {})
|
26
26
|
raise RDF::Reasoner::Error, "#{self} can't get domains" unless property?
|
27
27
|
domains = Array(self.domainIncludes) - [RDF::OWL.Thing]
|
28
28
|
|
@@ -52,7 +52,7 @@ module RDF::Reasoner
|
|
52
52
|
# @param [Hash{Symbol => Object}] options ({})
|
53
53
|
# @option options [Array<RDF::Vocabulary::Term>] :types
|
54
54
|
# Fully entailed types of resource, if not provided, they are queried
|
55
|
-
def range_compatible_schema?(resource, queryable,
|
55
|
+
def range_compatible_schema?(resource, queryable, options = {})
|
56
56
|
raise RDF::Reasoner::Error, "#{self} can't get ranges" unless property?
|
57
57
|
if !(ranges = Array(self.rangeIncludes) - [RDF::OWL.Thing]).empty?
|
58
58
|
if resource.literal?
|
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.6.
|
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:
|
11
|
+
date: 2020-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
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
|
@@ -24,6 +27,9 @@ dependencies:
|
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
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
|
@@ -31,6 +37,9 @@ dependencies:
|
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
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
|
@@ -38,6 +47,9 @@ dependencies:
|
|
38
47
|
- - "~>"
|
39
48
|
- !ruby/object:Gem::Version
|
40
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
|
@@ -175,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
187
|
- !ruby/object:Gem::Version
|
176
188
|
version: '0'
|
177
189
|
requirements: []
|
178
|
-
rubygems_version: 3.
|
190
|
+
rubygems_version: 3.1.3
|
179
191
|
signing_key:
|
180
192
|
specification_version: 4
|
181
193
|
summary: RDFS/OWL Reasoner for RDF.rb
|