pomegranate 0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,77 @@
1
+ Pomegranate Release 0.9 (December 30th 2008)
2
+ ===================================
3
+
4
+ **Git**: [http://github.com/pius/pomegranate](http://github.com/pius/pomegranate)
5
+ **Author**: Pius Uzamere, [The Uyiosa Corporation](http://www.uyiosa.com)
6
+
7
+ **Copyright**: Pius Uzamere © 2008
8
+ **License**: The Lesser GNU Public License
9
+
10
+
11
+ SYNOPSIS
12
+ --------
13
+
14
+ Pomegranate is a Ruby library for inferencing over a corpus of triples with RDFS and OWL properties. Implements the [RDF Schema Language (RDFs)](http://www.w3.org/TR/rdf-schema/) properties as a set of production rules. The rules are executed by [Ruleby](http://ruleby.org), a forward-chaining Ruby inferencing engine that implements the Rete algorithm.
15
+
16
+
17
+ FEATURE LIST
18
+ ------------
19
+
20
+ 1. **Pomegranate can inference over basic RDFS**: When finished, this library will have a full test suite and can serve as a maintainable reference implementation of an RDFS inferencer in Ruby. In particular, the following statements are supported:
21
+
22
+ * rdfs:subClassOf
23
+ * rdfs:subPropertyOf
24
+ * rdfs:domain
25
+ * rdfs:range
26
+
27
+
28
+ 2. **Pomegranate can inference over RDFS-Plus (RDFS plus a small subset of OWL)**: RDFS-Plus, as defined in "Semantic Web for the Working Ontologist" is RDFS plus a small subset of OWL, commonly used in the field. In particular, the following statements are supported:
29
+
30
+ * rdfs:subClassOf
31
+ * rdfs:subPropertyOf
32
+ * rdfs:domain
33
+ * rdfs:range
34
+ * owl:inverseOf
35
+ * owl:SymmetricProperty
36
+ * owl:TransitiveProperty
37
+ * owl:equivalentClass
38
+ * owl:equivalentProperty
39
+ * owl:sameAs
40
+ * owl:FunctionalProperty
41
+ * owl:InverseFunctionalProperty
42
+
43
+
44
+ USAGE
45
+ -----
46
+
47
+ 1. **Make Sure You've Got the Dependencies installed**
48
+
49
+ Pomegranate depends on Ruleby (http://ruleby.org).
50
+
51
+ > sudo gem install ruleby
52
+
53
+ 2. **Clone the Repository and Install the Gem from Source**
54
+
55
+ > git clone git://github.com/pius/pomegranate.git
56
+ > cd pomegranate
57
+ > gem build pomegranate.gemspec
58
+ > sudo gem install pomegranate
59
+
60
+
61
+ 3. **Require the gem in your code, play with it**
62
+
63
+ For usage, the best thing is to click through the [documentation](http://pius.github.com/pomegranate). I tried to make it really thorough. If you need more guidance, check out the specs, which demonstrate precisely how to instantiate triples and run the inferencing engine.
64
+
65
+
66
+ 4. **Contribute!**
67
+
68
+ Fork my repository (http://github.com/pius/pomegranate), make some changes, and send along a pull request!
69
+
70
+ The best way to contribute is to add a unit test for a specific OWL property that does not parse and then add (and/or tweak) rules such that your new test case plus all the others pass.
71
+
72
+
73
+ COPYRIGHT
74
+ ---------
75
+
76
+ Pomegranate was created in 2008 by Pius Uzamere (pius -AT- alum -DOT- mit -DOT- edu) and is
77
+ licensed under the LGPL.
@@ -0,0 +1,22 @@
1
+ require 'rubygems'
2
+ require 'spec'
3
+ require 'rake/clean'
4
+ require 'spec/rake/spectask'
5
+ require 'pathname'
6
+
7
+ task :default => [ :spec ]
8
+
9
+ desc 'Run specifications'
10
+ Spec::Rake::SpecTask.new(:spec) do |t|
11
+ t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
12
+ t.spec_files = Pathname.glob(Pathname.new(__FILE__).dirname + 'spec/**/*_spec.rb')
13
+
14
+ begin
15
+ t.rcov = ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true
16
+ t.rcov_opts << '--exclude' << 'spec'
17
+ t.rcov_opts << '--text-summary'
18
+ t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
19
+ rescue Exception
20
+ # rcov not installed
21
+ end
22
+ end
@@ -0,0 +1,279 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>C0 code coverage information</title>
3
+ <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style>
4
+ <style type='text/css'>span.cross-ref-title {
5
+ font-size: 140%;
6
+ }
7
+ span.cross-ref a {
8
+ text-decoration: none;
9
+ }
10
+ span.cross-ref {
11
+ background-color:#f3f7fa;
12
+ border: 1px dashed #333;
13
+ margin: 1em;
14
+ padding: 0.5em;
15
+ overflow: hidden;
16
+ }
17
+ a.crossref-toggle {
18
+ text-decoration: none;
19
+ }
20
+ span.marked0 {
21
+ background-color: rgb(185, 210, 200);
22
+ display: block;
23
+ }
24
+ span.marked1 {
25
+ background-color: rgb(190, 215, 205);
26
+ display: block;
27
+ }
28
+ span.inferred0 {
29
+ background-color: rgb(255, 255, 240);
30
+ display: block;
31
+ }
32
+ span.inferred1 {
33
+ background-color: rgb(255, 255, 240);
34
+ display: block;
35
+ }
36
+ span.uncovered0 {
37
+ background-color: rgb(225, 110, 110);
38
+ display: block;
39
+ }
40
+ span.uncovered1 {
41
+ background-color: rgb(235, 120, 120);
42
+ display: block;
43
+ }
44
+ span.overview {
45
+ border-bottom: 8px solid black;
46
+ }
47
+ div.overview {
48
+ border-bottom: 8px solid black;
49
+ }
50
+ body {
51
+ font-family: verdana, arial, helvetica;
52
+ }
53
+ div.footer {
54
+ font-size: 68%;
55
+ margin-top: 1.5em;
56
+ }
57
+ h1, h2, h3, h4, h5, h6 {
58
+ margin-bottom: 0.5em;
59
+ }
60
+ h5 {
61
+ margin-top: 0.5em;
62
+ }
63
+ .hidden {
64
+ display: none;
65
+ }
66
+ div.separator {
67
+ height: 10px;
68
+ }
69
+ /* Commented out for better readability, esp. on IE */
70
+ /*
71
+ table tr td, table tr th {
72
+ font-size: 68%;
73
+ }
74
+ td.value table tr td {
75
+ font-size: 11px;
76
+ }
77
+ */
78
+ table.percent_graph {
79
+ height: 12px;
80
+ border: #808080 1px solid;
81
+ empty-cells: show;
82
+ }
83
+ table.percent_graph td.covered {
84
+ height: 10px;
85
+ background: #00f000;
86
+ }
87
+ table.percent_graph td.uncovered {
88
+ height: 10px;
89
+ background: #e00000;
90
+ }
91
+ table.percent_graph td.NA {
92
+ height: 10px;
93
+ background: #eaeaea;
94
+ }
95
+ table.report {
96
+ border-collapse: collapse;
97
+ width: 100%;
98
+ }
99
+ table.report td.heading {
100
+ background: #dcecff;
101
+ border: #d0d0d0 1px solid;
102
+ font-weight: bold;
103
+ text-align: center;
104
+ }
105
+ table.report td.heading:hover {
106
+ background: #c0ffc0;
107
+ }
108
+ table.report td.text {
109
+ border: #d0d0d0 1px solid;
110
+ }
111
+ table.report td.value,
112
+ table.report td.lines_total,
113
+ table.report td.lines_code {
114
+ text-align: right;
115
+ border: #d0d0d0 1px solid;
116
+ }
117
+ table.report tr.light {
118
+ background-color: rgb(240, 240, 245);
119
+ }
120
+ table.report tr.dark {
121
+ background-color: rgb(230, 230, 235);
122
+ }
123
+ </style>
124
+ <script type='text/javascript'>
125
+ // <![CDATA[
126
+ function toggleCode( id ) {
127
+ if ( document.getElementById )
128
+ elem = document.getElementById( id );
129
+ else if ( document.all )
130
+ elem = eval( "document.all." + id );
131
+ else
132
+ return false;
133
+
134
+ elemStyle = elem.style;
135
+
136
+ if ( elemStyle.display != "block" ) {
137
+ elemStyle.display = "block"
138
+ } else {
139
+ elemStyle.display = "none"
140
+ }
141
+
142
+ return true;
143
+ }
144
+
145
+ // Make cross-references hidden by default
146
+ document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" )
147
+ // ]]>
148
+ </script>
149
+ </head>
150
+ <body><h3>C0 code coverage information</h3>
151
+ <p>Generated on Tue Dec 30 10:28:10 -0500 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.3</a>
152
+ </p>
153
+ <hr/>
154
+ <table class='report'><thead><tr><td class='heading'>Name</td>
155
+ <td class='heading'>Total lines</td>
156
+ <td class='heading'>Lines of code</td>
157
+ <td class='heading'>Total coverage</td>
158
+ <td class='heading'>Code coverage</td>
159
+ </tr>
160
+ </thead>
161
+ <tbody><tr class='light'><td>TOTAL</td>
162
+ <td class='lines_total'><tt>558</tt>
163
+ </td>
164
+ <td class='lines_code'><tt>203</tt>
165
+ </td>
166
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>98.9%</tt>
167
+ &nbsp;</td>
168
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='99'/>
169
+ <td class='uncovered' width='1'/>
170
+ </tr>
171
+ </table>
172
+ </td>
173
+ </tr>
174
+ </table>
175
+ </td>
176
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>97.5%</tt>
177
+ &nbsp;</td>
178
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='98'/>
179
+ <td class='uncovered' width='2'/>
180
+ </tr>
181
+ </table>
182
+ </td>
183
+ </tr>
184
+ </table>
185
+ </td>
186
+ </tr>
187
+ <tr class='dark'><td><a href='lib-pomegranate_rb.html'>lib/pomegranate.rb</a>
188
+ </td>
189
+ <td class='lines_total'><tt>29</tt>
190
+ </td>
191
+ <td class='lines_code'><tt>11</tt>
192
+ </td>
193
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt>
194
+ &nbsp;</td>
195
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/>
196
+ <td class='uncovered' width='0'/>
197
+ </tr>
198
+ </table>
199
+ </td>
200
+ </tr>
201
+ </table>
202
+ </td>
203
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt>
204
+ &nbsp;</td>
205
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/>
206
+ <td class='uncovered' width='0'/>
207
+ </tr>
208
+ </table>
209
+ </td>
210
+ </tr>
211
+ </table>
212
+ </td>
213
+ </tr>
214
+ <tr class='light'><td><a href='lib-pomegranate-rdfs_plus_rulebook_rb.html'>lib/pomegranate/rdfs_plus_rulebook.rb</a>
215
+ </td>
216
+ <td class='lines_total'><tt>341</tt>
217
+ </td>
218
+ <td class='lines_code'><tt>116</tt>
219
+ </td>
220
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>98.8%</tt>
221
+ &nbsp;</td>
222
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='99'/>
223
+ <td class='uncovered' width='1'/>
224
+ </tr>
225
+ </table>
226
+ </td>
227
+ </tr>
228
+ </table>
229
+ </td>
230
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>97.4%</tt>
231
+ &nbsp;</td>
232
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='97'/>
233
+ <td class='uncovered' width='3'/>
234
+ </tr>
235
+ </table>
236
+ </td>
237
+ </tr>
238
+ </table>
239
+ </td>
240
+ </tr>
241
+ <tr class='dark'><td><a href='lib-pomegranate-rdfs_rulebook_rb.html'>lib/pomegranate/rdfs_rulebook.rb</a>
242
+ </td>
243
+ <td class='lines_total'><tt>188</tt>
244
+ </td>
245
+ <td class='lines_code'><tt>76</tt>
246
+ </td>
247
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>98.9%</tt>
248
+ &nbsp;</td>
249
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='99'/>
250
+ <td class='uncovered' width='1'/>
251
+ </tr>
252
+ </table>
253
+ </td>
254
+ </tr>
255
+ </table>
256
+ </td>
257
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>97.4%</tt>
258
+ &nbsp;</td>
259
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='97'/>
260
+ <td class='uncovered' width='3'/>
261
+ </tr>
262
+ </table>
263
+ </td>
264
+ </tr>
265
+ </table>
266
+ </td>
267
+ </tr>
268
+ </tbody>
269
+ </table>
270
+ <hr/>
271
+ <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a>
272
+ version 0.8.1.3.</p>
273
+ <p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml11' height='31' alt='Valid XHTML 1.1!' width='88'/>
274
+ </a>
275
+ <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/>
276
+ </a>
277
+ </p>
278
+ </body>
279
+ </html>
@@ -0,0 +1,951 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/pomegranate/rdfs_plus_rulebook.rb - C0 code coverage information</title>
3
+ <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style>
4
+ <style type='text/css'>span.cross-ref-title {
5
+ font-size: 140%;
6
+ }
7
+ span.cross-ref a {
8
+ text-decoration: none;
9
+ }
10
+ span.cross-ref {
11
+ background-color:#f3f7fa;
12
+ border: 1px dashed #333;
13
+ margin: 1em;
14
+ padding: 0.5em;
15
+ overflow: hidden;
16
+ }
17
+ a.crossref-toggle {
18
+ text-decoration: none;
19
+ }
20
+ span.marked0 {
21
+ background-color: rgb(185, 210, 200);
22
+ display: block;
23
+ }
24
+ span.marked1 {
25
+ background-color: rgb(190, 215, 205);
26
+ display: block;
27
+ }
28
+ span.inferred0 {
29
+ background-color: rgb(255, 255, 240);
30
+ display: block;
31
+ }
32
+ span.inferred1 {
33
+ background-color: rgb(255, 255, 240);
34
+ display: block;
35
+ }
36
+ span.uncovered0 {
37
+ background-color: rgb(225, 110, 110);
38
+ display: block;
39
+ }
40
+ span.uncovered1 {
41
+ background-color: rgb(235, 120, 120);
42
+ display: block;
43
+ }
44
+ span.overview {
45
+ border-bottom: 8px solid black;
46
+ }
47
+ div.overview {
48
+ border-bottom: 8px solid black;
49
+ }
50
+ body {
51
+ font-family: verdana, arial, helvetica;
52
+ }
53
+ div.footer {
54
+ font-size: 68%;
55
+ margin-top: 1.5em;
56
+ }
57
+ h1, h2, h3, h4, h5, h6 {
58
+ margin-bottom: 0.5em;
59
+ }
60
+ h5 {
61
+ margin-top: 0.5em;
62
+ }
63
+ .hidden {
64
+ display: none;
65
+ }
66
+ div.separator {
67
+ height: 10px;
68
+ }
69
+ /* Commented out for better readability, esp. on IE */
70
+ /*
71
+ table tr td, table tr th {
72
+ font-size: 68%;
73
+ }
74
+ td.value table tr td {
75
+ font-size: 11px;
76
+ }
77
+ */
78
+ table.percent_graph {
79
+ height: 12px;
80
+ border: #808080 1px solid;
81
+ empty-cells: show;
82
+ }
83
+ table.percent_graph td.covered {
84
+ height: 10px;
85
+ background: #00f000;
86
+ }
87
+ table.percent_graph td.uncovered {
88
+ height: 10px;
89
+ background: #e00000;
90
+ }
91
+ table.percent_graph td.NA {
92
+ height: 10px;
93
+ background: #eaeaea;
94
+ }
95
+ table.report {
96
+ border-collapse: collapse;
97
+ width: 100%;
98
+ }
99
+ table.report td.heading {
100
+ background: #dcecff;
101
+ border: #d0d0d0 1px solid;
102
+ font-weight: bold;
103
+ text-align: center;
104
+ }
105
+ table.report td.heading:hover {
106
+ background: #c0ffc0;
107
+ }
108
+ table.report td.text {
109
+ border: #d0d0d0 1px solid;
110
+ }
111
+ table.report td.value,
112
+ table.report td.lines_total,
113
+ table.report td.lines_code {
114
+ text-align: right;
115
+ border: #d0d0d0 1px solid;
116
+ }
117
+ table.report tr.light {
118
+ background-color: rgb(240, 240, 245);
119
+ }
120
+ table.report tr.dark {
121
+ background-color: rgb(230, 230, 235);
122
+ }
123
+ </style>
124
+ <script type='text/javascript'>
125
+ // <![CDATA[
126
+ function toggleCode( id ) {
127
+ if ( document.getElementById )
128
+ elem = document.getElementById( id );
129
+ else if ( document.all )
130
+ elem = eval( "document.all." + id );
131
+ else
132
+ return false;
133
+
134
+ elemStyle = elem.style;
135
+
136
+ if ( elemStyle.display != "block" ) {
137
+ elemStyle.display = "block"
138
+ } else {
139
+ elemStyle.display = "none"
140
+ }
141
+
142
+ return true;
143
+ }
144
+
145
+ // Make cross-references hidden by default
146
+ document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" )
147
+ // ]]>
148
+ </script>
149
+ <style type='text/css'>span.run0 {
150
+ background-color: rgb(178, 204, 255);
151
+ display: block;
152
+ }
153
+ span.run1 {
154
+ background-color: rgb(178, 206, 255);
155
+ display: block;
156
+ }
157
+ span.run2 {
158
+ background-color: rgb(178, 209, 255);
159
+ display: block;
160
+ }
161
+ span.run3 {
162
+ background-color: rgb(178, 211, 255);
163
+ display: block;
164
+ }
165
+ span.run4 {
166
+ background-color: rgb(178, 214, 255);
167
+ display: block;
168
+ }
169
+ span.run5 {
170
+ background-color: rgb(178, 218, 255);
171
+ display: block;
172
+ }
173
+ span.run6 {
174
+ background-color: rgb(178, 220, 255);
175
+ display: block;
176
+ }
177
+ span.run7 {
178
+ background-color: rgb(178, 223, 255);
179
+ display: block;
180
+ }
181
+ span.run8 {
182
+ background-color: rgb(178, 225, 255);
183
+ display: block;
184
+ }
185
+ span.run9 {
186
+ background-color: rgb(178, 228, 255);
187
+ display: block;
188
+ }
189
+ span.run10 {
190
+ background-color: rgb(178, 232, 255);
191
+ display: block;
192
+ }
193
+ span.run11 {
194
+ background-color: rgb(178, 234, 255);
195
+ display: block;
196
+ }
197
+ span.run12 {
198
+ background-color: rgb(178, 237, 255);
199
+ display: block;
200
+ }
201
+ span.run13 {
202
+ background-color: rgb(178, 239, 255);
203
+ display: block;
204
+ }
205
+ span.run14 {
206
+ background-color: rgb(178, 242, 255);
207
+ display: block;
208
+ }
209
+ span.run15 {
210
+ background-color: rgb(178, 246, 255);
211
+ display: block;
212
+ }
213
+ span.run16 {
214
+ background-color: rgb(178, 248, 255);
215
+ display: block;
216
+ }
217
+ span.run17 {
218
+ background-color: rgb(178, 251, 255);
219
+ display: block;
220
+ }
221
+ span.run18 {
222
+ background-color: rgb(178, 253, 255);
223
+ display: block;
224
+ }
225
+ span.run19 {
226
+ background-color: rgb(178, 255, 253);
227
+ display: block;
228
+ }
229
+ span.run20 {
230
+ background-color: rgb(178, 255, 249);
231
+ display: block;
232
+ }
233
+ span.run21 {
234
+ background-color: rgb(178, 255, 247);
235
+ display: block;
236
+ }
237
+ span.run22 {
238
+ background-color: rgb(178, 255, 244);
239
+ display: block;
240
+ }
241
+ span.run23 {
242
+ background-color: rgb(178, 255, 242);
243
+ display: block;
244
+ }
245
+ span.run24 {
246
+ background-color: rgb(178, 255, 239);
247
+ display: block;
248
+ }
249
+ span.run25 {
250
+ background-color: rgb(178, 255, 235);
251
+ display: block;
252
+ }
253
+ span.run26 {
254
+ background-color: rgb(178, 255, 233);
255
+ display: block;
256
+ }
257
+ span.run27 {
258
+ background-color: rgb(178, 255, 230);
259
+ display: block;
260
+ }
261
+ span.run28 {
262
+ background-color: rgb(178, 255, 228);
263
+ display: block;
264
+ }
265
+ span.run29 {
266
+ background-color: rgb(178, 255, 225);
267
+ display: block;
268
+ }
269
+ span.run30 {
270
+ background-color: rgb(178, 255, 221);
271
+ display: block;
272
+ }
273
+ span.run31 {
274
+ background-color: rgb(178, 255, 219);
275
+ display: block;
276
+ }
277
+ span.run32 {
278
+ background-color: rgb(178, 255, 216);
279
+ display: block;
280
+ }
281
+ span.run33 {
282
+ background-color: rgb(178, 255, 214);
283
+ display: block;
284
+ }
285
+ span.run34 {
286
+ background-color: rgb(178, 255, 211);
287
+ display: block;
288
+ }
289
+ span.run35 {
290
+ background-color: rgb(178, 255, 207);
291
+ display: block;
292
+ }
293
+ span.run36 {
294
+ background-color: rgb(178, 255, 205);
295
+ display: block;
296
+ }
297
+ span.run37 {
298
+ background-color: rgb(178, 255, 202);
299
+ display: block;
300
+ }
301
+ span.run38 {
302
+ background-color: rgb(178, 255, 200);
303
+ display: block;
304
+ }
305
+ span.run39 {
306
+ background-color: rgb(178, 255, 197);
307
+ display: block;
308
+ }
309
+ span.run40 {
310
+ background-color: rgb(178, 255, 193);
311
+ display: block;
312
+ }
313
+ span.run41 {
314
+ background-color: rgb(178, 255, 191);
315
+ display: block;
316
+ }
317
+ span.run42 {
318
+ background-color: rgb(178, 255, 188);
319
+ display: block;
320
+ }
321
+ span.run43 {
322
+ background-color: rgb(178, 255, 186);
323
+ display: block;
324
+ }
325
+ span.run44 {
326
+ background-color: rgb(178, 255, 183);
327
+ display: block;
328
+ }
329
+ span.run45 {
330
+ background-color: rgb(178, 255, 179);
331
+ display: block;
332
+ }
333
+ span.run46 {
334
+ background-color: rgb(179, 255, 178);
335
+ display: block;
336
+ }
337
+ span.run47 {
338
+ background-color: rgb(182, 255, 178);
339
+ display: block;
340
+ }
341
+ span.run48 {
342
+ background-color: rgb(184, 255, 178);
343
+ display: block;
344
+ }
345
+ span.run49 {
346
+ background-color: rgb(187, 255, 178);
347
+ display: block;
348
+ }
349
+ span.run50 {
350
+ background-color: rgb(191, 255, 178);
351
+ display: block;
352
+ }
353
+ span.run51 {
354
+ background-color: rgb(193, 255, 178);
355
+ display: block;
356
+ }
357
+ span.run52 {
358
+ background-color: rgb(196, 255, 178);
359
+ display: block;
360
+ }
361
+ span.run53 {
362
+ background-color: rgb(198, 255, 178);
363
+ display: block;
364
+ }
365
+ span.run54 {
366
+ background-color: rgb(201, 255, 178);
367
+ display: block;
368
+ }
369
+ span.run55 {
370
+ background-color: rgb(205, 255, 178);
371
+ display: block;
372
+ }
373
+ span.run56 {
374
+ background-color: rgb(207, 255, 178);
375
+ display: block;
376
+ }
377
+ span.run57 {
378
+ background-color: rgb(210, 255, 178);
379
+ display: block;
380
+ }
381
+ span.run58 {
382
+ background-color: rgb(212, 255, 178);
383
+ display: block;
384
+ }
385
+ span.run59 {
386
+ background-color: rgb(215, 255, 178);
387
+ display: block;
388
+ }
389
+ span.run60 {
390
+ background-color: rgb(219, 255, 178);
391
+ display: block;
392
+ }
393
+ span.run61 {
394
+ background-color: rgb(221, 255, 178);
395
+ display: block;
396
+ }
397
+ span.run62 {
398
+ background-color: rgb(224, 255, 178);
399
+ display: block;
400
+ }
401
+ span.run63 {
402
+ background-color: rgb(226, 255, 178);
403
+ display: block;
404
+ }
405
+ span.run64 {
406
+ background-color: rgb(229, 255, 178);
407
+ display: block;
408
+ }
409
+ span.run65 {
410
+ background-color: rgb(233, 255, 178);
411
+ display: block;
412
+ }
413
+ span.run66 {
414
+ background-color: rgb(235, 255, 178);
415
+ display: block;
416
+ }
417
+ span.run67 {
418
+ background-color: rgb(238, 255, 178);
419
+ display: block;
420
+ }
421
+ span.run68 {
422
+ background-color: rgb(240, 255, 178);
423
+ display: block;
424
+ }
425
+ span.run69 {
426
+ background-color: rgb(243, 255, 178);
427
+ display: block;
428
+ }
429
+ span.run70 {
430
+ background-color: rgb(247, 255, 178);
431
+ display: block;
432
+ }
433
+ span.run71 {
434
+ background-color: rgb(249, 255, 178);
435
+ display: block;
436
+ }
437
+ span.run72 {
438
+ background-color: rgb(252, 255, 178);
439
+ display: block;
440
+ }
441
+ span.run73 {
442
+ background-color: rgb(255, 255, 178);
443
+ display: block;
444
+ }
445
+ span.run74 {
446
+ background-color: rgb(255, 252, 178);
447
+ display: block;
448
+ }
449
+ span.run75 {
450
+ background-color: rgb(255, 248, 178);
451
+ display: block;
452
+ }
453
+ span.run76 {
454
+ background-color: rgb(255, 246, 178);
455
+ display: block;
456
+ }
457
+ span.run77 {
458
+ background-color: rgb(255, 243, 178);
459
+ display: block;
460
+ }
461
+ span.run78 {
462
+ background-color: rgb(255, 240, 178);
463
+ display: block;
464
+ }
465
+ span.run79 {
466
+ background-color: rgb(255, 238, 178);
467
+ display: block;
468
+ }
469
+ span.run80 {
470
+ background-color: rgb(255, 234, 178);
471
+ display: block;
472
+ }
473
+ span.run81 {
474
+ background-color: rgb(255, 232, 178);
475
+ display: block;
476
+ }
477
+ span.run82 {
478
+ background-color: rgb(255, 229, 178);
479
+ display: block;
480
+ }
481
+ span.run83 {
482
+ background-color: rgb(255, 226, 178);
483
+ display: block;
484
+ }
485
+ span.run84 {
486
+ background-color: rgb(255, 224, 178);
487
+ display: block;
488
+ }
489
+ span.run85 {
490
+ background-color: rgb(255, 220, 178);
491
+ display: block;
492
+ }
493
+ span.run86 {
494
+ background-color: rgb(255, 218, 178);
495
+ display: block;
496
+ }
497
+ span.run87 {
498
+ background-color: rgb(255, 215, 178);
499
+ display: block;
500
+ }
501
+ span.run88 {
502
+ background-color: rgb(255, 212, 178);
503
+ display: block;
504
+ }
505
+ span.run89 {
506
+ background-color: rgb(255, 210, 178);
507
+ display: block;
508
+ }
509
+ span.run90 {
510
+ background-color: rgb(255, 206, 178);
511
+ display: block;
512
+ }
513
+ span.run91 {
514
+ background-color: rgb(255, 204, 178);
515
+ display: block;
516
+ }
517
+ span.run92 {
518
+ background-color: rgb(255, 201, 178);
519
+ display: block;
520
+ }
521
+ span.run93 {
522
+ background-color: rgb(255, 198, 178);
523
+ display: block;
524
+ }
525
+ span.run94 {
526
+ background-color: rgb(255, 196, 178);
527
+ display: block;
528
+ }
529
+ span.run95 {
530
+ background-color: rgb(255, 192, 178);
531
+ display: block;
532
+ }
533
+ span.run96 {
534
+ background-color: rgb(255, 189, 178);
535
+ display: block;
536
+ }
537
+ span.run97 {
538
+ background-color: rgb(255, 187, 178);
539
+ display: block;
540
+ }
541
+ span.run98 {
542
+ background-color: rgb(255, 184, 178);
543
+ display: block;
544
+ }
545
+ span.run99 {
546
+ background-color: rgb(255, 182, 178);
547
+ display: block;
548
+ }
549
+ span.run100 {
550
+ background-color: rgb(255, 178, 178);
551
+ display: block;
552
+ }
553
+ </style>
554
+ </head>
555
+ <body><h3>C0 code coverage information</h3>
556
+ <p>Generated on Tue Dec 30 10:28:11 -0500 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.3</a>
557
+ </p>
558
+ <hr/>
559
+ <pre><span class='marked0'>Code reported as executed by Ruby looks like this...
560
+ </span><span class='marked1'>and this: this line is also marked as covered.
561
+ </span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this,
562
+ </span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).
563
+ </span><span class='uncovered0'>Finally, here&apos;s a line marked as not executed.
564
+ </span></pre>
565
+ <table class='report'><thead><tr><td class='heading'>Name</td>
566
+ <td class='heading'>Total lines</td>
567
+ <td class='heading'>Lines of code</td>
568
+ <td class='heading'>Total coverage</td>
569
+ <td class='heading'>Code coverage</td>
570
+ </tr>
571
+ </thead>
572
+ <tbody><tr class='light'><td><a href='lib-pomegranate-rdfs_plus_rulebook_rb.html'>lib/pomegranate/rdfs_plus_rulebook.rb</a>
573
+ </td>
574
+ <td class='lines_total'><tt>341</tt>
575
+ </td>
576
+ <td class='lines_code'><tt>116</tt>
577
+ </td>
578
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>98.8%</tt>
579
+ &nbsp;</td>
580
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='99'/>
581
+ <td class='uncovered' width='1'/>
582
+ </tr>
583
+ </table>
584
+ </td>
585
+ </tr>
586
+ </table>
587
+ </td>
588
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>97.4%</tt>
589
+ &nbsp;</td>
590
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='97'/>
591
+ <td class='uncovered' width='3'/>
592
+ </tr>
593
+ </table>
594
+ </td>
595
+ </tr>
596
+ </table>
597
+ </td>
598
+ </tr>
599
+ </tbody>
600
+ </table>
601
+ <pre><span class="inferred0"><a name="line1"></a> 1 # This file is part of the Pomegranate project (http://pius.github.com/pomegranate/)
602
+ </span><span class="inferred1"><a name="line2"></a> 2 #
603
+ </span><span class="inferred0"><a name="line3"></a> 3 # This application is free software; you can redistribute it and/or
604
+ </span><span class="inferred1"><a name="line4"></a> 4 # modify it under the terms of the Ruby license defined in the
605
+ </span><span class="inferred0"><a name="line5"></a> 5 # LICENSE.txt file.
606
+ </span><span class="inferred1"><a name="line6"></a> 6 #
607
+ </span><span class="inferred0"><a name="line7"></a> 7 # Copyright (c) 2008 Pius Uzamere. All rights reserved.
608
+ </span><span class="inferred1"><a name="line8"></a> 8 #
609
+ </span><span class="inferred0"><a name="line9"></a> 9 # * Authors: Pius Uzamere
610
+ </span><span class="inferred1"><a name="line10"></a> 10 #
611
+ </span><span class="inferred0"><a name="line11"></a> 11
612
+ </span><span class="marked1"><a name="line12"></a> 12 $LOAD_PATH &lt;&lt; File.join(File.dirname(__FILE__), '../lib/')
613
+ </span><span class="marked0"><a name="line13"></a> 13 require 'lib/pomegranate/rdfs_rulebook'
614
+ </span><span class="inferred1"><a name="line14"></a> 14
615
+ </span><span class="marked0"><a name="line15"></a> 15 class RdfsPlusRulebook &lt; RdfsRulebook
616
+ </span><span class="inferred1"><a name="line16"></a> 16
617
+ </span><span class="marked0"><a name="line17"></a> 17 def rules
618
+ </span><span class="marked1"><a name="line18"></a> 18 rdfs_rules
619
+ </span><span class="marked0"><a name="line19"></a> 19 rdfs_plus_rules
620
+ </span><span class="inferred1"><a name="line20"></a> 20 end
621
+ </span><span class="inferred0"><a name="line21"></a> 21
622
+ </span><span class="inferred1"><a name="line22"></a> 22 #nodoc
623
+ </span><span class="marked0"><a name="line23"></a> 23 def rdfs_plus_rules
624
+ </span><span class="inferred1"><a name="line24"></a> 24 ##
625
+ </span><span class="inferred0"><a name="line25"></a> 25 # Implements Type Propagation through owl:inverseOf
626
+ </span><span class="inferred1"><a name="line26"></a> 26 #
627
+ </span><span class="inferred0"><a name="line27"></a> 27 # ==== Semantics
628
+ </span><span class="inferred1"><a name="line28"></a> 28 # Given:
629
+ </span><span class="inferred0"><a name="line29"></a> 29 # P owl:inverseOf Q
630
+ </span><span class="inferred1"><a name="line30"></a> 30 # x P y
631
+ </span><span class="inferred0"><a name="line31"></a> 31 #
632
+ </span><span class="inferred1"><a name="line32"></a> 32 # Infer:
633
+ </span><span class="inferred0"><a name="line33"></a> 33 # y Q x
634
+ </span><span class="inferred1"><a name="line34"></a> 34 #
635
+ </span><span class="inferred0"><a name="line35"></a> 35 # ==== Example
636
+ </span><span class="inferred1"><a name="line36"></a> 36 # p = Triple.new(&quot;:Pius&quot;, &quot;:took_a_class_taught_by&quot;, &quot;:Winston&quot;);
637
+ </span><span class="inferred0"><a name="line37"></a> 37 # h = Triple.new(&quot;:took_a_class_taught_by&quot;, &quot;owl:inverseOf&quot;, &quot;:taught&quot;)
638
+ </span><span class="inferred1"><a name="line38"></a> 38 # assert p; assert h; #=&gt; infers a triple ~= Triple.new(&quot;:Winston&quot;, &quot;taught&quot;, &quot;:Pius&quot;)
639
+ </span><span class="inferred0"><a name="line39"></a> 39 #
640
+ </span><span class="inferred1"><a name="line40"></a> 40 # @author Pius Uzamere
641
+ </span><span class="marked0"><a name="line41"></a> 41 def owl_inverse_of
642
+ </span><span class="inferred1"><a name="line42"></a> 42 end
643
+ </span><span class="inferred0"><a name="line43"></a> 43
644
+ </span><span class="marked1"><a name="line44"></a> 44 rule :owl_inverse_of,
645
+ </span><span class="marked0"><a name="line45"></a> 45 [Triple,:fact,{m.predicate=&gt;:pred, m.object =&gt; :new_subj, m.subject =&gt; :new_obj}],
646
+ </span><span class="marked1"><a name="line46"></a> 46 [Triple,:ont_statement,{m.object =&gt; :inferred_pred},m.predicate==&quot;owl:inverseOf&quot;, m.subject == b(:pred)],
647
+ </span><span class="marked0"><a name="line47"></a> 47 [:not, Triple, m.predicate==b(:inferred_pred), m.subject==b(:new_subj), m.object==b(:new_obj)] do |v|
648
+ </span><span class="marked1"><a name="line48"></a> 48 inferred_property = v[:ont_statement].object
649
+ </span><span class="marked0"><a name="line49"></a> 49 obj = v[:fact].subject
650
+ </span><span class="marked1"><a name="line50"></a> 50 subj = v[:fact].object
651
+ </span><span class="marked0"><a name="line51"></a> 51 assert Triple.new(subj, inferred_property, obj)
652
+ </span><span class="marked1"><a name="line52"></a> 52 puts &quot;Made type inference based on owl:inverseOf: Triple(#{subj}, #{inferred_property}, #{obj})&quot;
653
+ </span><span class="inferred0"><a name="line53"></a> 53 end
654
+ </span><span class="inferred1"><a name="line54"></a> 54
655
+ </span><span class="inferred0"><a name="line55"></a> 55 ##
656
+ </span><span class="inferred1"><a name="line56"></a> 56 # Implements Type Propagation through owl:SymmetricProperty
657
+ </span><span class="inferred0"><a name="line57"></a> 57 #
658
+ </span><span class="inferred1"><a name="line58"></a> 58 # ==== Semantics
659
+ </span><span class="inferred0"><a name="line59"></a> 59 # Given:
660
+ </span><span class="inferred1"><a name="line60"></a> 60 # P rdf:type owl:SymmetricProperty
661
+ </span><span class="inferred0"><a name="line61"></a> 61 #
662
+ </span><span class="inferred1"><a name="line62"></a> 62 # Infer:
663
+ </span><span class="inferred0"><a name="line63"></a> 63 # P owl:inverseOf P
664
+ </span><span class="inferred1"><a name="line64"></a> 64 #
665
+ </span><span class="inferred0"><a name="line65"></a> 65 # ==== Example
666
+ </span><span class="inferred1"><a name="line66"></a> 66 # p = Triple.new(&quot;:Pius&quot;, &quot;:was_in_a_class_with&quot;, &quot;:Adam&quot;);
667
+ </span><span class="inferred0"><a name="line67"></a> 67 # h = Triple.new(&quot;:was_in_a_class_with&quot;, &quot;rdf:type&quot;, &quot;owl:SymmetricProperty&quot;)
668
+ </span><span class="inferred1"><a name="line68"></a> 68 # assert p; assert h; #=&gt; infers a triple ~= Triple.new(&quot;:Adam&quot;, &quot;:was_in_a_class_with&quot;, &quot;:Pius&quot;)
669
+ </span><span class="inferred0"><a name="line69"></a> 69 #
670
+ </span><span class="inferred1"><a name="line70"></a> 70 # @author Pius Uzamere
671
+ </span><span class="marked0"><a name="line71"></a> 71 def owl_symmetric_property
672
+ </span><span class="inferred1"><a name="line72"></a> 72 end
673
+ </span><span class="inferred0"><a name="line73"></a> 73
674
+ </span><span class="marked1"><a name="line74"></a> 74 rule :owl_symmetric_property,
675
+ </span><span class="marked0"><a name="line75"></a> 75 [Triple,:ont_statement,m.predicate==&quot;rdf:type&quot;,m.object==&quot;owl:SymmetricProperty&quot;] do |v|
676
+ </span><span class="marked1"><a name="line76"></a> 76 prop = v[:ont_statement].subject
677
+ </span><span class="marked0"><a name="line77"></a> 77 assert Triple.new(prop, &quot;owl:inverseOf&quot;, prop)
678
+ </span><span class="marked1"><a name="line78"></a> 78 puts &quot;Made type inference based on owl:SymmetricProperty: Triple(#{prop}, owl:inverseOf, #{prop})&quot;
679
+ </span><span class="inferred0"><a name="line79"></a> 79 end
680
+ </span><span class="inferred1"><a name="line80"></a> 80
681
+ </span><span class="inferred0"><a name="line81"></a> 81 ##
682
+ </span><span class="inferred1"><a name="line82"></a> 82 # Implements Type Propagation through owl:TransitiveProperty
683
+ </span><span class="inferred0"><a name="line83"></a> 83 #
684
+ </span><span class="inferred1"><a name="line84"></a> 84 # ==== Semantics
685
+ </span><span class="inferred0"><a name="line85"></a> 85 # Given:
686
+ </span><span class="inferred1"><a name="line86"></a> 86 # P rdf:type owl:TransitiveProperty
687
+ </span><span class="inferred0"><a name="line87"></a> 87 # X P Y
688
+ </span><span class="inferred1"><a name="line88"></a> 88 # X P Z
689
+ </span><span class="inferred0"><a name="line89"></a> 89 #
690
+ </span><span class="inferred1"><a name="line90"></a> 90 # Infer:
691
+ </span><span class="inferred0"><a name="line91"></a> 91 # X P Z
692
+ </span><span class="inferred1"><a name="line92"></a> 92 #
693
+ </span><span class="inferred0"><a name="line93"></a> 93 # ==== Example
694
+ </span><span class="inferred1"><a name="line94"></a> 94 # p = Triple.new(&quot;:Dirichlet&quot;, &quot;:is_an_academic_ancestor_of&quot;, &quot;:Minsky&quot;);
695
+ </span><span class="inferred0"><a name="line95"></a> 95 # h = Triple.new(&quot;:Poisson&quot;, &quot;:is_an_academic_ancestor_of&quot;, &quot;:Dirichlet&quot;);
696
+ </span><span class="inferred1"><a name="line96"></a> 96 # j = Triple.new(&quot;:is_an_academic_ancestor_of&quot;, &quot;rdf:type&quot;, &quot;owl:TransitiveProperty&quot;);
697
+ </span><span class="inferred0"><a name="line97"></a> 97 # assert p; assert h; assert j; #=&gt; infers a triple ~= Triple.new(&quot;:Poisson&quot;, &quot;:is_an_academic_ancestor_of&quot;, &quot;:Minsky&quot;)
698
+ </span><span class="inferred1"><a name="line98"></a> 98 #
699
+ </span><span class="inferred0"><a name="line99"></a> 99 # @author Pius Uzamere
700
+ </span><span class="marked1"><a name="line100"></a>100 def owl_transitive_property
701
+ </span><span class="inferred0"><a name="line101"></a>101 end
702
+ </span><span class="inferred1"><a name="line102"></a>102
703
+ </span><span class="marked0"><a name="line103"></a>103 rule :owl_transitive_property,
704
+ </span><span class="marked1"><a name="line104"></a>104 [Triple,:ont_statement,{m.subject =&gt; :trans_prop},m.predicate==&quot;rdf:type&quot;,m.object==&quot;owl:TransitiveProperty&quot;],
705
+ </span><span class="marked0"><a name="line105"></a>105 [Triple,:fact1,{m.predicate=&gt;:predi, m.subject =&gt; :sub, m.object =&gt; :trans_obj}, m.predicate == b(:trans_prop), m.subject.not== m.object],
706
+ </span><span class="marked1"><a name="line106"></a>106 [Triple,:fact2, m.predicate==b(:predi), m.subject==b(:trans_obj), m.predicate.not==&quot;owl:inverseOf&quot;, m.object.not== b(:sub) ] do |v|
707
+ </span><span class="marked0"><a name="line107"></a>107 subj = v[:fact1].subject
708
+ </span><span class="marked1"><a name="line108"></a>108 obj = v[:fact2].object
709
+ </span><span class="marked0"><a name="line109"></a>109 prop = v[:ont_statement].subject
710
+ </span><span class="marked1"><a name="line110"></a>110 assert Triple.new(subj, prop, obj)
711
+ </span><span class="marked0"><a name="line111"></a>111 puts &quot;Made type inference based on owl:TransitiveProperty: Triple(#{subj}, #{prop}, #{obj})&quot;
712
+ </span><span class="marked1"><a name="line112"></a>112 if subj == &quot;:Pius&quot; &amp;&amp; obj == &quot;:Uzamere&quot; &amp;&amp; prop == &quot;:is_an_academic_ancestor_of&quot;
713
+ </span><span class="uncovered0"><a name="line113"></a>113 raise &quot;ho&quot; + v[:ont_statement].inspect + v[:fact1].inspect + v[:fact2].inspect
714
+ </span><span class="uncovered1"><a name="line114"></a>114 end
715
+ </span><span class="uncovered0"><a name="line115"></a>115
716
+ </span><span class="uncovered1"><a name="line116"></a>116 end
717
+ </span><span class="inferred0"><a name="line117"></a>117
718
+ </span><span class="inferred1"><a name="line118"></a>118 ##
719
+ </span><span class="inferred0"><a name="line119"></a>119 # Implements Class Equivalence through owl:equivalentClass
720
+ </span><span class="inferred1"><a name="line120"></a>120 #
721
+ </span><span class="inferred0"><a name="line121"></a>121 # ==== Semantics
722
+ </span><span class="inferred1"><a name="line122"></a>122 # Given:
723
+ </span><span class="inferred0"><a name="line123"></a>123 # A owl:equivalentClass B
724
+ </span><span class="inferred1"><a name="line124"></a>124 # r rdf:type A
725
+ </span><span class="inferred0"><a name="line125"></a>125 #
726
+ </span><span class="inferred1"><a name="line126"></a>126 # Infer:
727
+ </span><span class="inferred0"><a name="line127"></a>127 # r rdf:type B
728
+ </span><span class="inferred1"><a name="line128"></a>128 #
729
+ </span><span class="inferred0"><a name="line129"></a>129 # AND
730
+ </span><span class="inferred1"><a name="line130"></a>130 #
731
+ </span><span class="inferred0"><a name="line131"></a>131 # Given:
732
+ </span><span class="inferred1"><a name="line132"></a>132 # C owl:equivalentClass D
733
+ </span><span class="inferred0"><a name="line133"></a>133 # C rdfs:subClassOf D
734
+ </span><span class="inferred1"><a name="line134"></a>134 # z rdf:type D
735
+ </span><span class="inferred0"><a name="line135"></a>135 #
736
+ </span><span class="inferred1"><a name="line136"></a>136 # Infer:
737
+ </span><span class="inferred0"><a name="line137"></a>137 # z rdf:type C
738
+ </span><span class="inferred1"><a name="line138"></a>138 #
739
+ </span><span class="inferred0"><a name="line139"></a>139 # ==== Example
740
+ </span><span class="inferred1"><a name="line140"></a>140 # p = Triple.new(&quot;mit:class&quot;, &quot;owl:equivalentClass&quot;, &quot;mit:subject&quot;);
741
+ </span><span class="inferred0"><a name="line141"></a>141 # h = Triple.new(&quot;:6.111&quot;, &quot;rdf:type&quot;, &quot;mit:class&quot;);
742
+ </span><span class="inferred1"><a name="line142"></a>142 # assert p; assert h; #=&gt; infers a triple ~= Triple.new(&quot;:6.111&quot;, &quot;:rdf:type&quot;, &quot;:mit:subject&quot;)
743
+ </span><span class="inferred0"><a name="line143"></a>143 #
744
+ </span><span class="inferred1"><a name="line144"></a>144 # @author Pius Uzamere
745
+ </span><span class="marked0"><a name="line145"></a>145 def owl_equivalent_class
746
+ </span><span class="inferred1"><a name="line146"></a>146 end
747
+ </span><span class="inferred0"><a name="line147"></a>147
748
+ </span><span class="marked1"><a name="line148"></a>148 rule :owl_equivalent_class,
749
+ </span><span class="marked0"><a name="line149"></a>149 [Triple,:ont_statement,m.predicate==&quot;owl:equivalentClass&quot;] do |v|
750
+ </span><span class="marked1"><a name="line150"></a>150 assert Triple.new(&quot;owl:equivalentClass&quot;, &quot;rdf:type&quot;, &quot;owl:SymmetricProperty&quot;)
751
+ </span><span class="marked0"><a name="line151"></a>151 assert Triple.new(&quot;owl:equivalentClass&quot;, &quot;rdfs:subPropertyOf&quot;, &quot;rdfs:subClassOf&quot;)
752
+ </span><span class="inferred1"><a name="line152"></a>152 #this is cute . . . only annoying thing is that you don't get the downstream explanation of the inferences
753
+ </span><span class="inferred0"><a name="line153"></a>153 end
754
+ </span><span class="inferred1"><a name="line154"></a>154
755
+ </span><span class="inferred0"><a name="line155"></a>155
756
+ </span><span class="inferred1"><a name="line156"></a>156 ##
757
+ </span><span class="inferred0"><a name="line157"></a>157 # Implements Property Equivalence through owl:equivalentProperty
758
+ </span><span class="inferred1"><a name="line158"></a>158 #
759
+ </span><span class="inferred0"><a name="line159"></a>159 # ==== Semantics
760
+ </span><span class="inferred1"><a name="line160"></a>160 # Given:
761
+ </span><span class="inferred0"><a name="line161"></a>161 # A owl:equivalentProperty B
762
+ </span><span class="inferred1"><a name="line162"></a>162 # r A c
763
+ </span><span class="inferred0"><a name="line163"></a>163 #
764
+ </span><span class="inferred1"><a name="line164"></a>164 # Infer:
765
+ </span><span class="inferred0"><a name="line165"></a>165 # r B C
766
+ </span><span class="inferred1"><a name="line166"></a>166 #
767
+ </span><span class="inferred0"><a name="line167"></a>167 # AND
768
+ </span><span class="inferred1"><a name="line168"></a>168 #
769
+ </span><span class="inferred0"><a name="line169"></a>169 # Given:
770
+ </span><span class="inferred1"><a name="line170"></a>170 # C owl:equivalentClass D
771
+ </span><span class="inferred0"><a name="line171"></a>171 # C rdfs:subClassOf D
772
+ </span><span class="inferred1"><a name="line172"></a>172 # z rdf:type D
773
+ </span><span class="inferred0"><a name="line173"></a>173 #
774
+ </span><span class="inferred1"><a name="line174"></a>174 # Infer:
775
+ </span><span class="inferred0"><a name="line175"></a>175 # z rdf:type C
776
+ </span><span class="inferred1"><a name="line176"></a>176 #
777
+ </span><span class="inferred0"><a name="line177"></a>177 # ==== Example
778
+ </span><span class="inferred1"><a name="line178"></a>178 # p = Triple.new(&quot;mit:took_class&quot;, &quot;owl:equivalentProperty&quot;, &quot;mit:took_course&quot;);
779
+ </span><span class="inferred0"><a name="line179"></a>179 # h = Triple.new(&quot;:Pius&quot;, &quot;mit:took_course&quot;, &quot;:6.111&quot;);
780
+ </span><span class="inferred1"><a name="line180"></a>180 # assert p; assert h; #=&gt; infers a triple ~= Triple.new(&quot;:Pius&quot;, &quot;mit:took_class&quot;, &quot;:6.111&quot;)
781
+ </span><span class="inferred0"><a name="line181"></a>181 #
782
+ </span><span class="inferred1"><a name="line182"></a>182 # @author Pius Uzamere
783
+ </span><span class="inferred0"><a name="line183"></a>183
784
+ </span><span class="marked1"><a name="line184"></a>184 def owl_equivalent_property
785
+ </span><span class="inferred0"><a name="line185"></a>185 end
786
+ </span><span class="inferred1"><a name="line186"></a>186
787
+ </span><span class="marked0"><a name="line187"></a>187 rule :owl_equivalent_property,
788
+ </span><span class="marked1"><a name="line188"></a>188 [Triple,:ont_statement,m.predicate==&quot;owl:equivalentProperty&quot;] do |v|
789
+ </span><span class="marked0"><a name="line189"></a>189 assert Triple.new(&quot;owl:equivalentProperty&quot;, &quot;rdf:type&quot;, &quot;owl:SymmetricProperty&quot;)
790
+ </span><span class="marked1"><a name="line190"></a>190 assert Triple.new(&quot;owl:equivalentProperty&quot;, &quot;rdfs:subPropertyOf&quot;, &quot;rdfs:subPropertyOf&quot;)
791
+ </span><span class="inferred0"><a name="line191"></a>191 #this is cute . . . only annoying thing is that you don't get the downstream explanation of the inferences
792
+ </span><span class="inferred1"><a name="line192"></a>192 end
793
+ </span><span class="inferred0"><a name="line193"></a>193
794
+ </span><span class="inferred1"><a name="line194"></a>194 ##
795
+ </span><span class="inferred0"><a name="line195"></a>195 # Implements Individual Equivalence through owl:sameAs
796
+ </span><span class="inferred1"><a name="line196"></a>196 #
797
+ </span><span class="inferred0"><a name="line197"></a>197 # ==== Semantics
798
+ </span><span class="inferred1"><a name="line198"></a>198 # Given:
799
+ </span><span class="inferred0"><a name="line199"></a>199 # x owl:sameAs y
800
+ </span><span class="inferred1"><a name="line200"></a>200 # o P x
801
+ </span><span class="inferred0"><a name="line201"></a>201 #
802
+ </span><span class="inferred1"><a name="line202"></a>202 # Infer:
803
+ </span><span class="inferred0"><a name="line203"></a>203 # o P y
804
+ </span><span class="inferred1"><a name="line204"></a>204 #
805
+ </span><span class="inferred0"><a name="line205"></a>205 # AND
806
+ </span><span class="inferred1"><a name="line206"></a>206 #
807
+ </span><span class="inferred0"><a name="line207"></a>207 # Given:
808
+ </span><span class="inferred1"><a name="line208"></a>208 # x owl:sameAs y
809
+ </span><span class="inferred0"><a name="line209"></a>209 # x P o
810
+ </span><span class="inferred1"><a name="line210"></a>210 #
811
+ </span><span class="inferred0"><a name="line211"></a>211 # Infer:
812
+ </span><span class="inferred1"><a name="line212"></a>212 # z rdf:type C
813
+ </span><span class="inferred0"><a name="line213"></a>213 #
814
+ </span><span class="inferred1"><a name="line214"></a>214 # ==== Example
815
+ </span><span class="inferred0"><a name="line215"></a>215 # p = Triple.new(&quot;:Pius&quot;, &quot;owl:sameAs&quot;, &quot;:Uzamere&quot;);
816
+ </span><span class="inferred1"><a name="line216"></a>216 # h = Triple.new(&quot;:Pius&quot;, &quot;mit:took_course&quot;, &quot;:6.171&quot;);
817
+ </span><span class="inferred0"><a name="line217"></a>217 # assert p; assert h; #=&gt; infers a triple ~= Triple.new(&quot;:Uzamere&quot;, &quot;mit:took_course&quot;, &quot;:6.171&quot;)
818
+ </span><span class="inferred1"><a name="line218"></a>218 #
819
+ </span><span class="inferred0"><a name="line219"></a>219 # @author Pius Uzamere
820
+ </span><span class="inferred1"><a name="line220"></a>220
821
+ </span><span class="marked0"><a name="line221"></a>221 def owl_same_as
822
+ </span><span class="inferred1"><a name="line222"></a>222 end
823
+ </span><span class="inferred0"><a name="line223"></a>223
824
+ </span><span class="marked1"><a name="line224"></a>224 rule :owl_same_as_symmetricity,
825
+ </span><span class="marked0"><a name="line225"></a>225 [Triple,:ont_statement, m.predicate==&quot;owl:sameAs&quot;] do |v|
826
+ </span><span class="marked1"><a name="line226"></a>226 assert Triple.new(&quot;owl:sameAs&quot;, &quot;rdf:type&quot;, &quot;owl:SymmetricProperty&quot;)
827
+ </span><span class="marked0"><a name="line227"></a>227 puts &quot;asserting the symmetricity of owl:sameAs&quot;
828
+ </span><span class="inferred1"><a name="line228"></a>228 end
829
+ </span><span class="inferred0"><a name="line229"></a>229
830
+ </span><span class="inferred1"><a name="line230"></a>230
831
+ </span><span class="marked0"><a name="line231"></a>231 rule :owl_same_as_when_subject,
832
+ </span><span class="inferred1"><a name="line232"></a>232
833
+ </span><span class="marked0"><a name="line233"></a>233 [Triple,:ont_statement,{m.subject =&gt; :original, m.object =&gt; :doppelganger}, m.predicate==&quot;owl:sameAs&quot;],
834
+ </span><span class="marked1"><a name="line234"></a>234 [Triple,:fact, {m.predicate =&gt; :p, m.object =&gt; :common_object}, m.subject == b(:original), m.subject.not== b(:doppelganger), m.predicate.not== &quot;owl:sameAs&quot;],
835
+ </span><span class="marked0"><a name="line235"></a>235 [:not, Triple, m.predicate==b(:p), m.subject==b(:doppelganger), m.object==b(:common_object)] do |v|
836
+ </span><span class="inferred1"><a name="line236"></a>236
837
+ </span><span class="marked0"><a name="line237"></a>237 subj = v[:ont_statement].object
838
+ </span><span class="marked1"><a name="line238"></a>238 pred = v[:fact].predicate
839
+ </span><span class="marked0"><a name="line239"></a>239 obj = v[:fact].object
840
+ </span><span class="inferred1"><a name="line240"></a>240
841
+ </span><span class="marked0"><a name="line241"></a>241 puts &quot;Made type inference based on owl:sameAs: Triple(#{subj}, #{pred}, #{obj})&quot;
842
+ </span><span class="marked1"><a name="line242"></a>242 assert Triple.new(subj, pred, obj)
843
+ </span><span class="inferred0"><a name="line243"></a>243 #this is cute . . . only annoying thing is that you don't get the downstream explanation of the inferences
844
+ </span><span class="inferred1"><a name="line244"></a>244 end
845
+ </span><span class="inferred0"><a name="line245"></a>245
846
+ </span><span class="marked1"><a name="line246"></a>246 rule :owl_same_as_when_object,
847
+ </span><span class="marked0"><a name="line247"></a>247 [Triple,:ont_statement,{m.object =&gt; :original, m.subject =&gt; :doppelganger}, m.predicate==&quot;owl:sameAs&quot;],
848
+ </span><span class="marked1"><a name="line248"></a>248 [Triple,:fact, {m.predicate =&gt; :p, m.object =&gt; :ob, m.subject =&gt; :common_subject}, m.object == b(:original), m.object.not== b(:doppelganger), m.predicate.not== &quot;owl:sameAs&quot;],
849
+ </span><span class="marked0"><a name="line249"></a>249 [:not, Triple, m.predicate==b(:p), m.subject==b(:common_subject), m.object==b(:doppelganger)] do |v|
850
+ </span><span class="inferred1"><a name="line250"></a>250
851
+ </span><span class="marked0"><a name="line251"></a>251 obj = v[:ont_statement].subject
852
+ </span><span class="marked1"><a name="line252"></a>252 pred = v[:fact].predicate
853
+ </span><span class="marked0"><a name="line253"></a>253 subj = v[:fact].subject
854
+ </span><span class="inferred1"><a name="line254"></a>254
855
+ </span><span class="marked0"><a name="line255"></a>255 puts &quot;Made type inference based on owl:sameAs: Triple(#{subj}, #{pred}, #{obj})&quot;
856
+ </span><span class="marked1"><a name="line256"></a>256 assert Triple.new(subj, pred, obj)
857
+ </span><span class="inferred0"><a name="line257"></a>257 #this is cute . . . only annoying thing is that you don't get the downstream explanation of the inferences
858
+ </span><span class="inferred1"><a name="line258"></a>258 end
859
+ </span><span class="inferred0"><a name="line259"></a>259
860
+ </span><span class="inferred1"><a name="line260"></a>260 ##
861
+ </span><span class="inferred0"><a name="line261"></a>261 # owl:FunctionalProperty
862
+ </span><span class="inferred1"><a name="line262"></a>262 #
863
+ </span><span class="inferred0"><a name="line263"></a>263 # ==== Semantics
864
+ </span><span class="inferred1"><a name="line264"></a>264 # Given:
865
+ </span><span class="inferred0"><a name="line265"></a>265 # P rdf:type owl:FunctionalProperty
866
+ </span><span class="inferred1"><a name="line266"></a>266 # x P y
867
+ </span><span class="inferred0"><a name="line267"></a>267 # x P z
868
+ </span><span class="inferred1"><a name="line268"></a>268 #
869
+ </span><span class="inferred0"><a name="line269"></a>269 # Infer:
870
+ </span><span class="inferred1"><a name="line270"></a>270 # y owl:sameAs z
871
+ </span><span class="inferred0"><a name="line271"></a>271 #
872
+ </span><span class="inferred1"><a name="line272"></a>272 # ==== Example
873
+ </span><span class="inferred0"><a name="line273"></a>273 # p = Triple.new(&quot;mit:had_academic_advisor&quot;, &quot;rdf:type&quot;, &quot;owl:FunctionalProperty&quot;);
874
+ </span><span class="inferred1"><a name="line274"></a>274 # h = Triple.new(&quot;:Pius&quot;, &quot;mit:had_academic_advisor&quot;, &quot;:Hal&quot;);
875
+ </span><span class="inferred0"><a name="line275"></a>275 # d = Triple.new(&quot;:Pius&quot;, &quot;mit:had_academic_advisor&quot;, &quot;:Dude_Who_Wrote_SICP_With_Gerald_Sussman&quot;);
876
+ </span><span class="inferred1"><a name="line276"></a>276 # assert p; assert h; assert d; #=&gt; infers a triple ~= Triple.new(&quot;:Hal&quot;, &quot;owl:sameAs&quot;, &quot;:Dude_Who_Wrote_SICP_With_Gerald_Sussman&quot;)
877
+ </span><span class="inferred0"><a name="line277"></a>277 #
878
+ </span><span class="inferred1"><a name="line278"></a>278 # @author Pius Uzamere
879
+ </span><span class="inferred0"><a name="line279"></a>279
880
+ </span><span class="marked1"><a name="line280"></a>280 def owl_functional_property
881
+ </span><span class="inferred0"><a name="line281"></a>281 end
882
+ </span><span class="inferred1"><a name="line282"></a>282
883
+ </span><span class="marked0"><a name="line283"></a>283 rule :owl_functional_property,
884
+ </span><span class="marked1"><a name="line284"></a>284 [Triple,:ont_statement,{m.subject =&gt; :the_prop}, m.predicate == &quot;rdf:type&quot;, m.object==&quot;owl:FunctionalProperty&quot;],
885
+ </span><span class="marked0"><a name="line285"></a>285 [Triple,:fact1, {m.subject =&gt; :common_subject, m.object =&gt; :first_object}, m.predicate == b(:the_prop)],
886
+ </span><span class="marked1"><a name="line286"></a>286 [Triple,:fact2, {m.object =&gt; :second_object}, m.subject == b(:common_subject), m.predicate == b(:the_prop)] do |v|
887
+ </span><span class="inferred0"><a name="line287"></a>287
888
+ </span><span class="marked1"><a name="line288"></a>288 subj = v[:fact1].object
889
+ </span><span class="marked0"><a name="line289"></a>289 obj = v[:fact2].object
890
+ </span><span class="inferred1"><a name="line290"></a>290
891
+ </span><span class="marked0"><a name="line291"></a>291 puts &quot;Made type inference based on owl:FunctionalProperty: Triple(#{subj}, owl:sameAs, #{obj})&quot;
892
+ </span><span class="marked1"><a name="line292"></a>292 assert Triple.new(subj, &quot;owl:sameAs&quot;, obj)
893
+ </span><span class="inferred0"><a name="line293"></a>293 end
894
+ </span><span class="inferred1"><a name="line294"></a>294
895
+ </span><span class="inferred0"><a name="line295"></a>295 ##
896
+ </span><span class="inferred1"><a name="line296"></a>296 # owl:InverseFunctionalProperty
897
+ </span><span class="inferred0"><a name="line297"></a>297 #
898
+ </span><span class="inferred1"><a name="line298"></a>298 # ==== Semantics
899
+ </span><span class="inferred0"><a name="line299"></a>299 # Given:
900
+ </span><span class="inferred1"><a name="line300"></a>300 # P rdf:type owl:InverseFunctionalProperty
901
+ </span><span class="inferred0"><a name="line301"></a>301 # z P x
902
+ </span><span class="inferred1"><a name="line302"></a>302 # y P x
903
+ </span><span class="inferred0"><a name="line303"></a>303 #
904
+ </span><span class="inferred1"><a name="line304"></a>304 # Infer:
905
+ </span><span class="inferred0"><a name="line305"></a>305 # y owl:sameAs z
906
+ </span><span class="inferred1"><a name="line306"></a>306 #
907
+ </span><span class="inferred0"><a name="line307"></a>307 # ==== Example
908
+ </span><span class="inferred1"><a name="line308"></a>308 # p = Triple.new(&quot;mit:lived_alone_fall_2004_in&quot;, &quot;rdf:type&quot;, &quot;owl:FunctionalProperty&quot;);
909
+ </span><span class="inferred0"><a name="line309"></a>309 # h = Triple.new(&quot;:Pius&quot;, &quot;mit:lived_alone_fall_2004_in&quot;, &quot;:pomegranate_314_at_Next_House&quot;);
910
+ </span><span class="inferred1"><a name="line310"></a>310 # d = Triple.new(&quot;:2004_UA_President&quot;, &quot;mit:lived_alone_fall_2004_in&quot;, &quot;:pomegranate_314_at_Next_House&quot;);
911
+ </span><span class="inferred0"><a name="line311"></a>311 # assert p; assert h; assert d; #=&gt; infers a triple ~= Triple.new(&quot;:Pius&quot;, &quot;owl:sameAs&quot;, &quot;:2004_UA_President&quot;)
912
+ </span><span class="inferred1"><a name="line312"></a>312 #
913
+ </span><span class="inferred0"><a name="line313"></a>313 # @author Pius Uzamere
914
+ </span><span class="inferred1"><a name="line314"></a>314
915
+ </span><span class="marked0"><a name="line315"></a>315 def owl_inverse_functional_property
916
+ </span><span class="inferred1"><a name="line316"></a>316 end
917
+ </span><span class="inferred0"><a name="line317"></a>317
918
+ </span><span class="marked1"><a name="line318"></a>318 rule :owl_inverse_functional_property,
919
+ </span><span class="marked0"><a name="line319"></a>319 [Triple,:ont_statement,{m.subject =&gt; :the_prop}, m.predicate == &quot;rdf:type&quot;, m.object==&quot;owl:InverseFunctionalProperty&quot;],
920
+ </span><span class="marked1"><a name="line320"></a>320 [Triple,:fact1, {m.object =&gt; :common_object, m.subject =&gt; :first_subject}, m.predicate == b(:the_prop)],
921
+ </span><span class="marked0"><a name="line321"></a>321 [Triple,:fact2, {m.subject =&gt; :second_subject}, m.object == b(:common_object), m.predicate == b(:the_prop)] do |v|
922
+ </span><span class="inferred1"><a name="line322"></a>322
923
+ </span><span class="marked0"><a name="line323"></a>323 subj = v[:fact1].subject
924
+ </span><span class="marked1"><a name="line324"></a>324 obj = v[:fact2].subject
925
+ </span><span class="inferred0"><a name="line325"></a>325
926
+ </span><span class="marked1"><a name="line326"></a>326 puts &quot;Made type inference based on owl:InverseFunctionalProperty: Triple(#{subj}, owl:sameAs, #{obj})&quot;
927
+ </span><span class="marked0"><a name="line327"></a>327 assert Triple.new(subj, &quot;owl:sameAs&quot;, obj)
928
+ </span><span class="inferred1"><a name="line328"></a>328 end
929
+ </span><span class="inferred0"><a name="line329"></a>329
930
+ </span><span class="inferred1"><a name="line330"></a>330 end
931
+ </span><span class="inferred0"><a name="line331"></a>331 end
932
+ </span><span class="inferred1"><a name="line332"></a>332
933
+ </span><span class="marked0"><a name="line333"></a>333 @e = engine :engine do |e|
934
+ </span><span class="marked1"><a name="line334"></a>334 RdfsPlusRulebook.new(e).rules
935
+ </span><span class="inferred0"><a name="line335"></a>335
936
+ </span><span class="marked1"><a name="line336"></a>336 p = Triple.new(&quot;mit:lived_alone_fall_2004_in&quot;, &quot;rdf:type&quot;, &quot;owl:InverseFunctionalProperty&quot;);
937
+ </span><span class="marked0"><a name="line337"></a>337 h = Triple.new(&quot;:Pius&quot;, &quot;mit:lived_alone_fall_2004_in&quot;, &quot;:pomegranate_314_at_Next_House&quot;);
938
+ </span><span class="marked1"><a name="line338"></a>338 d = Triple.new(&quot;:2004_UA_President&quot;, &quot;mit:lived_alone_fall_2004_in&quot;, &quot;:pomegranate_314_at_Next_House&quot;);
939
+ </span><span class="marked0"><a name="line339"></a>339 e.assert p; e.assert h; e.assert d;
940
+ </span><span class="marked1"><a name="line340"></a>340 e.match
941
+ </span><span class="inferred0"><a name="line341"></a>341 end
942
+ </span></pre><hr/>
943
+ <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a>
944
+ version 0.8.1.3.</p>
945
+ <p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/>
946
+ </a>
947
+ <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/>
948
+ </a>
949
+ </p>
950
+ </body>
951
+ </html>