Download presentation
Presentation is loading. Please wait.
Published byByron Mason Modified over 9 years ago
1
Arden Objects Proposal Arden SIG Meeting Jan. 14, 2003 San Antonio, Texas Presented by Roger Corman
2
Introduction This proposal follows the McKesson presentation by Tom Hooks at the previous Arden SIG meeting. This proposal follows the McKesson presentation by Tom Hooks at the previous Arden SIG meeting. It attempts to incorporate most of the ideas Tom presented in the Phase 3 approach. It attempts to incorporate most of the ideas Tom presented in the Phase 3 approach. Adds syntax for object definition. Adds syntax for object definition. Adds more formalism (B/N Forms) Adds more formalism (B/N Forms)
3
Introduction (cont.) This is still an incomplete proposal: a few issues are not covered and presumably will be topics of discussion.
4
Goals Simplify handling of query results. Simplify handling of query results. Keeping query results as a list of objects/records is often more convenient and intuitive. Keeping query results as a list of objects/records is often more convenient and intuitive. Creates a standard way to have named object/attributes in the system. This may allow platform-specific extensions to other objects to still share much of the object manipulation logic. Creates a standard way to have named object/attributes in the system. This may allow platform-specific extensions to other objects to still share much of the object manipulation logic. Maintain backward compatibility. Maintain backward compatibility.
5
Language Goals Keep added syntax/reserved words to a minimum. Keep added syntax/reserved words to a minimum. Any changes should work with existing Arden as seamlessly as possible. Any changes should work with existing Arden as seamlessly as possible. Coax the objects out of Arden, rather than impose a new model. Coax the objects out of Arden, rather than impose a new model. Simplicity. Simplicity.
6
Object Declaration Statement The OBJECT statement definition: := OBJECT [,... ]; := OBJECT [,... ]; LET BE OBJECT [,... ]; Field names are Arden identifiers. Example: MedicationDose := object [Medication, Dose, Status]; MedicationDose := object [Medication, Dose, Status];
7
Object Declaration Statement (cont.) Object declaration statements can only occur in the Data Slot, and they must occur prior to any use of the object type. This is similar to an MLM or DESTINATION declaration.
8
Object Declaration: Syntax Modifications Add OBJECT as an Arden reserved word. This is the only new reserved word being proposed, and possibly the only backward compatibility issue.
9
Object Declaration: Syntax Modifications In, added OBJECT option: ::= ::= "READ" "READ" | "MLM" <term | "FUNCTION" <term | "MLM" "FROM" "INSTITUTION" | "MLM" "FROM" "INSTITUTION" | "EVENT" | "EVENT" | "OBJECT" | "OBJECT" | "MESSAGE" | "MESSAGE" | "DESTINATION" | "DESTINATION" | "ARGUMENT" | "ARGUMENT" | "ARGUMENT" | |
10
Object Declaration: Syntax Modifications Added : Added : ::= ::= "[" "]" "[" "]" Added : Added : ::= ::= | "," | ","
11
Object Attribute References Implement “dot notation” for referring to attributes of objects. Implement “dot notation” for referring to attributes of objects. If an object attribute contains another object, the dots can be strung together. If an object attribute contains another object, the dots can be strung together.Example: patient.weight.units patient.weight.units
12
Object Attribute References: Dot Operator 9.12.xx Dot (binary) The dot (.) operator is used to select an attribute from an object, based on the name following the dot. It takes an expression and an identifier. The expression typically evaluates to a structure or a list of structures. Its usage is: :=. If the expression does not evaluate to an object, null is returned. If the expression evaluates to a list, normal Arden list handling is used and a list is returned.
13
Object Attribute References: Dot Operator (cont.) Dot Operator Example: NameType := object [FirstName, MiddleName, LastName]; /* Assume namelist contains a list of 3 NameType objects */ (“John”, “Paul”, “George”) := namelist.FirstName; (“Lennon”, “McCartney”, “Bush”) := namelist.LastName; “John” := namelist[1].FirstName; null := namelist[1].Height; (null, null, null) := namelist.Height;
14
Object Attribute References: Syntax Modifications Added “.” operator. This is at the same precedence level as the Element operator. ::= ::= | "[" "]" | "[" "]" | "." | "."
15
READ AS Statement READ AS is a structured READ. READ AS is a structured READ. Instead of returning a list of columns from a query, it returns a list of rows (objects). Instead of returning a list of columns from a query, it returns a list of rows (objects). The returned objects will match the type specified. The returned objects will match the type specified. := READ AS WHERE ; LET BE READ AS WHERE ;
16
READ AS Statement: Syntax Modifications In, added READ AS option: ::= ::= "READ" "READ" | "READ" “AS” | "READ" “AS” | "MLM" <term | "FUNCTION" <term | "MLM" "FROM" "INSTITUTION" | "MLM" "FROM" "INSTITUTION" | "EVENT" | "EVENT" | "OBJECT" | "OBJECT" | "MESSAGE" | "MESSAGE" | "DESTINATION" | "DESTINATION" | "ARGUMENT" | "ARGUMENT" | "ARGUMENT" | |
17
READ AS Example 1 Example: MedicationDose := object [Medication, Dose, Status]; med_doses := read as MedicationDose { select med, dosage, status from client where status != "inactive" }; { select med, dosage, status from client where status != "inactive" }; write med_doses; /* outputs something like the following */ [MedicationDose: Medication="Med1", Dose="Dose1", Status="Active"], [MedicationDose: Medication="Med2", Dose="Dose2", Status="Active"], [MedicationDose: Medication="Med3", Dose="Dose3", Status="Active"] write med_doses.Medication; /* outputs */ "Med1", "Med2", "Med3"
18
READ AS Example 2 Example: MedicationDose := object [Medication, Dose, Status]; med_doses := read as MedicationDose last ({ select med, dosage, status from client where status != "inactive" } where it occurred within the past 2 weeks); where it occurred within the past 2 weeks); write med_doses; /* outputs something like the following */ [MedicationDose: Medication="Med3", Dose="Dose3", Status="Active"]
19
Primary Time Attributes retain primary times, and expressions like: TIME OF Renal_function.BUN_level will work as expected. To be decided: Should objects have a primary time? To be decided: Should objects have a primary time?
20
Filtering Lists of Objects WHERE clause supports lists of objects. WHERE clause supports lists of objects. Attributes can be appended to "it" and "they" synonyms. Attributes can be appended to "it" and "they" synonyms. // List of objects returned Bp_r_arm := bp where it.site = "R Arm“; // Simple list returned Elevated_systolic := bp.systolic where it > 140;
21
Remaining Issues Object Time Object Time Object Value Object Value Assignment to attributes Assignment to attributes Assignment of objects (by value vs. by reference) Assignment of objects (by value vs. by reference) Behavior of other operators when passed objects. Most operators will only support attributes, and will treat an object as an unknown type. A few may need some appropriate behavior. Behavior of other operators when passed objects. Most operators will only support attributes, and will treat an object as an unknown type. A few may need some appropriate behavior.
22
Operator Modifications Aggregation operators such as LATEST, EARLIEST, MINIMUM, MAXIMUM can easily be applied to an attribute of a list of objects: Max := maximum of obj_list.attr1; However, Max now contains only the attribute value, not the object itself. We should probably specify how and when the object itself may be returned.
23
SORT We should specify a way to sort on any field. Sorted_list := sort data unsorted_list; Where could be any attribute, and the sorted list returned is a list of objects.
24
Object Time We may want to define a time for the object, so: TIME of obj is a reasonable expression. This allows LATEST and EARLIEST to work as expected, and helps make object use simpler in other places as well. Perhaps if all fields have the same time, this automatically becomes the object time, otherwise it is null.
25
Object Value In McKesson’s presentation, they suggested a default Value field, which would be used if no attribute was specified when objects were passed to Arden operators. I have some questions about this i.e. what if a list contains some objects and some non-objects. Does the value field of the objects get taken and the non- objects used directly? We need to think about this a bit.
26
Assignment of Attributes It is easy to implement assignment of attributes i.e. the left side of an assignment statement can use the dot notation. However, this comes back to the question of value/reference semantics which we brought up last meeting but has not been resolved.
27
Assignment of Attributes (cont.) Example: Assume x is an object with attribute a. y := x; x.a := 10; Question: Did y.a get modified? If we assume reference semantics of objects, then y.a also got modified. If we assume value semantics, then x.a and y.a are separate variables. I believe that reference semantics is more useful, powerful and convenient. It is used in most OO languages such as Java, C#, C++ (typically but not always since both are allowed), Common Lisp, VB.NET, Smalltalk, etc.
28
Creation of Objects It would be useful to be able to construct objects on the fly, rather than having to use lists to simulate them (as is typically done now). I have not proposed a syntax for object construction. The only way to obtain objects in this proposal is via the READ AS statement.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.