-
Notifications
You must be signed in to change notification settings - Fork 7
/
owl_to_ace.html
427 lines (362 loc) · 13.6 KB
/
owl_to_ace.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OWL verbalizer demo</title>
<meta name="Author" content="Kaarel Kaljurand"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="toc.js"></script>
<link rel="stylesheet" title="default" href="ace.css" media="screen" type="text/css"/>
<style type="text/css">
.form { border: silver 1px solid; background-color: #fff090; padding: 0em 1em 0em 1em }
</style>
</head>
<body onload="toc(1, 0)">
<h1>OWL verbalizer demo</h1>
<h2>Introduction</h2>
<p>This demo shows how an ontology that is written in
<a href="http://www.w3.org/TR/owl2-xml-serialization/">OWL 2 XML</a> is
verbalized in Attempto Controlled English (ACE).
This conversion is designed to be reversible, i.e.
one can convert the ACE representation back into OWL so that no loss in meaning
occurs.</p>
<p>The source code, issue list, documentation etc. of the OWL verbalizer
are available at
<a href="https://github.com/Kaljurand/owl-verbalizer">https://github.com/Kaljurand/owl-verbalizer</a>.</p>
<h2>Demo</h2>
<div class="form">
<form action="http://localhost:5123" method="post">
<p>Enter the content of an OWL ontology in the OWL 2 XML format.
<br/>(You can use
<a href="http://owl.cs.manchester.ac.uk/converter/">OWL Syntax Converter</a>
to convert from RDF/XML, Turtle, etc. into OWL 2 XML.)</p>
<div>
<textarea name="xml" title="OWL ontology in XML syntax" rows="24" cols="80">
<?xml version="1.0"?>
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
xml:base="http://org.semanticweb.ontologies/test"
xmlns:xml="http://www.w3.org/XML/1998/namespace">
<Prefix name="story" IRI="http://www.example.org/story.owl#"/>
<Prefix name="ace_lexicon" IRI="http://attempto.ifi.uzh.ch/ace_lexicon#"/>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="ace_lexicon:TV_sg"/>
<IRI>http://www.example.org/story.owl#eat</IRI>
<Literal>eats</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="ace_lexicon:TV_pl"/>
<IRI>http://www.example.org/story.owl#eat</IRI>
<Literal>eat</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="ace_lexicon:TV_vbg"/>
<IRI>http://www.example.org/story.owl#eat</IRI>
<Literal>eaten</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="ace_lexicon:CN_sg"/>
<IRI>http://www.example.org/story.owl#hate</IRI>
<Literal>hater</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="ace_lexicon:CN_pl"/>
<IRI>http://www.example.org/story.owl#leaf</IRI>
<Literal>leaves</Literal>
</AnnotationAssertion>
<SubClassOf>
<Class abbreviatedIRI="story:animal"/>
<ObjectUnionOf>
<Class abbreviatedIRI="story:cat"/>
<Class abbreviatedIRI="story:goat"/>
</ObjectUnionOf>
</SubClassOf>
<EquivalentClasses>
<Class abbreviatedIRI="story:goat"/>
<ObjectAllValuesFrom>
<ObjectProperty abbreviatedIRI="story:eat"/>
<Class abbreviatedIRI="story:leaf"/>
</ObjectAllValuesFrom>
</EquivalentClasses>
<SubClassOf>
<Class abbreviatedIRI="story:human"/>
<ObjectIntersectionOf>
<Class abbreviatedIRI="story:person"/>
<ObjectSomeValuesFrom>
<ObjectProperty abbreviatedIRI="story:own"/>
<Class abbreviatedIRI="story:automobile"/>
</ObjectSomeValuesFrom>
</ObjectIntersectionOf>
</SubClassOf>
<SubClassOf>
<Class abbreviatedIRI="story:human"/>
<ObjectOneOf>
<NamedIndividual abbreviatedIRI="story:John"/>
<NamedIndividual abbreviatedIRI="story:Mary"/>
</ObjectOneOf>
</SubClassOf>
<SubClassOf>
<Class abbreviatedIRI="story:man"/>
<Class abbreviatedIRI="story:person"/>
</SubClassOf>
<FunctionalObjectProperty>
<ObjectProperty abbreviatedIRI="story:eat"/>
</FunctionalObjectProperty>
<InverseFunctionalObjectProperty>
<ObjectProperty abbreviatedIRI="story:eat"/>
</InverseFunctionalObjectProperty>
<TransitiveObjectProperty>
<ObjectProperty abbreviatedIRI="story:eat"/>
</TransitiveObjectProperty>
<ObjectPropertyDomain>
<ObjectProperty abbreviatedIRI="story:eat"/>
<Class abbreviatedIRI="story:animal"/>
</ObjectPropertyDomain>
<ObjectPropertyRange>
<ObjectProperty abbreviatedIRI="story:eat"/>
<ObjectIntersectionOf>
<Class abbreviatedIRI="story:food"/>
<ObjectComplementOf>
<Class abbreviatedIRI="story:automobile"/>
</ObjectComplementOf>
</ObjectIntersectionOf>
</ObjectPropertyRange>
<InverseObjectProperties>
<ObjectProperty abbreviatedIRI="story:hate"/>
<ObjectProperty abbreviatedIRI="story:eat"/>
</InverseObjectProperties>
<ClassAssertion>
<Class abbreviatedIRI="story:man"/>
<NamedIndividual abbreviatedIRI="story:John"/>
</ClassAssertion>
<SubClassOf>
<ObjectUnionOf>
<Class abbreviatedIRI="story:apple"/>
<Class abbreviatedIRI="story:leaf"/>
</ObjectUnionOf>
<Class abbreviatedIRI="story:food"/>
</SubClassOf>
</Ontology>
</textarea>
</div>
<p>Specify the output format</p>
<div>
<input type="radio" name="format" value="ace" checked="checked"/>
plain ACE text (text/plain)
<br/>
<input type="radio" name="format" value="html"/>
HTML table of Axiom-Sentences mappings (text/html)
<br/>
<input type="radio" name="format" value="csv"/>
tokenized and without lexicon lookup in 2-column CSV (text/plain)
</div>
<p>... and press <input type="submit" value="Verbalize" title="Verbalize the ontology!"/></p>
</form>
<p>If the ontology contains a syntax error or
takes too long to verbalize then an error message is returned.</p>
</div>
<h2>How is the verbalization done?</h2>
<p>We first rewrite the class expressions and axioms via a limited number of
more basic class expressions and axioms. The motivation behind this step is
to replace axioms like</p>
<pre>
ObjectPropertyDomain(R C)
</pre>
<p>which have very little syntactic structure and contain logic-specific words
like `domain'.</p>
<p>The remaining class expressions are mapped to ACE noun phrases and the remaining
axioms to ACE sentences. OWL properties are ACE verbs or <em>of</em>-constructs
and OWL individuals are
ACE proper names. The following table shows an example
how the OWL constructs are mapped to ACE constructs.</p>
<table>
<thead>
<tr>
<td>OWL</td>
<td>ACE</td>
</tr>
</thead>
<tbody>
<tr>
<td><em>Named property</em></td>
<td><em>Transitive verb, e.g.</em> own<em>; or of-construct, e.g.</em> father of</td>
</tr>
<tr>
<td>ObjectInverseOf(R)</td>
<td><em>Passive verb, e.g.</em> is owned by<em>; or Saxon genitive, e.g.</em> X's father</td>
</tr>
<tr>
<td><em>Named class</em></td>
<td><em>Common noun, e.g.</em> person</td>
</tr>
<tr>
<td>owl:Thing</td>
<td>something, thing, X, Y, ...</td>
</tr>
<tr>
<td>ObjectComplementOf(C)</td>
<td>something that <b>is not</b> a person; something that <b>does not</b> own a car</td>
</tr>
<tr>
<td>ObjectIntersectionOf(C1 ... Cn)</td>
<td>something that is a person <b>and</b> that owns a car</td>
</tr>
<tr>
<td>ObjectUnionOf(C1 ... Cn)</td>
<td>something that is a wild-animal <b>or</b> that is a zoo-animal</td>
</tr>
<tr>
<td>ObjectOneOf(a)</td>
<td><em>Proper name, e.g.</em> John</td>
</tr>
<tr>
<td>ObjectSomeValuesFrom(R C)</td>
<td>something that owns <b>a</b> car</td>
</tr>
<tr>
<td>ObjectHasSelf(R)</td>
<td>something that likes <b>itself</b></td>
</tr>
<tr>
<td>ObjectMinCardinality(n R C)</td>
<td>something that borders <b>at least 2</b> countries</td>
</tr>
<tr>
<td>SubClassOf(C D)</td>
<td><b>Every</b> country that borders no bodies-of-water <b>is</b> a landlocked-country.</td>
</tr>
<tr>
<td>SubObjectPropertyOf(ObjectPropertyChain(R1 ... Rn) S)</td>
<td><b>If</b> X owns something that is-part-of Y <b>then</b> X owns Y.</td>
</tr>
<tr>
<td>DisjointObjectProperties(R S)</td>
<td><b>If</b> X is-child-of Y <b>then</b> <b>it is false that</b> X is-spouse-of Y.</td>
</tr>
</tbody>
</table>
<p>ACE allows relative clause coordination and embedding of relative clauses into
other relative clauses. This gives us quite a bit of flexibility in expressing more
complex OWL class expressions. For example,</p>
<pre>
ObjectSomeValuesFrom(eat ObjectComplementOf(ice-cream))
</pre>
<p>would be verbalized as an ACE noun phrase</p>
<pre>
something that eats something that is not an ice-cream
</pre>
<p>Still, verbalizing very complex class expressions would require a support for parentheses which
ACE does not offer. We do not see it as a shortcoming, rather it is a natural
restriction on the complexity of class expressions (which should be readable for
others to understand).</p>
<p>Finally, we apply some simple modifications to make the sentences more
readable, e.g. we try to remove negations and reorder the elements in coordination.</p>
<h2>OWL entities vs ACE content words</h2>
<p>The quality of the verbalization depends somewhat on the morphologic and orthographic
nature of the names
used for individuals, classes and properties in the input ontology. The verbalizer assumes
that all individuals are denoted by singular proper names (preferably capitalized),
classes by singular common nouns, and properties by transitive verbs in
their infinitive form or as singular nouns.
These restrictions are needed because the names will be used in certain
syntactic constructions or will undergo certain morphological changes.</p>
<ul>
<li>Individuals (proper names) are used in the subject and object positions
without a determiner, e.g. "Every man knows <b>John</b>.",
"<b>John</b> is a man."</li>
<li>Classes (common nouns) are used in the subject and object positions with
determiners like <i>every</i>, <i>no</i>, <i>a</i>, <i>at least 2</i>;
e.g. "Every <b>man</b> knows something.",
"No <b>woman</b> likes a <b>spider</b>.",
"Every <b>baltic-state</b> borders at least 2 <b>countries</b>.".</li>
<li>Properties (transitive verbs) are often used in singular, e.g.
"Every boy <b>owns</b> a bike.", but under negation (i.e. <em>ObjectComplementOf</em>)
will stay in infinitive, e.g. "Every one-year-old is a child that does not <b>own</b> a bike.".
In some cases, most often when verbalizing the <em>ObjectPropertyRange</em>-construct,
a past participle form is used in order to construct a passive sentence, e.g.
"Everything that is <b>owned</b> by something is a possession."</li>
</ul>
<p>The default synthesis of entity IRI surface forms just preserves
the IRI fragment (the part after '#' or the last '/')
but one can add annotations to the input ontology
to specify the desired surface form, e.g.</p>
<pre>
<AnnotationAssertion>
<AnnotationProperty IRI="http://attempto.ifi.uzh.ch/ace_lexicon#CN_pl"/>
<IRI>#man</IRI>
<Literal>men</Literal>
</AnnotationAssertion>
</pre>
<p>The following annotation properties are supported:</p>
<table>
<thead>
<tr>
<td>Annotation property IRI</td>
<td>Meaning</td>
<td>Example IRI</td>
<td>Example literal</td>
</tr>
</thead>
<tbody>
<tr>
<td><code>http://attempto.ifi.uzh.ch/ace_lexicon#PN_sg</code></td>
<td>singular form of a proper name</td>
<td>#John</td>
<td>John</td>
</tr>
<tr>
<td><code>http://attempto.ifi.uzh.ch/ace_lexicon#CN_sg</code></td>
<td>singular form of a common noun</td>
<td>#man</td>
<td>man</td>
</tr>
<tr>
<td><code>http://attempto.ifi.uzh.ch/ace_lexicon#CN_pl</code></td>
<td>plural form of a common noun</td>
<td>#man</td>
<td>men</td>
</tr>
<tr>
<td><code>http://attempto.ifi.uzh.ch/ace_lexicon#TV_sg</code></td>
<td>singular form of a transitive verb</td>
<td>#man</td>
<td>mans</td>
</tr>
<tr>
<td><code>http://attempto.ifi.uzh.ch/ace_lexicon#TV_pl</code></td>
<td>plural form of a transitive verb</td>
<td>#man</td>
<td>man</td>
</tr>
<tr>
<td><code>http://attempto.ifi.uzh.ch/ace_lexicon#TV_vbg</code></td>
<td>past participle form a transitive verb</td>
<td>#man</td>
<td>manned</td>
</tr>
</tbody>
</table>
<p>In the csv-mode, the IRI is returned as it is together with the morphological
type that applies in the given context, e.g:</p>
<pre>
pn_sg http://www.example.org/story.owl#John
f is
f a
cn_sg http://www.example.org/story.owl#man
f .
</pre>
<p>In the ace-mode, in case an object property has the <code>CN_sg</code> annotation
then the property is verbalized as a relational noun, using an <em>of</em>-construct,
Saxon genitive, or the <em>whose</em> relative pronoun. Examples:</p>
<pre>
John is a father of Mary.
Mary's father is John.
Everything whose father is John ...
</pre>
<p>This is an experimental feature which does not always work correctly.</p>
<address>
Kaarel Kaljurand
2015-04-11
</address>
</body>
</html>