1 / 25

Constraint Animation Using an Object-Oriented Declarative Language

Constraint Animation Using an Object-Oriented Declarative Language. Jeff Gray and Stephen Schach Vanderbilt University {jgray, srs}@vuse.vanderbilt.edu ACM Southeast Conference 2000 April 7-8, 2000 Clemson, SC. Overview. Problem Motivation Specification Animation UML/OCL Prolog++

admon
Download Presentation

Constraint Animation Using an Object-Oriented Declarative Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Constraint Animation Using an Object-Oriented Declarative Language Jeff Gray and Stephen Schach Vanderbilt University {jgray, srs}@vuse.vanderbilt.edu ACM Southeast Conference 2000 April 7-8, 2000 Clemson, SC

  2. Overview • Problem Motivation • Specification Animation • UML/OCL • Prolog++ • Mapping UML/OCL to Prolog++ • Example • Using the Intelligence Server to construct a simple animation environment • Ideas for Improvement

  3. Problem Motivation • Fact: Our words are pregnant with meaning • Oxford English Dictionary • 500 words used most have an average of 23 meanings • “set” has 430 different meanings; 25 pgs. and 60k words • The Resulting Problem: Ambiguity • Humorous statements • Military disasters (Tennyson’s poem on Crimean War) • Large Software Requirements Specification • Other Problems: Inconsistency & Confusing Verbiage

  4. An Example “The Landing Pilot is the Non-Handling Pilot until the ‘decision altitude’ call, when the Handling Non-Landing Pilot hands the handling to the Non-Handling Landing Pilot, unless the latter calls ‘go around,’ in which case the Handling Non-Landing Pilot continues handling and the Non-Handling Landing Pilot continues non-handling until the next call of ‘land’ or ‘go around’ as appropriate. In view of recent confusions over these rules, it was deemed necessary to restate them clearly.” British Airways Memorandum, quoted in Pilot Magazine, December 1996.

  5. The “Humpty-Dumpty” Syndrome “When I use a word,” Humpty Dumpty said, in a rather scornful tone, “it means just what I choose it to mean - nothing more nor less.” “The question is,” said Alice, “whether you can make words mean so many different things.” Lewis Carroll Natural Language Problem

  6. Collection of Ambiguous or Inconsistent/Incomplete Statements “I will bring my bike tomorrow if it looks nice in the morning” “I found a smoldering cigarette left by a horse” • Check it out: http://www.vuse.vanderbilt.edu/~jgray/ambig.html

  7. Levels of Formalism • Categories of formalism: • Informal natural language • Semi-formal notations • Formal specification languages Informal Familiarity Semi-formal Formal Mathematical Rigor

  8. Levels of Formalism • Semi-formal specifications lack the formality for rigorous mathematical verification • Formal specifications are not customer friendly “This returns us to the underlying tension in the software process: that between the subjective and the objective, between the holistic mental view and the rigorous formal model. The first describes what is needed: the second ensures that what was requested is delivered.” Blum, Bruce, “A Taxonomy of Software Development Methods,” Communications of the ACM, vol. 37, no. 11, November 1994, pp. 8294.

  9. Graphical Notations • Petre, Marian, “Why Looking Isn’t Always Seeing: Readership Skills and Graphical Programming,” Communications of the ACM, June 1995, pp. 3344.

  10. UML/OCL • Enriching a UML diagram with OCL constraints can aid in improving the common understanding of the underlying model (natural language is not used to describe the effect of the constraint) • Several groups are working hard to rigorously define the UML semantics using formal languages (“The Precise UML Group”); several workshops exist • A rigorous semantics would permit a type of “executable specification” to be performed

  11. Specification Animation • Offers a type of throw-away prototype resulting from an executable specification • Can aid in making the underlying formalism transparent to end-user • Wide body of literature: • Debate between tradeoff of expressiveness with the speed of executability • Most efforts focus on animating Z • Declarative programming languages are often used to aid in the mapping from the specification(Prolog is the language used with most frequency)

  12. Prolog++ • Vendor: Logic Programming Associates • Combines the declarative power and inference engine of Prolog with the benefits of OOP • Supports: • structural organization of Prolog predicates in classes • single/group of messages can be sent to single/group of objects • data driven programming - allows daemons to be attached to crucial events (construction/destruction, value changes) • multiple inheritance and polymorphism • Drawback: Very primitive environment; costly

  13. Mapping UML/OCL to Prolog++ • UML class diagrams provide: • the corresponding class structure for the Prolog++ code • attributes/types and method names for Prolog++ code • aggregation/relations that must be Prolog++ parts • Many OCL collection operations have direct mappings to Prolog++ predicates (we get these free!) • OCL forall can often be mapped to Prolog++ all instance • OCL select -> all instance sucthat... • An important asset is a library of Prolog++ predicates that emulate standard OCL operations • e.g., oclIsTypeOf, oclType, oclIsKindOf, size

  14. Mapping UML/OCL to Prolog++ • oclIsTypeOf: • A reflective class attribute must be defined, e.g.: class attributes class_type = ‘outputPort’. • operator then defined in Prolog++ as: oclIsTypeOf(AType) :- self@class_type = AType. • size: • A class attribute called size_att must be defined for each class • Define a simple library function to increment size_att: size_func :- size_att += 1. • Generic size is then defined as: size(S) :- size_att := 0, (all instance class) <- size_func, S = @size_att.

  15. Connection src 0..* 0..* 0..* 0..* Port dst OutputPort InputPort Z_out : int 1 1 Z_in : int 1 1 IO_Device 1 1 1 1 Preamp PowerAmp Speaker Mic Example

  16. Example Constraint 1 • It is invalid to connect an input port to another input port, or an output port to another output port • In OCL, this can expressed as: Connection->forAll(c | c.src.oclIsTypeOf(OutputPort) and c.dst.oclIsTypeOf(InputPort)) • In Prolog++: inv_Connection :- (all instance class)<- (@src<-oclIsTypeOf('outputPort'), @dst<-oclIsTypeOf(‘inputPort’)).

  17. Example Constraint 2 • Microphones can only connect to preamps; preamp outputs can only connect to poweramps; poweramp outputs only to speakers • In OCL, this can expressed as (Microphone->Preamp): Mic->forAll(m | m.OutputPort.dst.oclIsTypeOf(PreAmp)) • In Prolog++: inv_Mic_Dst :- (all instance class)<-(outputPort@dst<- oclIsTypeOf(’preAmp')).

  18. Example Constraint 3 • At least one poweramp must exist in an audio system • In OCL, this can expressed as (Microphone->Preamp): PowerAmp.allInstances->size >= 1. • In Prolog++: inv_powerAmp_existence :- size(S), S >= 1.

  19. Intelligence Server Prolog++ Using the Intelligence Server Developers Customer Animation Environment Result Query

  20. Intelligence Server Win-Prolog Intelligence Server Front End Server.OVL Server.DLL PRO386W.EXE(runtime kernel) Server.PC User definedProlog code

  21. Intelligence Server • Six Interface Functions of Server.DLL: • LoadProlog • initialize/configure WinProlog • HaltProlog • shut down WinProlog • InitGoal • initialize a Prolog goal • CallGoal • call previous goal, return solution, backtrack • ExitGoal • exit a goal once solutions are no longer needed • TellGoal • send textual info back to a goal that requires input

  22. Intelligence Server Win-Prolog Intelligence Server Front End Server.OVL Server.DLL PRO386W.EXE(runtime kernel) Server.PC User definedProlog code Animation Environment Translated OCL

  23. Simple Animation Environment

  24. Other Related Applications

  25. Ideas for Improvement • Current work is very primitive - core functions of an animator are still needed • Automated Mapping to Prolog++ • Retrieve model from Rose (using COM) • Build on current OCL parsers • Incorporate Interaction (Sequence) Diagrams • an existing sequence diagram can be used as an example script to drive an animation session • the interactions among objects in an animation session could be captured to construct a sequence diagram • Support for pre/post-conditions

More Related