-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinquiry-implementations.lisp
executable file
·445 lines (365 loc) · 13.7 KB
/
inquiry-implementations.lisp
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
(in-package :penman)
(defun PROCESSIDEA (CONFIGURATION)
"Which process does the figure have?"
(fetch-feature '|processInConfiguration| CONFIGURATION))
(defun ISTHERELOCATUM (CONFIGURATION)
"Is there a locatum in the configuration?"
(cond ((LOCATUMIDEA CONFIGURATION) 'yes)
(t 'no)))
(defun LOCATUMIDEA (PROCESS)
"Which locatum does the figure have?"
(fetch-feature '|space#locatum| PROCESS))
(defun PLACEMENTIDEA (onus)
"Which placement does the figure have?"
(fetch-subc-feature '|space#placement| onus))
(defun ROUTEIDEA (onus)
"Which placement does the figure have?"
(fetch-subc-feature '|space#route| onus))
(defun ISTHEREACTOR (CONFIGURATION)
"Is there an actor in the configuration?"
(cond ((ACTORIDEA CONFIGURATION) 'yes)
(t 'no)))
(defun ACTORIDEA (onus)
"Which actor does the figure have?"
(fetch-subc-feature '|actor| onus))
(defun ISTHEREACTEE (CONFIGURATION)
"Is there an actee in the configuration?"
(cond ((ACTEEIDEA CONFIGURATION) 'yes)
(t 'no)))
(defun ACTEEIDEA (onus)
"Which actee does the figure have?"
(fetch-subc-feature '|actee| onus))
(defun ISTHERESENSER (CONFIGURATION)
"Is there an senser in the configuration?"
(cond ((SENSERIDEA CONFIGURATION) 'yes)
(t 'no)))
(defun SENSERIDEA (onus)
"Which senser does the figure have?"
(fetch-subc-feature '|senser| onus))
(defun ISTHEREPHENOMENON (CONFIGURATION)
"Is there an phenomenon in the configuration?"
(cond ((PHENOMENONIDEA CONFIGURATION) 'yes)
(t 'no)))
(defun PHENOMENONIDEA (onus)
"Which phenomenon does the figure have?"
(fetch-subc-feature '|phenomenon| onus))
(defun ISTHEREEXISTENT (CONFIGURATION)
"Is there an existent in the configuration?"
(cond ((EXISTENTIDEA CONFIGURATION) 'yes)
(t 'no)))
(defun EXISTENTIDEA (onus)
"Which existent does the figure have?"
(fetch-subc-feature '|existent| onus))
(defun ATTRIBUENDIDEA (onus)
"Which attribuend does the figure have?"
(fetch-subc-feature '|attribuend| onus))
(defun ATTRIBUTEIDEA (onus)
"Which attribute does the figure have?"
(fetch-subc-feature '|attribute| onus))
(defun NEXTIDEA (onus)
"Which next does the phenomenon have?"
(fetch-subc-feature '|next| onus))
(defun CIRCUMSTANCEIDEA (ELEMENT)
""
(fetch-subc-feature '|circumstanceInConfiguration| ELEMENT))
(defun SPATIALMODALITYIDEA (location)
""
(fetch-feature '|space#hasSpatialModality| location))
(defun ISTHEREMODIFICATION (onus)
"Is there a modification in the location?"
(cond ((MODIFICATIONIDEA onus) 'yes)
(t 'no)))
(defun MODIFICATIONIDEA (onus)
""
(fetch-feature '|hasModification| onus))
(defun QUANTITYIDEA (onus)
""
(fetch-feature 'quantity onus))
(defun ISTHERERELATUM (location)
"Is there a relatum in the location?"
(cond ((RELATUMIDEA location) 'yes)
(t 'no)))
(defun RELATUMIDEA (onus)
"Which relatum does the location have?"
(fetch-feature '|space#relatum| onus))
(defun ISTHEREMODALITY (location)
"Is there a spatial modality in the location?"
(cond ((MODALITYIDEA location) 'yes)
(t 'no)))
(defun MODALITYIDEA (onus)
"Which spatial modality does the location have?"
(fetch-feature '|space#hasSpatialModality| onus))
(defun ISTHERESOURCE (route)
"Is there a source in the route?"
(cond ((SOURCEIDEA route) 'yes)
(t 'no)))
(defun SOURCEIDEA (onus)
"Which source does the route have?"
(fetch-subc-feature '|space#source| onus))
(defun ISTHEREDESTINATION (route)
"Is there a destination in the route?"
(cond ((DESTINATIONIDEA route) 'yes)
(t 'no)))
(defun DESTINATIONIDEA (onus)
"Which destination does the route have?"
(fetch-subc-feature '|space#destination| onus))
(defun ISTHEREPATHPLACEMENT (route)
"Is there a path placement in the route?"
(cond ((PATHPLACEMENTIDEA route) 'yes)
(t 'no)))
(defun PATHPLACEMENTIDEA (route)
"Which path placement does the route have?"
(fetch-subc-feature '|space#pathPlacement| route))
(defun ISTHEREORIENTATIONDIRECTION (route)
"Is there an orientation direction in the route?"
(cond ((ORIENTATIONDIRECTIONIDEA route) 'yes)
(t 'no)))
(defun ORIENTATIONDIRECTIONIDEA (onus)
"Which orientation direction does the figure have?"
(fetch-subc-feature '|space#orientationDirection| onus))
; (defun ISTHEREROUTE (location)
; "Is there a route in the location?"
; (cond ((ROUTEIDEA location) 'yes)
; (t 'no)))
(defun ISTHERECIRCUMSTANCE (element)
""
; (if (fetch-feature '|space#hasSpatialModality| element) 'yes 'no)
; ; 'no
(cond ((CIRCUMSTANCEIDEA element) 'yes)
(t 'no))
)
(defun LOCATIONSTATUS (element)
""
(if (term-type-p element '|space#GeneralizedLocation|) 'location 'not-location))
(defun CONFIGURATIONTYPE (element)
"??"
(cond
((term-type-p element
'|Existence|) 'existence)
((term-type-p element
'|GeneralizedLocating|) 'spatial-locating)
((term-type-p element
'|BeingANDHaving|) 'relating)
((term-type-p element
'|space#AffectingDirectedMotion|) 'affecting-directed-motion)
((term-type-p element
'|space#NonAffectingDirectedMotion|) 'non-affecting-directed-motion)
((term-type-p element
'|space#NonAffectingOrientationChange|) 'non-affecting-orientation-change)
((term-type-p element
'|space#AffectingMotion|) 'affecting-motion)
((term-type-p element
'|Perception|) 'perception)
((term-type-p element
'|Liking|) 'liking)
(t nil)))
(defun SPATIALMODALITYTYPE (element)
"??"
(cond
((term-type-p element
'|space#AboveProjectionExternal|) 'above-projection-external)
((term-type-p element
'|space#AboveProjectionInternal|) 'above-projection-internal)
((term-type-p element
'|space#BackProjectionExternal|) 'back-projection-external)
((term-type-p element
'|space#BackProjectionInternal|) 'back-projection-internal)
((term-type-p element
'|space#Central|) 'central)
((term-type-p element
'|space#Connection|) 'connection)
((term-type-p element
'|space#Containment|) 'containment)
((term-type-p element
'|space#DenialOfFunctionalControl|) 'denial-of-functional-control)
((term-type-p element
'|space#Distal|) 'distal)
((term-type-p element
'|space#Distribution|) 'distribution)
((term-type-p element
'|space#FrontProjectionExternal|) 'front-projection-external)
((term-type-p element
'|space#GeneralDirectionalDistancing|) 'general-directional-distancing)
((term-type-p element
'|space#GeneralDirectionalNearing|) 'general-directional-nearing)
((term-type-p element
'|space#North|) 'north)
((term-type-p element
'|space#MultipleDirectional|) 'multiple-directional)
((term-type-p element
'|space#PathRepresenting|) 'path-representing)
((term-type-p element
'|space#Proximal|) 'proximal)
((term-type-p element
'|space#QuantitativeDistance|) 'quantitative-distance)
((term-type-p element
'|space#RelativeNonProjectionAxial|) 'relative-non-projection-axial)
((term-type-p element
'|space#RightProjection|) 'right-projection)
((term-type-p element
'|space#Surrounding|) 'surrounding)
(t 'no-spatial-modality)))
(defun ISDESTINATIONRECURSIVE (MINORPROCESS)
"Is destination recursive?"
(cond ((DESTINATIONRECURSIVITY MINORPROCESS) 'yes)
(t 'no)))
; kill all these -phrase's below?
(defun DESTINATIONRECURSIVITY (MINORPROCESS)
"Is destination recursive?"
(fetch-feature 'recursivity MINORPROCESS))
(defun APEPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#AboveProjectionExternal|) 'yes 'no))
(defun APIPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#AboveProjectionInternal|) 'yes 'no))
(defun BPEPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#BackProjectionExternal|) 'yes 'no))
(defun BPIPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#BackProjectionInternal|) 'yes 'no))
(defun CENTRALPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#Central|) 'yes 'no))
(defun CONNECTIONPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#Connection|) 'yes 'no))
(defun CONTAINMENTPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#Containment|) 'yes 'no))
(defun DOFCPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#DenialOfFunctionalControl|) 'yes 'no))
(defun DISTALPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#Distal|) 'yes 'no))
(defun DISTRIBUTIONPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#Distribution|) 'yes 'no))
(defun FPEPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#FrontProjectionExternal|) 'yes 'no))
(defun NORTHINTERNALPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#NorthInternal|) 'yes 'no))
(defun PARTHOODPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#Parthood|) 'yes 'no))
(defun PROXIMALPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
; (print "HelloWorld")
(if (term-type-p Element '|space#Proximal|) 'yes 'no))
(defun QUANTITATIVEDISTANCEPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#QuantitativeDistance|) 'yes 'no))
(defun RNPAPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#RelativeNonProjectionAxial|) 'yes 'no))
(defun SUPPORTPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#Support|) 'yes 'no))
(defun SURROUNDINGPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#Surrounding|) 'yes 'no))
(defun UPEPHRASE (ELEMENT)
"Is the prepositional phrase of this type?"
(if (term-type-p element '|space#UnderProjectionExternal|) 'yes 'no))
(defun NAMEGENDER (CLASS)
""
(let ((features (fetch-lexicon-info CLASS 'features)))
(if features
(if (member 'feminine features)
'feminine
'masculine)
'masculine)))
(defun MINORPROCESS-PREPOSITION (MINORPROCESS)
""
(let ((features (fetch-lexicon-info MINORPROCESS 'features)))
(if features
(cond
((member 'preposition-by features) 'preposition-by)
((member 'preposition-of features) 'preposition-of)
((member 'preposition-with features) 'preposition-with)
((member 'preposition-in features) 'preposition-in)
((member 'preposition-for features) 'preposition-for)
((member 'preposition-until features) 'preposition-until)
(t 'not-prepositioned)))))
(defun NAMEIDENTIFIABILITY (CLASS)
""
(if (equal (fetch-feature 'identifiability CLASS) 'not-identifiable)
'not-identifiable
'identifiable))
(defun CLASSNAME (concept association)
"all inquiries that have idea in the name must fetch features this way"
(LEXICAL-TERM-RESOLUTION concept association))
(defun CLASSNAME2 (element element-slot)
""
(lexical-term-resolution element element-slot))
(defun REFERENCETYPE (element)
""
(if (term-type-p element '|NamedObject|)
'thing
'class))
; This is a temporary fix. Basically, KPML generates 'things'
; if the function is of type named-object or any of its sub-types
; and 'classes' if the function has any other type. However,
; the system Reference-Type deals with the difference
; between "I like coffee" vs. "I like this coffee". This
; should not be an ontological difference, but a grammatical
; one, whose answer is provided by the SPL expression. How
; to implement an inquiry to look for an answer inside the
; SPL and not in GUM?
(defun COMPLEXITY (ELEMENT)
""
(if (fetch-feature 'next ELEMENT)
'complex
'simplex))
; currently, 'next' is not being used in SPLs, as it would
; also cause an 'invalid keyword' warning. Thus, we implemented
; complex nominal groups (e.g. with 'and') as a single lexical
; item and so all nominal groups in the grammar are 'simplex'es.
(defun CONFIGURATIONSTATUS (element)
"all with status in name this way 1"
(if (term-type-p element '|Configuration|)
'configuration
'not-configuration
)
)
(defun CIRCUMSTANCESTATUS (element)
"all with status in name this way"
(if (term-type-p element '|Circumstance|)
'circumstance
'not-circumstance)
)
(defun term-resolve-id-code (concept association)
(LEXICAL-TERM-RESOLUTION concept association))
(defun QUANTITATIVEDE (ELEMENT)
""
(if (term-type-p element '|space#QuantitativeSpatialTemporal|) 'yes 'no))
(defun ACCESSIBILITY (ELEMENT) ; ok, this is workig!
"Is modification of type 'accessibility'?"
(cond ((ACCESSIBILITYIDEA element) 'yes)
(t 'no)))
(defun ACCESSIBILITYIDEA (onus) ; ok, this is workig!
"If modification is accessibility, grab semantics."
(fetch-subc-feature 'accessibility onus))
(defun ACCESSIBILITYLEVEL (MODIFICATION)
"Once modification is accessibility, which accessibility level is it?"
(print "the semantics for accessibility-level inquiry is:")
(print modification)
(print "the returned value is:")
(print (term-type-p MODIFICATION 'accessibility))
(term-type-p MODIFICATION 'accessibility))
(defun QUALITATIVEDE (ELEMENT)
""
(if (term-type-p element '|space#QualitativeSpatialTemporal|) 'yes 'no))
(defun RECIPROCAL (ELEMENT)
""
(if (term-type-p element '|space#Reciprocal|) 'yes 'no))
(defun SPATIALPERSPECTIVE (ELEMENT)
""
(if (term-type-p element '|space#SpatialPerspective|) 'yes 'no))
(defun CASE-PRESELECTION (ELEMENT)
""
'not-prepositioned)