evalDiamondPlus implements the diamond-plus operator (<+). It returns true if the atom will be true at SOME point in the future interval. Syntax: <+[d1, d2] p(X) means "p(X) will be true at some point between d1 and d2 from now"
( atom ast.Atom, opInterval ast.Interval, interval *ast.Interval, subst unionfind.UnionFind, )
| 334 | // It returns true if the atom will be true at SOME point in the future interval. |
| 335 | // Syntax: <+[d1, d2] p(X) means "p(X) will be true at some point between d1 and d2 from now" |
| 336 | func (te *TemporalEvaluator) evalDiamondPlus( |
| 337 | atom ast.Atom, |
| 338 | opInterval ast.Interval, |
| 339 | interval *ast.Interval, |
| 340 | subst unionfind.UnionFind, |
| 341 | ) ([]unionfind.UnionFind, error) { |
| 342 | // Calculate the query interval based on the operator's interval |
| 343 | queryInterval, err := te.resolveFutureOperatorInterval(opInterval) |
| 344 | if err != nil { |
| 345 | return nil, err |
| 346 | } |
| 347 | |
| 348 | var solutions []unionfind.UnionFind |
| 349 | |
| 350 | // Query facts that overlap with the future query interval |
| 351 | err = te.temporalStore.GetFactsDuring(atom, queryInterval, func(tf factstore.TemporalFact) error { |
| 352 | // Unify the fact with the query atom |
| 353 | newSubst, err := unionfind.UnifyTermsExtend(atom.Args, tf.Atom.Args, subst) |
| 354 | if err != nil { |
| 355 | return nil // No match, continue |
| 356 | } |
| 357 | |
| 358 | // Bind interval variables if present |
| 359 | if interval != nil { |
| 360 | newSubst = te.bindIntervalVariables(*interval, tf.Interval, newSubst) |
| 361 | } |
| 362 | |
| 363 | solutions = append(solutions, newSubst) |
| 364 | return nil |
| 365 | }) |
| 366 | |
| 367 | if err != nil { |
| 368 | return nil, err |
| 369 | } |
| 370 | |
| 371 | return solutions, nil |
| 372 | } |
| 373 | |
| 374 | // evalBoxPlus implements the box-plus operator ([+). |
| 375 | // It returns true if the atom will be true CONTINUOUSLY throughout the future interval. |
no test coverage detected