tpmkms_4wp 9.5.1 → 9.6.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/animals.instance.json +151 -61
- package/common/animals.js +3 -5
- package/common/asking.js +116 -106
- package/common/avatar.test.json +1001 -860
- package/common/can.instance.json +2194 -0
- package/common/can.js +251 -0
- package/common/can.test.json +51307 -0
- package/common/characters.js +5 -5
- package/common/colors.instance.json +152 -12
- package/common/colors.js +3 -6
- package/common/comparable.instance.json +33 -3
- package/common/comparable.js +3 -6
- package/common/concept.js +25 -27
- package/common/concept.test.json +180 -144
- package/common/conjunction.js +13 -5
- package/common/conjunction.test.json +32 -42
- package/common/crew.instance.json +433 -173
- package/common/crew.js +4 -7
- package/common/crew.test.json +4148 -3324
- package/common/currency.js +1 -1
- package/common/dateTimeSelectors.instance.json +2 -2
- package/common/dateTimeSelectors.js +6 -9
- package/common/dateTimeSelectors.test.json +76935 -35739
- package/common/dates.instance.json +53 -3
- package/common/dates.js +3 -6
- package/common/dates.test.json +284 -287
- package/common/dialogues.js +43 -122
- package/common/dialogues.test.json +1248 -1152
- package/common/dimension.instance.json +21493 -561
- package/common/dimension.js +150 -55
- package/common/dimension.test.json +10979 -4625
- package/common/drone.instance.json +24709 -0
- package/common/drone.js +662 -0
- package/common/drone.test.json +30522 -0
- package/common/drone_v1.instance.json +24703 -0
- package/common/drone_v1.js +596 -0
- package/common/drone_v1.test.json +115538 -0
- package/common/edible.instance.json +388 -32
- package/common/edible.js +3 -5
- package/common/emotions.instance.json +85 -76
- package/common/emotions.js +4 -7
- package/common/emotions.test.json +242 -174
- package/common/english_helpers.js +336 -0
- package/common/errors.js +6 -6
- package/common/evaluate.js +2 -2
- package/common/events.js +8 -8
- package/common/fastfood.instance.json +1071 -393
- package/common/fastfood.js +14 -16
- package/common/fastfood.test.json +6970 -6829
- package/common/formulas.instance.json +11 -1
- package/common/formulas.js +3 -2
- package/common/gdefaults.js +111 -17
- package/common/help.js +12 -12
- package/common/help.test.json +65 -11
- package/common/helpers/concept.js +1 -1
- package/common/helpers/conjunction.js +54 -44
- package/common/helpers/dateTimeSelectors.js +2 -2
- package/common/helpers/dialogues.js +10 -2
- package/common/helpers/formulas.js +13 -11
- package/common/helpers/menus.js +12 -12
- package/common/helpers/meta.js +9 -9
- package/common/helpers/properties.js +186 -64
- package/common/helpers.js +167 -48
- package/common/hierarchy.js +12 -10
- package/common/kirk.instance.json +11 -1
- package/common/kirk.js +4 -6
- package/common/kirk.test.json +600 -424
- package/common/latin.instance.json +12 -12
- package/common/latin.js +12 -14
- package/common/length.instance.json +34660 -3158
- package/common/length.js +11 -6
- package/common/length.test.json +54357 -2557
- package/common/math.instance.json +39 -29
- package/common/math.js +49 -47
- package/common/menus.instance.json +77 -10
- package/common/menus.js +4 -13
- package/common/meta.js +80 -65
- package/common/nameable.js +36 -22
- package/common/nameable.test.json +436 -0
- package/common/numbers.js +1 -1
- package/common/ordering.instance.json +107 -19
- package/common/ordering.js +4 -6
- package/common/ordering.test.json +835 -417
- package/common/people.instance.json +176 -348
- package/common/people.js +9 -9
- package/common/people.test.json +4135 -3606
- package/common/pipboy.instance.json +187 -17
- package/common/pipboy.js +4 -4
- package/common/pokemon.instance.json +143 -13
- package/common/pokemon.js +4 -6
- package/common/pressure.instance.json +3610 -1601
- package/common/pressure.js +3 -5
- package/common/pressure.test.json +433 -477
- package/common/properties.instance.json +16 -17
- package/common/properties.js +32 -13
- package/common/properties.test.json +9565 -6951
- package/common/rates.instance.json +59 -0
- package/common/rates.js +95 -0
- package/common/rates.test.json +27702 -0
- package/common/reminders.instance.json +4 -4
- package/common/reminders.js +8 -11
- package/common/reminders.test.json +64635 -25787
- package/common/reports.instance.json +23 -3
- package/common/reports.js +21 -21
- package/common/scorekeeper.js +9 -12
- package/common/sdefaults.js +22 -2
- package/common/spock.instance.json +11 -1
- package/common/spock.js +4 -7
- package/common/spock.test.json +606 -430
- package/common/stgame.js +1 -1
- package/common/stm.js +41 -24
- package/common/tell.js +1 -1
- package/common/temperature.instance.json +3163 -1154
- package/common/temperature.js +3 -5
- package/common/temperature.test.json +433 -477
- package/common/tester.js +3 -3
- package/common/time.instance.json +24852 -0
- package/common/time.js +138 -141
- package/common/time.test.json +31876 -3757
- package/common/tokenize.js +5 -2
- package/common/ui.instance.json +12 -5
- package/common/ui.js +4 -13
- package/common/weight.instance.json +10501 -4099
- package/common/weight.js +3 -5
- package/common/weight.test.json +2601 -2263
- package/common/words.instance.json +9 -0
- package/common/words.js +50 -0
- package/common/words.test.json +2 -0
- package/common/wp.instance.json +548 -8
- package/common/wp.js +10 -8
- package/common/wp.test.json +7385 -6906
- package/main.js +6 -2
- package/package.json +25 -6
- package/common/listener.js +0 -50
- package/common/listener.test.json +0 -142
|
@@ -1,14 +1,33 @@
|
|
|
1
1
|
const pluralize = require('pluralize')
|
|
2
|
+
const { conjugateVerb } = require('../english_helpers')
|
|
2
3
|
const { unflatten, flattens, Digraph } = require('../runtime').theprogrammablemind
|
|
3
4
|
const _ = require('lodash')
|
|
4
5
|
const deepEqual = require('deep-equal')
|
|
5
|
-
const { chooseNumber } = require('../helpers.js')
|
|
6
|
+
const { chooseNumber, removeProp } = require('../helpers.js')
|
|
6
7
|
const { Frankenhash } = require('./frankenhash.js')
|
|
7
8
|
const { compose, translationMapping, translationMappingToInstantiatorMappings } = require('./meta.js')
|
|
8
9
|
|
|
9
10
|
class API {
|
|
10
11
|
constructor() {
|
|
11
12
|
this.digraph = new Digraph()
|
|
13
|
+
this.hierarchyWatchers = []
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
addHierarchyWatcher(watcher) {
|
|
17
|
+
this.hierarchyWatchers.push(watcher)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
removeHierarchyWatcher(watcher) {
|
|
21
|
+
this.hierarchyWatchers = this.hierarchyWatchers.filter((w) => w.id == watcher.id)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
seenHierarchyWatcher(watcherArgs) {
|
|
25
|
+
const args = { ...this.args, ...watcherArgs }
|
|
26
|
+
for (const { match, apply } of this.hierarchyWatchers) {
|
|
27
|
+
if (match(args)) {
|
|
28
|
+
apply(args)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
12
31
|
}
|
|
13
32
|
|
|
14
33
|
initialize({ km, objects, config }) {
|
|
@@ -28,7 +47,7 @@ class API {
|
|
|
28
47
|
this._km = km
|
|
29
48
|
this.__config = config
|
|
30
49
|
this.digraph = new Digraph()
|
|
31
|
-
|
|
50
|
+
function toJSON(h) {
|
|
32
51
|
if (h.child && h.parent) {
|
|
33
52
|
return h
|
|
34
53
|
} else {
|
|
@@ -228,8 +247,8 @@ class API {
|
|
|
228
247
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'is') && context.one && context.one.marker == after[0].tag && context.one.constraints && context.one.constraints[0] && context.one.constraints[0].constraint.marker == edAble.operator && context.one.constraints[0].constraint[before[0].tag].implicit,
|
|
229
248
|
apply: async ({context, fragments, g, gs, callId}) => {
|
|
230
249
|
const isToFromM = [{"from":["one"],"to":["two"]},{"from":["two"],"to":["one"]}]
|
|
231
|
-
const fromF = fragments(whoIsWhatVerbedBy).contexts()[0]
|
|
232
|
-
const toF = fragments(thisIsVerbedByThat)
|
|
250
|
+
const fromF = (await fragments(whoIsWhatVerbedBy)).contexts()[0]
|
|
251
|
+
const toF = await fragments(thisIsVerbedByThat)
|
|
233
252
|
const to = toF.contexts()[0]
|
|
234
253
|
const tm = translationMapping(fromF, to)
|
|
235
254
|
/*
|
|
@@ -263,12 +282,35 @@ class API {
|
|
|
263
282
|
// relation -> the semantics will be implements using relations
|
|
264
283
|
// edable: "y is owned by x" edable = { operator: 'owned' }
|
|
265
284
|
createActionPrefix(args, semanticApply) {
|
|
266
|
-
const {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
285
|
+
const {
|
|
286
|
+
operator,
|
|
287
|
+
before=[],
|
|
288
|
+
after=[],
|
|
289
|
+
create:createInit=[],
|
|
290
|
+
hierarchy=[],
|
|
291
|
+
config,
|
|
292
|
+
localHierarchy=[],
|
|
293
|
+
relation,
|
|
294
|
+
ordering,
|
|
295
|
+
doAble,
|
|
296
|
+
flatten,
|
|
297
|
+
can,
|
|
298
|
+
words = [],
|
|
299
|
+
unflatten:unflattenArgs = [],
|
|
300
|
+
focusable = [],
|
|
301
|
+
edAble } = args;
|
|
302
|
+
|
|
303
|
+
function createToCanonical(concept) {
|
|
304
|
+
if (typeof concept == 'string') {
|
|
305
|
+
return { id: concept, isA: [] }
|
|
306
|
+
} else {
|
|
307
|
+
return { isA: [], ...concept }
|
|
308
|
+
}
|
|
309
|
+
}
|
|
270
310
|
|
|
271
|
-
|
|
311
|
+
const create = createInit.map(createToCanonical)
|
|
312
|
+
|
|
313
|
+
if (doAble) {
|
|
272
314
|
if (before.length != 1) {
|
|
273
315
|
throw "Expected exactly one before argument"
|
|
274
316
|
}
|
|
@@ -287,7 +329,6 @@ class API {
|
|
|
287
329
|
pattern: `([(${beforeOperators} [${operator}|] ${afterOperators}^)])`,
|
|
288
330
|
allowDups: true,
|
|
289
331
|
})
|
|
290
|
-
// config.addOperator({ id: operator, level: 1, words: [operator] })
|
|
291
332
|
config.addBridge({
|
|
292
333
|
id: operator,
|
|
293
334
|
level: 1,
|
|
@@ -307,7 +348,6 @@ class API {
|
|
|
307
348
|
if (create.includes(argument.id)) {
|
|
308
349
|
// config.addHierarchy('unknown', argument.id)
|
|
309
350
|
// config.addHierarchy('what', argument.id)
|
|
310
|
-
// greg23 <<<<<<<<<<<< doing this
|
|
311
351
|
config.addHierarchy(argument.id, 'unknown')
|
|
312
352
|
config.addHierarchy(argument.id, 'what')
|
|
313
353
|
}
|
|
@@ -323,9 +363,9 @@ class API {
|
|
|
323
363
|
}
|
|
324
364
|
}
|
|
325
365
|
|
|
326
|
-
create.map( (id) => {
|
|
366
|
+
create.map( ({ id, isA }) => {
|
|
327
367
|
if (id === operator) {
|
|
328
|
-
|
|
368
|
+
function tagsToProps(where, args, suffix='') {
|
|
329
369
|
const i = 0;
|
|
330
370
|
let r = ''
|
|
331
371
|
for (const arg of args) {
|
|
@@ -341,13 +381,30 @@ class API {
|
|
|
341
381
|
afterArgs = tagsToProps('after', after, '*')
|
|
342
382
|
}
|
|
343
383
|
|
|
384
|
+
// const subjectContext = before[0].tag
|
|
385
|
+
// const interpolate = "[" + before.map((arg) => `{ property: '${arg.tag}' }`).concat(`{ ...operator, evaluateWord: true, number: ${subjectContext}.number }`).concat(after.map((arg) => `{ property: '${arg.tag}' }`)).join(',') + "]"
|
|
386
|
+
const imperative = (before.length == 0) ? "true" : "false"
|
|
387
|
+
// const interpolate = "[" + before.map((arg) => `{ property: '${arg.tag}' }`).concat(`{ ...operator, evaluateWord: true, imperative: ${imperative}, isVerb: true, number: 'one' }`).concat(after.map((arg) => `{ property: '${arg.tag}' }`)).join(',') + "]"
|
|
388
|
+
// const interpolateVerb = `{ property: "operator", context: { evaluateWord: true, imperative: ${imperative}, isVerb: true, number: 'one' } }`
|
|
389
|
+
let interpolateVerb
|
|
390
|
+
if (before.length > 0) {
|
|
391
|
+
interpolateVerb = `{ property: "operator", number: '${before[0].tag}' }`
|
|
392
|
+
} else {
|
|
393
|
+
interpolateVerb = `{ property: "operator" }`
|
|
394
|
+
}
|
|
395
|
+
const interpolate = "[" + before.map((arg) => `{ property: '${arg.tag}' }`).concat(interpolateVerb).concat(after.map((arg) => `{ property: '${arg.tag}' }`)).join(',') + "]"
|
|
396
|
+
|
|
344
397
|
const unflattenArgs = [ ...before.map( (arg) => arg.tag ), ...after.map( (arg) => arg.tag ) ]
|
|
345
398
|
const focusable = [ ...before.map( (arg) => arg.tag ), ...after.map( (arg) => arg.tag ) ]
|
|
399
|
+
let flattenProperty = ''
|
|
400
|
+
if (flatten) {
|
|
401
|
+
flattenProperty = ", flatten: true, relation: true "
|
|
402
|
+
}
|
|
346
403
|
config.addBridge({
|
|
347
404
|
id: operator,
|
|
348
405
|
level: 0,
|
|
349
406
|
localHierarchy: [...localHierarchy, ['object', 'unknown']],
|
|
350
|
-
bridge: `{ ... next(operator) ${doParams} ${beforeArgs} ${afterArgs}, unflatten: ${JSON.stringify(unflattenArgs)}, focusable: ${JSON.stringify(focusable)} }`,
|
|
407
|
+
bridge: `{ ... next(operator) ${flattenProperty} ${doParams} ${beforeArgs} ${afterArgs}, operator: { ...operator, evaluateWord: true, imperative: ${imperative}, isVerb: true, number: 'one' }, unflatten: ${JSON.stringify(unflattenArgs)}, focusable: ${JSON.stringify(focusable)}, interpolate: ${interpolate} }`,
|
|
351
408
|
allowDups: true
|
|
352
409
|
})
|
|
353
410
|
if (words.length > 0) {
|
|
@@ -360,13 +417,30 @@ class API {
|
|
|
360
417
|
} else {
|
|
361
418
|
config.addBridge({ id: id, allowDups: true })
|
|
362
419
|
}
|
|
420
|
+
|
|
421
|
+
for (const parentId of isA) {
|
|
422
|
+
config.addHierarchy(id, parentId)
|
|
423
|
+
}
|
|
363
424
|
})
|
|
364
425
|
|
|
365
426
|
if (words.length == 0) {
|
|
427
|
+
const createDef = createInit.find((def) => def.id == operator)
|
|
428
|
+
if (createDef && createDef.infinitive) {
|
|
429
|
+
const conjugation = conjugateVerb(createDef.infinitive)
|
|
430
|
+
if (can) {
|
|
431
|
+
const def = conjugation.find((def) => def.form == "pastParticiple")
|
|
432
|
+
config.addWord(def.word, { id: operator, initial: `{ value: '${operator}', isVerb: true, tense: '${def.tense}' }`})
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
366
436
|
const operatorPlural = pluralize.singular(operator)
|
|
367
437
|
const operatorSingular = pluralize.plural(operator)
|
|
368
|
-
config.addWord(operatorSingular, { id: operator, initial: `{ value: '${operator}', number: 'one' }`})
|
|
369
|
-
config.addWord(operatorPlural, { id: operator, initial: `{ value: '${operator}', number: 'many' }`})
|
|
438
|
+
config.addWord(operatorSingular, { id: operator, initial: `{ value: '${operator}', isVerb: true, number: 'one' }`})
|
|
439
|
+
config.addWord(operatorPlural, { id: operator, initial: `{ value: '${operator}', isVerb: true, number: 'many' }`})
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
for (const { child, parent } of hierarchy) {
|
|
443
|
+
config.addHierarchy(child, parent)
|
|
370
444
|
}
|
|
371
445
|
|
|
372
446
|
if (doAble) {
|
|
@@ -376,49 +450,97 @@ class API {
|
|
|
376
450
|
config.addPriority({ "context": [[operator, 0], ['means', 0], ], "choose": [0] })
|
|
377
451
|
config.addPriority({ "context": [['article', 0], [operator, 0], ], "choose": [0] })
|
|
378
452
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
const word = context.word
|
|
392
|
-
const sub = []
|
|
393
|
-
if (context.subphrase) {
|
|
394
|
-
sub.push(['that'])
|
|
395
|
-
}
|
|
396
|
-
return beforeGenerator.concat(sub).concat([word]).concat(afterGenerator).join(' ')
|
|
397
|
-
}
|
|
398
|
-
})
|
|
453
|
+
if (can) {
|
|
454
|
+
const beforeIds = before.map((def) => def.id)
|
|
455
|
+
const afterIds = after.map((def) => def.id)
|
|
456
|
+
config.addHierarchy(operator, 'canableAction')
|
|
457
|
+
config.addAssociation({ context: [[afterIds[0], 0], ['whatCanQuestion', 0], [beforeIds[0], 0], [operator, 0]], choose: 1 })
|
|
458
|
+
config.addAssociation({ context: [[afterIds[0], 1], ['whatCanQuestion', 0], [beforeIds[0], 0], [operator, 0]], choose: 1 })
|
|
459
|
+
config.addAssociation({ context: [[afterIds[0], 0], ['whatCanQuestionPassive', 0], [beforeIds[0], 0], ['beCanPassive', 0], [operator, 0], ['byCanPassive', 0]], choose: 1 })
|
|
460
|
+
config.addAssociation({ context: [[afterIds[0], 1], ['whatCanQuestionPassive', 0], [beforeIds[0], 0], ['beCanPassive', 0], [operator, 0], ['byCanPassive', 0]], choose: 1 })
|
|
461
|
+
config.addAssociation({ context: [[afterIds[0], 0], ['canPassive', 0], ['beCanPassive', 0], [operator, 0], ['byCanPassive', 0], [beforeIds[0], 0]], choose: 1 })
|
|
462
|
+
config.addAssociation({ context: [[afterIds[0], 1], ['canPassive', 0], ['beCanPassive', 0], [operator, 0], ['byCanPassive', 0], [beforeIds[0], 0]], choose: 1 })
|
|
463
|
+
}
|
|
399
464
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
if (!context.do.query || evalue.truthValueOnly || brief) {
|
|
409
|
-
if (evalue.truthValue) {
|
|
410
|
-
yesno = 'yes'
|
|
411
|
-
} else if (evalue.truthValue === false) {
|
|
412
|
-
yesno = 'no'
|
|
465
|
+
if (false) {
|
|
466
|
+
config.addGenerator({
|
|
467
|
+
notes: 'ordering generator for paraphrase',
|
|
468
|
+
match: ({context}) => context.marker == operator && context.paraphrase && !context.query,
|
|
469
|
+
apply: async ({context, gp, g}) => {
|
|
470
|
+
const beforeGenerator = []
|
|
471
|
+
for (const arg of before) {
|
|
472
|
+
beforeGenerator.push(await g(context[arg.tag]))
|
|
413
473
|
}
|
|
474
|
+
const afterGenerator = []
|
|
475
|
+
for (const arg of after) {
|
|
476
|
+
afterGenerator.push(await gp(context[arg.tag]))
|
|
477
|
+
}
|
|
478
|
+
const word = context.word
|
|
479
|
+
const sub = []
|
|
480
|
+
if (context.subphrase) {
|
|
481
|
+
sub.push(['that'])
|
|
482
|
+
}
|
|
483
|
+
return beforeGenerator.concat(sub).concat([word]).concat(afterGenerator).join(' ')
|
|
414
484
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
485
|
+
})
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if (true) {
|
|
489
|
+
config.addGenerator({
|
|
490
|
+
notes: 'ordering generator for response',
|
|
491
|
+
match: ({context}) => context.marker == operator && context.evalue && context.isResponse,
|
|
492
|
+
apply: async ({context, s, g, km, flatten}) => {
|
|
493
|
+
const brief = km("dialogues").api.getBrief()
|
|
494
|
+
|
|
495
|
+
let { evalue } = context
|
|
496
|
+
let yesno = ''
|
|
497
|
+
let hasVariables = false
|
|
498
|
+
if (context.focusable) {
|
|
499
|
+
for (const f of context.focusable) {
|
|
500
|
+
if (context[f].query) {
|
|
501
|
+
hasVariables = true
|
|
502
|
+
break
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// if (!context.do?.query || evalue.truthValueOnly || context.truthValueOnly || brief) {
|
|
508
|
+
if (evalue.truthValueOnly || context.truthValueOnly || context.wantsTruthValue || !hasVariables) {
|
|
509
|
+
function any(value, test) {
|
|
510
|
+
if (test(value)) {
|
|
511
|
+
return true
|
|
512
|
+
}
|
|
513
|
+
const values = flatten(['list'], value)[0]
|
|
514
|
+
for (const value of values) {
|
|
515
|
+
if (test(value)) {
|
|
516
|
+
return true
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
if (any(evalue, (value) => value.truthValue)) {
|
|
521
|
+
yesno = 'yes'
|
|
522
|
+
} else if (evalue.truthValue === false || context.truthValueOnly) {
|
|
523
|
+
yesno = 'no'
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
if (evalue.truthValueOnly) {
|
|
527
|
+
return `${yesno}`
|
|
528
|
+
} else {
|
|
529
|
+
if (context.voice) {
|
|
530
|
+
evalue = await s({ ...evalue, toVoice: context.voice, flatten: false})
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
const details = await g(Object.assign({}, evalue, { paraphrase: true }))
|
|
534
|
+
if (yesno) {
|
|
535
|
+
return `${yesno} ${details}`
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
return details
|
|
539
|
+
}
|
|
540
|
+
}
|
|
419
541
|
}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
542
|
+
})
|
|
543
|
+
}
|
|
422
544
|
|
|
423
545
|
if (ordering) {
|
|
424
546
|
config.addSemantic({
|
|
@@ -494,7 +616,7 @@ class API {
|
|
|
494
616
|
if (relation) {
|
|
495
617
|
config.addSemantic({
|
|
496
618
|
notes: `setter for ${operator}`,
|
|
497
|
-
match: ({context}) => context.marker == operator,
|
|
619
|
+
match: ({context}) => context.marker == operator && !context.toVoice,
|
|
498
620
|
apply: ({context, km, hierarchy, config}) => {
|
|
499
621
|
const api = km('properties').api
|
|
500
622
|
// add types for arguments
|
|
@@ -515,9 +637,8 @@ class API {
|
|
|
515
637
|
config.addSemantic({
|
|
516
638
|
notes: `getter for ${operator}`,
|
|
517
639
|
match: ({context}) => context.marker == operator && context.query,
|
|
518
|
-
apply: ({context, km}) => {
|
|
640
|
+
apply: ({context, km, callId}) => {
|
|
519
641
|
const api = km('properties').api
|
|
520
|
-
|
|
521
642
|
context.evalue = {
|
|
522
643
|
marker: 'list',
|
|
523
644
|
value: unflatten(api.relation_get(context, before.concat(after).map( (arg) => arg.tag ) ))
|
|
@@ -527,8 +648,8 @@ class API {
|
|
|
527
648
|
if (context.evalue.value.length == 0) {
|
|
528
649
|
context.evalue.marker = 'answerNotKnown';
|
|
529
650
|
context.evalue.value = [];
|
|
530
|
-
|
|
531
|
-
context.evalue.
|
|
651
|
+
} else {
|
|
652
|
+
// context.evalue.truthValue = true
|
|
532
653
|
}
|
|
533
654
|
}
|
|
534
655
|
})
|
|
@@ -552,10 +673,13 @@ class API {
|
|
|
552
673
|
}
|
|
553
674
|
|
|
554
675
|
relation_add (relations) {
|
|
676
|
+
removeProp(relations, (val, prop, obj) => prop === 'range')
|
|
677
|
+
|
|
555
678
|
if (!Array.isArray(relations)) {
|
|
556
679
|
relations = [relations]
|
|
557
680
|
}
|
|
558
681
|
for (const relation of relations) {
|
|
682
|
+
relation.truthValue = true
|
|
559
683
|
this._objects.relations.push(relation)
|
|
560
684
|
}
|
|
561
685
|
}
|
|
@@ -599,7 +723,7 @@ class API {
|
|
|
599
723
|
return value
|
|
600
724
|
}
|
|
601
725
|
|
|
602
|
-
relation_get(context, args) {
|
|
726
|
+
relation_get (context, args) {
|
|
603
727
|
const andTheAnswerIs = []
|
|
604
728
|
for (const relation of this._objects.relations) {
|
|
605
729
|
if (this.relation_match(args, context, relation)) {
|
|
@@ -669,8 +793,7 @@ class API {
|
|
|
669
793
|
if (!context) {
|
|
670
794
|
return;
|
|
671
795
|
}
|
|
672
|
-
return this._km("stm").api.getVariable(context.value
|
|
673
|
-
// return context.value
|
|
796
|
+
return this._km("stm").api.getVariable(context) || context.value;
|
|
674
797
|
}
|
|
675
798
|
|
|
676
799
|
async getProperty(object, property, g) {
|
|
@@ -703,7 +826,6 @@ class API {
|
|
|
703
826
|
}
|
|
704
827
|
|
|
705
828
|
setProperty(object, property, value, has, skipHandler) {
|
|
706
|
-
// debugger
|
|
707
829
|
if (!skipHandler) {
|
|
708
830
|
const handler = this.propertiesFH.getHandler([object, property])
|
|
709
831
|
if (handler) {
|