-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathReadWrite.der.hs
529 lines (507 loc) · 24.5 KB
/
ReadWrite.der.hs
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
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
{-# OPTIONS -w #-}
{- |
Module : $Header$
Copyright : (c) Heng Jiang, C. Maeder, Uni Bremen 2004-2006
License : similar to LGPL, see HetCATS/LICENSE.txt
Maintainer : Christian.Maeder@dfki.de
Stability : provisional
Portability : non-portable (ATerms)
Automatically derived and manual ShATermConvertible instances
-}
module OWL.ReadWrite () where
import qualified Data.Map as Map
import OWL.AS
import Common.Utils
import Common.ATerm.Lib
import Data.Typeable
import Data.Char
import Data.List
import Control.Monad
instance ShATermConvertible QName where
toShATermAux = toShATermAux_QName
fromShATermAux = fromShATermAux_QName
toShATermAux_QName :: ATermTable -> QName -> IO (ATermTable, Int)
toShATermAux_QName att0 = toShATermAux att0 . showQN
string2QName :: String -> QName
string2QName idName' =
if null idName' then nullQName
else
let (idName'', isFull) =
if head idName' == '<' && last idName' == '>' then
(init $ tail idName', True)
else (idName', False)
(pre, loc) = span (/= ':') idName''
in if null loc then -- no : in ID, only localName
QN "" pre isFull ""
else
if not (isAlpha $ head idName'')
then QN "" idName'' isFull ""
else let loc1 = tail loc in
if elem (take 4 pre) ["http", "file"] then
let (ns, loc2) = span (/= '#') idName''
in if length loc2 > 1 then
QN "" (tail loc2) isFull ns
else QN "" ns isFull ""
else QN pre loc1 isFull ""
fromShATermAux_QName :: Int -> ATermTable -> (ATermTable, QName)
fromShATermAux_QName ix att = (att,
case getShATerm ix att of
ShAAppl idName _ _ -> if null idName then nullQName else
string2QName $ read idName
u -> fromShATermError "OWL.QName" u)
instance ShATermConvertible OntologyFile where
toShATermAux att0 (OntologyFile a b) = do
(att1, a') <- toShATermFromNamespace att0 a
(att2, b') <- toShATerm' att1 b
return $ addATerm (ShAAppl "OntologyFile" [a', b'] []) att2
fromShATermAux ix att0 =
case getShATerm ix att0 of
ShAAppl "OntologyFile" [a,b] _ ->
case fromShATermToNamespace a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, OntologyFile a' b') }}
u -> fromShATermError "OntologyFile" u
toShATermFromNamespace :: ATermTable -> Namespace -> IO (ATermTable, Int)
toShATermFromNamespace att nsMap = do
(att2, inds) <- foldM (\ (att0, l) t -> do
(att1, i) <- toShATermFromNS att0 t
return (att1, i : l)) (att, []) $ Map.toList nsMap
return $ addATerm (ShAList (reverse inds) []) att2
toShATermFromNS :: ATermTable -> (String, String) -> IO (ATermTable, Int)
toShATermFromNS att0 (pre,u) = do
(att1, pre') <- toShATerm' att0 pre
(att2, uri') <- toShATerm' att1 u
return $ addATerm (ShAAppl "NS" [pre', uri'] []) att2
fromShATermToNamespace :: Int -> ATermTable -> (ATermTable, Namespace)
fromShATermToNamespace ix att0 =
case getShATerm ix att0 of
ShAAppl "Namespace" [ind] _ ->
case getShATerm ind att0 of
ShAList ns _ ->
case mapAccumL fromShATermToNS att0 ns of
(att1, ps) -> (att1, Map.fromList ps)
u -> fromShATermError "OWL.NamespaceList" u
u -> fromShATermError "OWL.Namespace" u
fromShATermToNS :: ATermTable -> Int -> (ATermTable, (String, String))
fromShATermToNS att0 ix =
case getShATerm ix att0 of
ShAAppl "NS" [name, u] _ ->
case fromShATerm' name att0 of { (att1, name') ->
case fromShATerm' u att1 of { (att2, uri') ->
(att2, (name', take (length uri' -2) (tail uri')))}}
u -> fromShATermError "OWL.NS" u
isLangTag :: String -> Bool
isLangTag t = case splitOn '-' t of
p : r -> length p <= 4 && all isAlpha p &&
all (\ e -> length e <= 8 && all isAlphaNum e) r
_ -> False
instance ShATermConvertible Constant where
toShATermAux att0 (Constant a (Typed b)) = do
(att1, a') <- toShATerm' att0 (a ++ "^^")
(att2, b') <- toShATerm' att1 b
return $ addATerm (ShAAppl "TypedConstant" [a', b'] []) att2
toShATermAux att0 (Constant a (Untyped b)) = do
(att1, a') <- toShATerm' att0 (a ++ "@" ++ b)
return $ addATerm (ShAAppl "UntypedConstant" [a'] []) att1
{- I wonder why TypedConstant has two arguments when writing
but only one when reading -}
fromShATermAux ix att0 =
case getShATerm ix att0 of
ShAAppl "TypedConstant" [a] _ ->
case fromShATerm' a att0 of { (att1, a') ->
let (b, c) = span (/='^') a'
in (att1, Constant b $ Typed $ string2QName $ drop 2 c) }
ShAAppl "UntypedConstant" [a] _ ->
case fromShATerm' a att0 of { (att1, a') ->
let (b, c) = span (/='@') a'
t = drop 1 c
in (att1, if isLangTag t then
Constant b $ Untyped t
else Constant a' $ Untyped "") }
u -> fromShATermError "Constant" u
instance ShATermConvertible Entity where
toShATermAux att0 (Entity ty euri) = do
(att1, t) <- toShATerm' att0 euri
return $ addATerm (ShAAppl (show ty) [t] []) att1
fromShATermAux ix att0 = case getShATerm ix att0 of
u@(ShAAppl tys [a] _) -> case if tys == "OWLClassEntity" then
Just OWLClass else readMaybe tys of
Nothing -> fromShATermError "Entity" u
Just ty -> case fromShATerm' a att0 of
(att1, a') -> (att1, Entity ty a')
u -> fromShATermError "Entity" u
instance ShATermConvertible Description where
toShATermAux att0 xv = case xv of
OWLClassDescription a -> do
(att1, a') <- toShATerm' att0 a
return $ addATerm (ShAAppl "OWLClass" [a'] []) att1
ObjectJunction ty a -> do
(att1, a') <- toShATerm' att0 a
return $ addATerm (ShAAppl ("Object" ++ show ty) [a'] []) att1
ObjectComplementOf a -> do
(att1, a') <- toShATerm' att0 a
return $ addATerm (ShAAppl "ObjectComplementOf" [a'] []) att1
ObjectOneOf a -> do
(att1, a') <- toShATerm' att0 a
return $ addATerm (ShAAppl "ObjectOneOf" [a'] []) att1
ObjectValuesFrom ty a b -> do
(att1, a') <- toShATerm' att0 a
(att2, b') <- toShATerm' att1 b
return $ addATerm (ShAAppl ("Object" ++ show ty) [a',b'] []) att2
ObjectExistsSelf a -> do
(att1, a') <- toShATerm' att0 a
return $ addATerm (ShAAppl "ObjectExistsSelf" [a'] []) att1
ObjectHasValue a b -> do
(att1, a') <- toShATerm' att0 a
(att2, b') <- toShATerm' att1 b
return $ addATerm (ShAAppl "ObjectHasValue" [a',b'] []) att2
ObjectCardinality (Cardinality ty a b c) -> do
(att1, a') <- toShATerm' att0 a
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
return $ addATerm (ShAAppl ("Object" ++ show ty) [a',b', c'] []) att3
DataValuesFrom ty a b c -> do
(att1, a') <- toShATerm' att0 a
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
return $ addATerm (ShAAppl ("Data" ++ show ty) [a',b',c'] []) att3
DataHasValue a b -> do
(att1, a') <- toShATerm' att0 a
(att2, b') <- toShATerm' att1 b
return $ addATerm (ShAAppl "DataHasValue" [a',b'] []) att2
DataCardinality (Cardinality ty a b c) -> do
(att1, a') <- toShATerm' att0 a
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
return $ addATerm (ShAAppl ("Data" ++ show ty) [a',b',c'] []) att3
fromShATermAux ix att0 = case getShATerm ix att0 of
ShAAppl "OWLClass" [a] _ ->
case fromShATerm' a att0 of { (att1, a') ->
(att1, OWLClassDescription a') }
ShAAppl "ObjectUnionOf" [a] _ ->
case fromShATerm' a att0 of { (att1, a') ->
(att1, ObjectJunction UnionOf a') }
ShAAppl "ObjectIntersectionOf" [a] _ ->
case fromShATerm' a att0 of { (att1, a') ->
(att1, ObjectJunction IntersectionOf a') }
ShAAppl "ObjectComplementOf" [a] _ ->
case fromShATerm' a att0 of { (att1, a') ->
(att1, ObjectComplementOf a') }
ShAAppl "ObjectOneOf" [a] _ ->
case fromShATerm' a att0 of { (att1, a') ->
(att1, ObjectOneOf a') }
ShAAppl "ObjectAllValuesFrom" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, ObjectValuesFrom AllValuesFrom a' b') }}
ShAAppl "ObjectSomeValuesFrom" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, ObjectValuesFrom SomeValuesFrom a' b') }}
ShAAppl "ObjectExistsSelf" [a] _ ->
case fromShATerm' a att0 of { (att1, a') ->
(att1, ObjectExistsSelf a') }
ShAAppl "ObjectHasValue" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, ObjectHasValue a' b') }}
ShAAppl "ObjectMinCardinality" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, ObjectCardinality $ Cardinality MinCardinality a' b' c') }}}
ShAAppl "ObjectMaxCardinality" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, ObjectCardinality $ Cardinality MaxCardinality a' b' c') }}}
ShAAppl "ObjectExactCardinality" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, ObjectCardinality $ Cardinality ExactCardinality a' b' c') }}}
ShAAppl "DataAllValuesFrom" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, DataValuesFrom AllValuesFrom a' b' c') }}}
ShAAppl "DataSomeValuesFrom" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, DataValuesFrom SomeValuesFrom a' b' c') }}}
ShAAppl "DataHasValue" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, DataHasValue a' b') }}
ShAAppl "DataMinCardinality" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, DataCardinality $ Cardinality MinCardinality a' b' c') }}}
ShAAppl "DataMaxCardinality" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, DataCardinality $ Cardinality MaxCardinality a' b' c') }}}
ShAAppl "DataExactCardinality" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, DataCardinality $ Cardinality ExactCardinality a' b' c') }}}
u -> fromShATermError "Description" u
instance ShATermConvertible Axiom where
toShATermAux att0 xv = case xv of
EntityAnno a -> do
(att1, a') <- toShATerm' att0 a
return $ addATerm (ShAAppl "EntityAnno" [a'] []) att1
PlainAxiom a f -> do
(att1, a') <- toShATerm' att0 a
toATC_Axiom a' att1 f
fromShATermAux ix att0 = case getShATerm ix att0 of
ShAAppl "EntityAnno" [a] _ ->
case fromShATerm' a att0 of { (att1, a') ->
(att1, EntityAnno a') }
_ -> fromATC_Axiom ix att0
negPrefix :: PositiveOrNegative -> String
negPrefix ty = case ty of
Positive -> ""
Negative -> show ty
toATC_Axiom :: Int -> ATermTable -> PlainAxiom -> IO (ATermTable, Int)
toATC_Axiom a' att1 xv = case xv of
SubClassOf b c -> do
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
return $ addATerm (ShAAppl "SubClassOf" [a',b',c'] []) att3
EquivOrDisjointClasses ty b -> do
(att2, b') <- toShATerm' att1 b
return $ addATerm (ShAAppl (show ty ++ "Classes") [a',b'] []) att2
DisjointUnion b c -> do
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
return $ addATerm (ShAAppl "DisjointUnion" [a',b',c'] []) att3
SubObjectPropertyOf b c -> do
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
return $ addATerm (ShAAppl "SubObjectPropertyOf" [a',b',
c'] []) att3
EquivOrDisjointObjectProperties ty b -> do
(att2, b') <- toShATerm' att1 b
return $ addATerm (ShAAppl (show ty ++ "ObjectProperties")
[a', b'] []) att2
ObjectPropertyDomainOrRange ty b c -> do
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
return $ addATerm (ShAAppl ("ObjectProperty" ++ drop 3 (show ty))
[a', b', c'] []) att3
InverseObjectProperties b c -> do
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
return $ addATerm (ShAAppl "InverseObjectProperties" [a',b',
c'] []) att3
ObjectPropertyCharacter ch b -> do
(att2, b') <- toShATerm' att1 b
return $ addATerm (ShAAppl (show ch ++ "ObjectProperty")
[a', b'] []) att2
SubDataPropertyOf b c -> do
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
return $ addATerm (ShAAppl "SubDataPropertyOf" [a',b',c'] []) att3
EquivOrDisjointDataProperties ty b -> do
(att2, b') <- toShATerm' att1 b
return $ addATerm (ShAAppl (show ty ++ "DataProperties")
[a', b'] []) att2
DataPropertyDomainOrRange (DataDomain c) b -> do
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
return $ addATerm (ShAAppl "DataPropertyDomain" [a',b',c'] []) att3
DataPropertyDomainOrRange (DataRange c) b -> do
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
return $ addATerm (ShAAppl "DataPropertyRange" [a',b',c'] []) att3
FunctionalDataProperty b -> do
(att2, b') <- toShATerm' att1 b
return $ addATerm (ShAAppl "FunctionalDataProperty" [a',
b'] []) att2
SameOrDifferentIndividual ty b -> do
(att2, b') <- toShATerm' att1 b
return $ addATerm (ShAAppl (show ty ++ "Individual") [a',b'] []) att2
ClassAssertion b c -> do
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
return $ addATerm (ShAAppl "ClassAssertion" [a',b',c'] []) att3
ObjectPropertyAssertion (Assertion b ty c d) -> do
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
(att4, d') <- toShATerm' att3 d
return $ addATerm (ShAAppl (negPrefix ty ++ "ObjectPropertyAssertion")
[a', b', c', d'] []) att4
DataPropertyAssertion (Assertion b ty c d) -> do
(att2, b') <- toShATerm' att1 b
(att3, c') <- toShATerm' att2 c
(att4, d') <- toShATerm' att3 d
return $ addATerm (ShAAppl (negPrefix ty ++ "DataPropertyAssertion")
[a', b', c', d'] []) att4
Declaration b -> do
(att2, b') <- toShATerm' att1 b
return $ addATerm (ShAAppl "Declaration" [a',b'] []) att2
fromATC_Axiom :: Int -> ATermTable -> (ATermTable, Axiom)
fromATC_Axiom ix att0 = case getShATerm ix att0 of
ShAAppl "SubClassOf" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, PlainAxiom a' $ SubClassOf b' c') }}}
ShAAppl "EquivalentClasses" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ EquivOrDisjointClasses Equivalent b') }}
ShAAppl "DisjointClasses" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ EquivOrDisjointClasses Disjoint b') }}
ShAAppl "DisjointUnion" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, PlainAxiom a' $ DisjointUnion b' c') }}}
ShAAppl "SubObjectPropertyOf" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, PlainAxiom a' $ SubObjectPropertyOf b' c') }}}
ShAAppl "EquivalentObjectProperties" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ EquivOrDisjointObjectProperties Equivalent b') }}
ShAAppl "DisjointObjectProperties" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ EquivOrDisjointObjectProperties Disjoint b') }}
ShAAppl "ObjectPropertyDomain" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, PlainAxiom a' $ ObjectPropertyDomainOrRange ObjDomain b' c') }}}
ShAAppl "ObjectPropertyRange" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, PlainAxiom a' $ ObjectPropertyDomainOrRange ObjRange b' c') }}}
ShAAppl "InverseObjectProperties" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, PlainAxiom a' $ InverseObjectProperties b' c') }}}
ShAAppl "FunctionalObjectProperty" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ ObjectPropertyCharacter Functional b') }}
ShAAppl "InverseFunctionalObjectProperty" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ ObjectPropertyCharacter InverseFunctional b') }}
ShAAppl "ReflexiveObjectProperty" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ ObjectPropertyCharacter Reflexive b') }}
ShAAppl "IrreflexiveObjectProperty" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ ObjectPropertyCharacter Irreflexive b') }}
ShAAppl "SymmetricObjectProperty" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ ObjectPropertyCharacter Symmetric b') }}
-- a- or anti- symmetric?
ShAAppl "AntisymmetricObjectProperty" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ ObjectPropertyCharacter Antisymmetric b') }}
ShAAppl "TransitiveObjectProperty" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ ObjectPropertyCharacter Transitive b') }}
ShAAppl "SubDataPropertyOf" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, PlainAxiom a' $ SubDataPropertyOf b' c') }}}
ShAAppl "EquivalentDataProperties" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ EquivOrDisjointDataProperties Equivalent b') }}
ShAAppl "DisjointDataProperties" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ EquivOrDisjointDataProperties Disjoint b') }}
ShAAppl "DataPropertyDomain" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, PlainAxiom a' $ DataPropertyDomainOrRange (DataDomain c') b') }}}
ShAAppl "DataPropertyRange" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, PlainAxiom a' $ DataPropertyDomainOrRange (DataRange c') b') }}}
ShAAppl "FunctionalDataProperty" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ FunctionalDataProperty b') }}
ShAAppl "SameIndividual" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ SameOrDifferentIndividual Same b') }}
ShAAppl "DifferentIndividuals" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ SameOrDifferentIndividual Different b') }}
ShAAppl "ClassAssertion" [a,b,c] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
(att3, PlainAxiom a' $ ClassAssertion b' c') }}}
ShAAppl "ObjectPropertyAssertion" [a,b,c,d] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
case fromShATerm' d att3 of { (att4, d') ->
(att4, PlainAxiom a' $ ObjectPropertyAssertion
$ Assertion b' Positive c' d') }}}}
ShAAppl "NegativeObjectPropertyAssertion" [a,b,c,d] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
case fromShATerm' d att3 of { (att4, d') ->
(att4, PlainAxiom a' $ ObjectPropertyAssertion
$ Assertion b' Negative c' d') }}}}
ShAAppl "DataPropertyAssertion" [a,b,c,d] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
case fromShATerm' d att3 of { (att4, d') ->
(att4, PlainAxiom a' $ DataPropertyAssertion
$ Assertion b' Positive c' d') }}}}
ShAAppl "NegativeDataPropertyAssertion" [a,b,c,d] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
case fromShATerm' c att2 of { (att3, c') ->
case fromShATerm' d att3 of { (att4, d') ->
(att4, PlainAxiom a' $ DataPropertyAssertion
$ Assertion b' Negative c' d') }}}}
ShAAppl "Declaration" [a,b] _ ->
case fromShATerm' a att0 of { (att1, a') ->
case fromShATerm' b att1 of { (att2, b') ->
(att2, PlainAxiom a' $ Declaration b') }}
u -> fromShATermError "Axiom" u
{-! for SymbItems derive : ShATermConvertible !-}
{-! for SymbMapItems derive : ShATermConvertible !-}
{-! for EntityType derive : ShATermConvertible !-}
{-! for Ontology derive : ShATermConvertible !-}
{-! for Annotation derive : ShATermConvertible !-}
{-! for ObjectPropertyExpression derive : ShATermConvertible !-}
{-! for DatatypeFacet derive : ShATermConvertible !-}
{-! for DataRange derive : ShATermConvertible !-}
{-! for EntityAnnotation derive : ShATermConvertible !-}
{-! for SubObjectPropertyExpression derive : ShATermConvertible !-}