Migration from Loom to Powerloom
"Young, David" <[email protected]> Tue, 21 Nov 2006 09:50:46 -0500
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <A24502FBD4FB85468D5781CD84213E40015B9BBB@mail01.bhusa.bhsoftware.com> |
Hey folks. I'm coming from a Loom background, and have begun looking at
PowerLoom. I think the best way for me to make the leap is to migrate an
existing Loom app, and I could use a bit of help. What follows is a
prototype implementation, in Loom, of the 13 original Allen time primitives.
When you have a bit of time, would you please take a few of these primitives
and translate them to PowerLoom? Comments about the original are welcome, in
case our approach is lacking. Thanks very much for your help.
Cheers, david
For wisdom is more precious than rubies,
and nothing you desire can compare with her.
-- Proverbs 8:11
But all the world understands my language.
-- Franz Joseph Haydn
----------------- Loom file starts here ---------------------
;;; File: allen.lisp
;;; Description: An implementation of the thirteen original Allen
primitives.
(in-package :dt)
(defconcept Temporal-Concept)
(defconcept Entity-With-Interval
:is (:and
Temporal-Concept
(:exactly 1 has-end-time)
(:exactly 1 has-start-time)))
(defrelation has-start-time
:domain Entity-With-Interval
:range number)
(defrelation has-end-time
:domain Entity-With-Interval
:range number)
(defrelation occurs-before
:is <
:domain Number
:range Number
:characteristics (:closed-world :read-only :monotonic :perfect))
(defrelation occurs-after
:is >
:domain Number
:range Number
:characteristics (:closed-world :read-only :monotonic :perfect))
(defrelation simultaneous-with
:is (:satisfies (?t1 ?t2)
(= ?t1 ?t2)))
(defrelation cotemporal
:is (:satisfies (?t1 ?t2)
(:for-some (?t1-start ?t2-start ?t1-end ?t2-end)
(:and
(:not (= ?t1 ?t2))
(has-start-time ?t1 ?t1-start)
(has-end-time ?t1 ?t1-end)
(has-start-time ?t2 ?t2-start)
(has-end-time ?t2 ?t2-end)
(simultaneous-with ?t1-start ?t2-start)
(simultaneous-with ?t1-end ?t2-end))))
:domain Entity-With-Interval
:range Entity-With-Interval)
(defrelation meets
:is (:satisfies (?t1 ?t2)
(:for-some (?t2-start ?t1-end)
(:and
(has-end-time ?t1 ?t1-end)
(has-start-time ?t2 ?t2-start)
(simultaneous-with ?t1-end ?t2-start))))
:domain Entity-With-Interval
:range Entity-With-Interval)
(defrelation met
:is (:satisfies (?t1 ?t2)
(meets ?t2 ?t1))
:domain Entity-With-Interval
:range Entity-With-Interval)
(defrelation during
:is (:satisfies (?t1 ?t2)
(:for-some (?t1-start ?t2-start ?t1-end ?t2-end)
(:and
(has-start-time ?t1 ?t1-start)
(has-end-time ?t1 ?t1-end)
(has-start-time ?t2 ?t2-start)
(has-end-time ?t2 ?t2-end)
(occurs-after ?t1-start ?t2-start)
(occurs-before ?t1-end ?t2-end))))
:domain Entity-With-Interval
:range Entity-With-Interval)
(defrelation contains
:is (:satisfies (?t1 ?t2)
(during ?t2 ?t1))
:domain Entity-With-Interval
:range Entity-With-Interval)
(defrelation starts
:is (:satisfies (?t1 ?t2)
(:for-some (?t1-start ?t2-start ?t1-end ?t2-end)
(:and
(has-start-time ?t1 ?t1-start)
(has-end-time ?t1 ?t1-end)
(has-start-time ?t2 ?t2-start)
(has-end-time ?t2 ?t2-end)
(simultaneous-with ?t1-start ?t2-start)
(occurs-before ?t1-end ?t2-end))))
:domain Entity-With-Interval
:range Entity-With-Interval)
(defrelation started
:is (:satisfies (?t1 ?t2)
(starts ?t2 ?t1))
:domain Entity-With-Interval
:range Entity-With-Interval)
(defrelation finishes
:is (:satisfies (?t1 ?t2)
(:for-some (?t1-start ?t2-start ?t1-end ?t2-end)
(:and
(has-start-time ?t1 ?t1-start)
(has-end-time ?t1 ?t1-end)
(has-start-time ?t2 ?t2-start)
(has-end-time ?t2 ?t2-end)
(simultaneous-with ?t1-end ?t2-end)
(occurs-after ?t1-end ?t2-end))))
:domain Entity-With-Interval
:range Entity-With-Interval)
(defrelation finished
:is (:satisfies (?t1 ?t2)
(finishes ?t2 ?t1))
:domain Entity-With-Interval
:range Entity-With-Interval)
(defrelation before
:is (:satisfies (?t1 ?t2)
(:for-some (?t1-end ?t2-start)
(:and
(has-end-time ?t1 ?t1-end)
(has-start-time ?t2 ?t2-start)
(occurs-before ?t1-end ?t2-start))))
:domain Entity-With-Interval
:range Entity-With-Interval)
(defrelation after
:is (:satisfies (?t1 ?t2)
(:for-some (?t1-start ?t2-end)
(:and
(has-start-time ?t1 ?t1-start)
(has-end-time ?t2 ?t2-end)
(occurs-after ?t1-start ?t2-end))))
:domain Entity-With-Interval
:range Entity-With-Interval)
(defrelation overlaps
:is (:satisfies (?t1 ?t2)
(:for-some (?start-1 ?start-2 ?end-1 ?end-2)
(:and
(has-start-time ?t1 ?start-1)
(has-end-time ?t1 ?end-1)
(has-start-time ?t2 ?start-2)
(has-end-time ?t2 ?end-2)
(occurs-before ?start-1 ?start-2)
(occurs-after ?end-1 ?start-2)
(occurs-before ?end-1 ?end-2))))
:domain Entity-With-Interval
:range Entity-With-Interval)
(defrelation overlapped
:is (:satisfies (?t1 ?t2)
(overlaps ?t2 ?t1))
:domain Entity-With-Interval
:range Entity-With-Interval)
This email message is for the sole use of the intended recipients(s) and may contain confidential and privileged information of Bloodhound Software, Inc.. Any unauthorized review, use, disclosure is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.