pomegranate 0.9
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.
- data/README.markdown +77 -0
- data/Rakefile +22 -0
- data/coverage/index.html +279 -0
- data/coverage/lib-pomegranate-rdfs_plus_rulebook_rb.html +951 -0
- data/coverage/lib-pomegranate_rb.html +639 -0
- data/lib/pomegranate.rb +29 -0
- data/lib/pomegranate/rdfs_plus_rulebook.rb +327 -0
- data/lib/pomegranate/rdfs_rulebook.rb +188 -0
- data/pomegranate.gemspec +16 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/unit/owl_equivalent_class_spec.rb +42 -0
- data/spec/unit/owl_equivalent_property_spec.rb +45 -0
- data/spec/unit/owl_functional_property_spec.rb +42 -0
- data/spec/unit/owl_inverse_functional_property_spec.rb +41 -0
- data/spec/unit/owl_inverse_of_spec.rb +45 -0
- data/spec/unit/owl_same_as_spec.rb +51 -0
- data/spec/unit/owl_symmetric_property_spec.rb +42 -0
- data/spec/unit/owl_transitive_property_spec.rb +47 -0
- data/spec/unit/rdfs_domain_spec.rb +43 -0
- data/spec/unit/rdfs_range_spec.rb +45 -0
- data/spec/unit/rdfs_subclass_of_spec.rb +45 -0
- data/spec/unit/rdfs_subproperty_of_spec.rb +46 -0
- metadata +85 -0
data/pomegranate.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "pomegranate"
|
3
|
+
s.version = "0.9"
|
4
|
+
s.date = "2008-12-30"
|
5
|
+
s.summary = "RDF and OWL inference engine for Ruby."
|
6
|
+
s.email = "pius+github@uyiosa.com"
|
7
|
+
s.homepage = "http://github.com/pius/pomegranate"
|
8
|
+
s.description = "Pomegranate is a Ruby library for inferencing over a corpus of RDFS triples. Implements standard RDFS and RDFS-Plus."
|
9
|
+
s.has_rdoc = true
|
10
|
+
s.authors = ['Pius Uzamere']
|
11
|
+
s.files = ["README.markdown", "Rakefile", "pomegranate.gemspec", "lib/pomegranate.rb", "lib/pomegranate/rdfs_rulebook.rb", "lib/pomegranate/rdfs_plus_rulebook.rb", "coverage/index.html", "coverage/lib-pomegranate-rdfs_plus_rulebook_rb.html", "coverage/lib-pomegranate_rb.html"]
|
12
|
+
s.test_files = ["spec/spec.opts", "spec/spec_helper.rb", "spec/unit/owl_equivalent_class_spec.rb", "spec/unit/owl_equivalent_property_spec.rb", "spec/unit/owl_functional_property_spec.rb", "spec/unit/owl_inverse_functional_property_spec.rb", "spec/unit/owl_inverse_of_spec.rb", "spec/unit/owl_same_as_spec.rb", "spec/unit/owl_symmetric_property_spec.rb", "spec/unit/owl_transitive_property_spec.rb", "spec/unit/rdfs_domain_spec.rb", "spec/unit/rdfs_range_spec.rb", "spec/unit/rdfs_subclass_of_spec.rb", "spec/unit/rdfs_subproperty_of_spec.rb"]
|
13
|
+
#s.rdoc_options = ["--main", "README.txt"]
|
14
|
+
#s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
15
|
+
s.add_dependency("ruleby", [">= 0.4"])
|
16
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
class Pathname
|
5
|
+
def /(path)
|
6
|
+
(self + path).expand_path
|
7
|
+
end
|
8
|
+
end # class Pathname
|
9
|
+
|
10
|
+
spec_dir_path = Pathname(__FILE__).dirname.expand_path
|
11
|
+
require spec_dir_path.parent + 'lib/pomegranate'
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
# require fixture resources
|
16
|
+
Dir[spec_dir_path + "fixtures/*.rb"].each do |fixture_file|
|
17
|
+
require fixture_file
|
18
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file is part of Pomegranate
|
2
|
+
#
|
3
|
+
# Pomegranate is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# Pomegranate is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# along with Pomegranate. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require 'pathname'
|
17
|
+
require 'lib/pomegranate'
|
18
|
+
|
19
|
+
|
20
|
+
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
|
21
|
+
include Ruleby
|
22
|
+
|
23
|
+
describe "owl:equivalentClass", 'rule' do
|
24
|
+
|
25
|
+
before(:all) do
|
26
|
+
@e = engine :engine do |e|
|
27
|
+
RdfsPlusRulebook.new(e).rules
|
28
|
+
|
29
|
+
p = Triple.new("mit:class", "owl:equivalentClass", "mit:subject");
|
30
|
+
h = Triple.new(":6.170", "rdf:type", "mit:class");
|
31
|
+
e.assert p
|
32
|
+
e.assert h
|
33
|
+
e.match
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should understand class equivalence when a triple object is owl:equivalentClass another resource" do
|
38
|
+
fact = Triple.new(":6.170", "rdf:type", "mit:subject");
|
39
|
+
f = @e.facts.select {|t| t.subject == ":6.170"}
|
40
|
+
f.should include(fact)
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# This file is part of Pomegranate
|
2
|
+
#
|
3
|
+
# Pomegranate is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# Pomegranate is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# along with Pomegranate. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require 'pathname'
|
17
|
+
#require 'ruleby'
|
18
|
+
require 'lib/pomegranate'
|
19
|
+
# require 'lib/pomegranate/rdfs_rulebook'
|
20
|
+
# require 'lib/pomegranate/rdfsplus_rulebook'
|
21
|
+
|
22
|
+
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
|
23
|
+
include Ruleby
|
24
|
+
|
25
|
+
describe "owl:equivalentProperty", 'rule' do
|
26
|
+
|
27
|
+
before(:all) do
|
28
|
+
@e = engine :engine do |e|
|
29
|
+
RdfsPlusRulebook.new(e).rules
|
30
|
+
|
31
|
+
p = Triple.new("mit:took_class", "owl:equivalentProperty", "mit:took_course");
|
32
|
+
h = Triple.new(":Pius", "mit:took_course", ":6.171");
|
33
|
+
|
34
|
+
e.assert p
|
35
|
+
e.assert h
|
36
|
+
e.match
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should understand property equivalence when a property is owl:equivalentProperty to another" do
|
41
|
+
fact = Triple.new(":Pius", "mit:took_class", ":6.171");
|
42
|
+
f = @e.facts.select {|t| t.subject == ":Pius"}
|
43
|
+
f.should include(fact)
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file is part of Pomegranate
|
2
|
+
#
|
3
|
+
# Pomegranate is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# Pomegranate is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# along with Pomegranate. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require 'pathname'
|
17
|
+
require 'lib/pomegranate'
|
18
|
+
|
19
|
+
|
20
|
+
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
|
21
|
+
include Ruleby
|
22
|
+
|
23
|
+
describe "owl:FunctionalProperty", 'rule' do
|
24
|
+
|
25
|
+
before(:all) do
|
26
|
+
@e = engine :engine do |e|
|
27
|
+
RdfsPlusRulebook.new(e).rules
|
28
|
+
|
29
|
+
p = Triple.new("mit:had_academic_advisor", "rdf:type", "owl:FunctionalProperty");
|
30
|
+
h = Triple.new(":Pius", "mit:had_academic_advisor", ":Hal");
|
31
|
+
d = Triple.new(":Pius", "mit:had_academic_advisor", ":Dude_Who_Wrote_SICP_With_Gerald_Sussman");
|
32
|
+
e.assert p; e.assert h; e.assert d;
|
33
|
+
e.match
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should be able to deduce sameness" do
|
38
|
+
fact = Triple.new(":Hal", "owl:sameAs", ":Dude_Who_Wrote_SICP_With_Gerald_Sussman");
|
39
|
+
f = @e.facts.select {|t| t.subject == ":Hal"}
|
40
|
+
f.should include(fact)
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# This file is part of Pomegranate
|
2
|
+
#
|
3
|
+
# Pomegranate is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# Pomegranate is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# along with Pomegranate. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require 'pathname'
|
17
|
+
require 'lib/pomegranate'
|
18
|
+
|
19
|
+
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
|
20
|
+
include Ruleby
|
21
|
+
|
22
|
+
describe "owl:InverseFunctionalProperty", 'rule' do
|
23
|
+
|
24
|
+
before(:all) do
|
25
|
+
@e = engine :engine do |e|
|
26
|
+
RdfsPlusRulebook.new(e).rules
|
27
|
+
|
28
|
+
p = Triple.new("mit:lived_alone_fall_2004_in", "rdf:type", "owl:InverseFunctionalProperty");
|
29
|
+
h = Triple.new(":Pius", "mit:lived_alone_fall_2004_in", ":pomegranate_314_at_Next_House");
|
30
|
+
d = Triple.new(":2004_UA_President", "mit:lived_alone_fall_2004_in", ":pomegranate_314_at_Next_House");
|
31
|
+
e.assert p; e.assert h; e.assert d;
|
32
|
+
e.match
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be able to deduce sameness" do
|
37
|
+
fact = Triple.new(":2004_UA_President", "owl:sameAs", ":Pius");
|
38
|
+
f = @e.facts.select {|t| t.subject == ":2004_UA_President"}
|
39
|
+
f.should include(fact)
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# This file is part of Pomegranate
|
2
|
+
#
|
3
|
+
# Pomegranate is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# Pomegranate is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# along with Pomegranate. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require 'pathname'
|
17
|
+
#require 'ruleby'
|
18
|
+
require 'lib/pomegranate'
|
19
|
+
# require 'lib/pomegranate/rdfs_rulebook'
|
20
|
+
# require 'lib/pomegranate/rdfsplus_rulebook'
|
21
|
+
|
22
|
+
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
|
23
|
+
include Ruleby
|
24
|
+
|
25
|
+
describe "owl:inverseOf", 'rule' do
|
26
|
+
|
27
|
+
before(:all) do
|
28
|
+
@e = engine :engine do |e|
|
29
|
+
RdfsPlusRulebook.new(e).rules
|
30
|
+
|
31
|
+
alpha = Triple.new(":Pius", ":took_a_class_taught_by", ":Winston")
|
32
|
+
beta = Triple.new(":took_a_class_taught_by", "owl:inverseOf", ":taught")
|
33
|
+
|
34
|
+
e.assert alpha
|
35
|
+
e.assert beta
|
36
|
+
e.match
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should understand individual equivalence when a triple object is owl:sameAs another resource" do
|
41
|
+
fact = Triple.new(":Winston", ":taught", ":Pius");
|
42
|
+
f = @e.facts.select {|t| t.subject == ":Winston"}
|
43
|
+
f.should include(fact)
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# This file is part of Pomegranate
|
2
|
+
#
|
3
|
+
# Pomegranate is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# Pomegranate is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# along with Pomegranate. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require 'pathname'
|
17
|
+
#require 'ruleby'
|
18
|
+
require 'lib/pomegranate'
|
19
|
+
# require 'lib/pomegranate/rdfs_rulebook'
|
20
|
+
# require 'lib/pomegranate/rdfsplus_rulebook'
|
21
|
+
|
22
|
+
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
|
23
|
+
include Ruleby
|
24
|
+
|
25
|
+
describe "owl:sameAs", 'rule' do
|
26
|
+
|
27
|
+
before(:all) do
|
28
|
+
@e = engine :engine do |e|
|
29
|
+
RdfsPlusRulebook.new(e).rules
|
30
|
+
p = Triple.new(":Pius", "mit:took_class_at", ":The_Media_Lab");
|
31
|
+
h = Triple.new(":Pius", "owl:sameAs", ":Uzamere");
|
32
|
+
d = Triple.new(":The_Media_Lab", "owl:sameAs", ":Media_Lab");
|
33
|
+
e.assert h
|
34
|
+
e.assert p
|
35
|
+
e.assert d
|
36
|
+
e.match
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should understand individual equivalence when a triple subject is owl:sameAs another resource" do
|
41
|
+
fact = Triple.new(":Uzamere", "mit:took_class_at", ":The_Media_Lab");
|
42
|
+
f = @e.facts.select {|t| t.subject == ":Uzamere"}
|
43
|
+
f.should include(fact)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should understand individual equivalence when a triple object is owl:sameAs another resource" do
|
47
|
+
fact = Triple.new(":Pius", "mit:took_class_at", ":Media_Lab");
|
48
|
+
f = @e.facts.select {|t| t.subject == ":Pius"}
|
49
|
+
f.should include(fact)
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file is part of Pomegranate
|
2
|
+
#
|
3
|
+
# Pomegranate is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# Pomegranate is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# along with Pomegranate. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require 'pathname'
|
17
|
+
require 'lib/pomegranate'
|
18
|
+
|
19
|
+
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
|
20
|
+
include Ruleby
|
21
|
+
|
22
|
+
describe "owl:SymmetricProperty", 'rule' do
|
23
|
+
|
24
|
+
before(:all) do
|
25
|
+
@e = engine :engine do |e|
|
26
|
+
RdfsPlusRulebook.new(e).rules
|
27
|
+
|
28
|
+
eta = Triple.new(":Pius", ":was_in_a_class_with", ":Adam");
|
29
|
+
zeta = Triple.new(":was_in_a_class_with", "rdf:type", "owl:SymmetricProperty")
|
30
|
+
|
31
|
+
e.assert zeta
|
32
|
+
e.assert eta
|
33
|
+
e.match
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should understand individual equivalence when a triple object is owl:sameAs another resource" do
|
38
|
+
fact = Triple.new(":Adam", ":was_in_a_class_with", ":Pius");
|
39
|
+
f = @e.facts.select {|t| t.subject == ":Adam"}
|
40
|
+
f.should include(fact)
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# This file is part of Pomegranate
|
2
|
+
#
|
3
|
+
# Pomegranate is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# Pomegranate is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# along with Pomegranate. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require 'pathname'
|
17
|
+
#require 'ruleby'
|
18
|
+
require 'lib/pomegranate'
|
19
|
+
# require 'lib/pomegranate/rdfs_rulebook'
|
20
|
+
# require 'lib/pomegranate/rdfsplus_rulebook'
|
21
|
+
|
22
|
+
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
|
23
|
+
include Ruleby
|
24
|
+
|
25
|
+
describe "owl:TransitiveProperty", 'rule' do
|
26
|
+
|
27
|
+
before(:all) do
|
28
|
+
@e = engine :engine do |e|
|
29
|
+
RdfsPlusRulebook.new(e).rules
|
30
|
+
|
31
|
+
p = Triple.new(":Dirichlet", ":is_an_academic_ancestor_of", ":Minsky");
|
32
|
+
h = Triple.new(":Poisson", ":is_an_academic_ancestor_of", ":Dirichlet");
|
33
|
+
j = Triple.new(":is_an_academic_ancestor_of", "rdf:type", "owl:TransitiveProperty");
|
34
|
+
|
35
|
+
e.assert p
|
36
|
+
e.assert h
|
37
|
+
e.assert j
|
38
|
+
e.match
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should understand transitivity when a property is an owl:TransitiveProperty" do
|
43
|
+
fact = Triple.new(":Poisson", ":is_an_academic_ancestor_of", ":Minsky");
|
44
|
+
f = @e.facts.select {|t| t.subject == ":Poisson"}
|
45
|
+
f.should include(fact)
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# This file is part of Pomegranate
|
2
|
+
#
|
3
|
+
# Pomegranate is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# Pomegranate is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# along with Pomegranate. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require 'pathname'
|
17
|
+
require 'lib/pomegranate'
|
18
|
+
|
19
|
+
|
20
|
+
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
|
21
|
+
include Ruleby
|
22
|
+
|
23
|
+
describe "rdfs:domain", 'rule' do
|
24
|
+
|
25
|
+
before(:all) do
|
26
|
+
@e = engine :engine do |e|
|
27
|
+
RdfsPlusRulebook.new(e).rules
|
28
|
+
|
29
|
+
a = Triple.new("mit:majored_in", "rdfs:domain", ":student");
|
30
|
+
b = Triple.new(":Pius", "mit:majored_in", ":Course_17")
|
31
|
+
|
32
|
+
e.assert a
|
33
|
+
e.assert b
|
34
|
+
e.match
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should understand domains" do
|
39
|
+
fact = Triple.new(":Pius", "rdf:type", ":student")
|
40
|
+
f = @e.facts.select {|t| t.subject == ":Pius"}
|
41
|
+
f.should include(fact)
|
42
|
+
end
|
43
|
+
end
|