SlideShare a Scribd company logo
BACKGROUND                            XMF                         XM ODELER




                    XMF and XModeler

                               Tony Clark1

             1 School   of Engineering and Information Sciences
                            University of Middlesex


                             August 6, 2011
BACKGROUND                       XMF   XM ODELER




                             Outline
     Background
        History
        Technologies

     XMF
       Executable (Meta-)Modelling
       Language Engineering
       Code Templates
       Daemons

     XModeler
       Tool Models
       A Snapshot Tool
       Conclusion
BACKGROUND                             XMF                        XM ODELER




                              OMG, UML 2.0


        • Around 1999 Clark, Evans, Kent started attending OMG.
        • UML 2.0 started around this time.
        • The 2U Submission: UML as family of languages:
            • Templates.
            • Package Extension.
        • Tools and methods emerged for model-based language
             engineering:
               • Language Architectures.
               • Denotational Semantics.
               • Operational Semantics.
BACKGROUND                          XMF               XM ODELER




                   Modelling and Programming



        • Aim: to merge modelling and programming.
        • Tools: MMT, XMT, XMF.
        • Programming language based on FP and OCL.
        • Important features: meta-; reflection; OO.
        • Tools for Language Engineering.
BACKGROUND                          XMF                    XM ODELER




                                Xactium




        • Clark, Evans set up in 2003.
        • Developed XModeler (XMF-Mosaic) on top of XMF.
        • 2003-2008.
        • Clients: BAES; BT; Citi-Group; Artisan; BSkyB.
BACKGROUND                           XMF                             XM ODELER




                                  XMF
        • Meta-Circular Language (like MOF and ECore).
        • XCore Based on ObjvLisp.
        • File based or world-state.
        • Features for:
             • Packages of models/programs.
             • Higher-order operations.
             • OCL.
             • Meta-Object Prototcol (MOP).
             • Language Engineering (grammars, syntax processing).
             • Daemons (object listeners).
             • Pattern matching.
             • Code generation templates.
             • Threads.
             • XML processing (parsing).
             • Java integration.
BACKGROUND                              XMF                          XM ODELER




                                  XModeler

        • Eclipse RCP Tool.
        • Layered on (and written in) XMF.
        • MVC Architecture.
        • File interface for building XMF applications.
        • Functional interface e.g. deploy XML, check constraints.
        • Clients are all extensible:
                Client:   XMF Command Listener.
                Client:   Browsing all data.
                Client:   Editing all data.
                Client:   Diagrams: class; snapshot.
                Client:   Text editing, HTML browsing.
BACKGROUND        XMF        XM ODELER




             Meta-language
BACKGROUND                      XMF                XM ODELER




                             Models
     parserImport XOCL;

     context Root
       @Package BasicLibrary
         @Class Library
           @Attribute books   : Set(Book)    end
           @Attribute readers : Set(Reader) end
           @Attribute borrows : Set(Borrows) end
         end
         @Class Book
           @Attribute title : String end
         end
         @Class Reader
           @Attribute name : String end
         end
         @Class Borrows
           @Attribute reader : Reader end
           @Attribute book : Book end
         end
       end
BACKGROUND      XMF      XM ODELER




             Behaviour
BACKGROUND                                    XMF     XM ODELER




                                 Programs: XOCL

     parserImport XOCL;
     import BasicLibrary;

     context Book
       @Constructor(title) end

     context Library
       @Operation addBook(title:String)
         let b = Book(title)
         in self.books := books->including(b); b
         end
       end

     context Library
       @Operation findBook(title:String):Book
         let B = books->select(b | b.title = title)
         in if B->isEmpty
             then null
             else B->asSeq->head
             end
         end
       end
BACKGROUND                       XMF                      XM ODELER




                            Snapshots
     context Root
       @Operation test()
         let S = Snapshot("library",Seq{BasicLibrary})
         in S.add("l",Library());
             let l = S::l
             in S.add("b",l.addBook("War and Peace"));
                S.add("r",l.addReader("Fred"));
                S.add("b_x_r",l.addBorrows(S::r,S::b));
                S
             end
         end
       end
BACKGROUND                      XMF                          XM ODELER




                    Defining Constraints (1)


     context Library
       @Constraint all_borrowed_books_belong_to_library
         borrows.book->forAll(b | books->includes(b))
         fail "can only borrow books in library"
       end

     context Library
       @Constraint all_borrowing_readers_belong_to_library
         borrows.reader->forAll(r | readers->includes(r))
         fail "only registered readers can borrow books"
       end
BACKGROUND                                    XMF                                        XM ODELER




                            Defining Constraints (2)


     context Library
       @Constraint cannot_borrow_same_book_twice
         borrows->forAll(b1 | borrows->forAll(b2 | b1 <> b2 implies b1.book <> b2.book))
         fail "cannot borrow the same book twice"
       end

     context Library
       @Constraint all_books_have_unique_titles
         books->forAll(b1 | books->forAll(b2 | b1 <> b2 implies b1.title <> b2.title))
         fail "books should have unique titles"
       end

     context Library
       @Constraint all_readers_have_unique_names
         readers->forAll(r1 | readers->forAll(r2 | r1 <> r2 implies r1.name <> r2.name))
         fail "readers should have unique names"
       end
BACKGROUND                      XMF                        XM ODELER




                     Checking Constraints
     context Root
       @Operation test_illegal()
         let S = Snapshot("library",Seq{BasicLibrary});
               b = Book("War and Peace")
         in S.add("l",Library());
             S.add("r",(S::l).addReader("Fred"));
             S.add("b_x_r",(S::l).addBorrows(S::r,b));
             S
         end
       end

     [1] XMF> test_illegal().checkConstraints().failures();
     Seq{ConstraintReport(<Library d9ff5f>,
          <Constraint all_borrowed_books_belong_to_library>,
          false, can only borrow books in library)}
     [1] XMF>
BACKGROUND         XMF        XM ODELER




             Syntax Classes
BACKGROUND                                                  XMF                                                   XM ODELER




                                               Quasi-Quotes
     context Root
       @Operation add1_exp(exp:Performable):Performable
         [| 1 + <exp> |]
       end

     context Root
       @Operation seq_exp(exps:Seq(Performable)):Performable
         exps->iterate(e x = [| Seq{} |] |
           [| <x>->including(<e>) |])
       end

     [ 1 ] XMF> add1_exp ( [ | x + y | ] ) ;
     BinExp ( IntExp ( 1 ) , + , BinExp ( Var ( x ) , + , Var ( y ) ) )
     [ 1 ] XMF> seq_exp ( Seq { [ | 1 | ] , [ | x | ] , t r u e . l i f t ( ) } ) ;
     CollExp ( CollExp ( CollExp ( SetExp ( Seq , Seq { } ) , including , Seq{ IntExp ( 1 ) } ) , including , Seq{ Var
             ( x ) } ) , including , Seq{ BoolExp ( t r u e ) } )
     [ 1 ] XMF> seq_exp ( Seq { [ | 1 | ] , [ | x | ] , t r u e . l i f t ( ) } ) . p p r i n t ( ) ;
     Seq{}−> including ( 1 )−>including ( x )−>including ( t r u e )
     [ 1 ] XMF>
BACKGROUND                                                        XMF       XM ODELER




                                                       Grammars
     parserImport Parser::BNF;
     parserImport XOCL;

     Root::g :=
       @Grammar
         Start ::= i=Int o=Op j=Int {
            @Case o of
              "+" do i + j end
              "*" do i * j end
            end
         }.
         Op ::= ’+’ { "+" } | ’*’ { "*" }.
       end;

     [ 1 ] XMF> g . parseString ( " 1 + 2 " , " S t a r t " , Seq { } ) ;
     3
     [ 1 ] XMF>
BACKGROUND                                     XMF       XM ODELER




                Embedded Language Features (Usage)
     context Library
       @Subset all_borrowed_books_belong_to_library
         borrows.book books
       end

     context Library
       @Subset all_borrowing_readers_belong_to_library
         borrows.reader readers
       end

     context Library
       @Unique cannot_borrow_same_book_twice
         borrows book
       end

     context Library
       @Unique all_books_have_unique_titles
         books title
       end

     context Library
       @Unique all_readers_have_unique_names
         readers name
       end
BACKGROUND                       XMF                        XM ODELER




             Embedded Language Features (Def 1)

     parserImport XOCL;
     parserImport Parser::BNF;

     context Root
      @Class Unique
       @Grammar
        Unique ::= name=Name collection=Name field=Name {
          [| @Constraint unique self.<collection>->forAll(x |
               self.<collection>->forAll (y |
                 x <> y implies x.<field> <> y.<field>))
             end.name := "UNIQUE:" + <name.lift()> |]
        }.
       end
      end
BACKGROUND                       XMF                           XM ODELER




             Embedded Language Features (Def 2)
     parserImport XOCL;
     parserImport Parser::BNF;
     import OCL;

     context Root
       @Class Subset
         @Grammar
           Subset ::= name=Name sub=Path super=Path {
              [| @Constraint contained <sub>->forAll(x |
                   <super>->includes(x))
                 end.name := "CONTAINED:" + <name.lift()> |]
           }.
           Path ::= root=Name fields=(’.’ Name)* {
              fields->iterate(field exp = Var(root) |
                [| <exp>.<field> |])
           }.
         end
       end
BACKGROUND                       XMF                          XM ODELER




                        Generating Code

     context Library
       @Operation borrowsTable()
         let sout = StringOutputChannel()
         in @HTML(sout,0)
               <TABLE border=1>
                 { @Loop borrow in borrows do
                     [ <TR>
                          <TD> { borrow.reader.name } </TD>
                          <TD> { borrow.book.title } </TD>
                        </TR> ]
                    e_nd }
               </TABLE>
             end;
             sout.getString()
         end
       end
BACKGROUND            XMF           XM ODELER




             Tooling Requirements
BACKGROUND                        XMF    XM ODELER




                        Adding Daemons




     o.addDaemon(
       @Operation(slot,new,old)
         ... something to do...
       end)
BACKGROUND     XMF     XM ODELER




             Clients
BACKGROUND    XMF   XM ODELER




             HTML
BACKGROUND                            XMF             XM ODELER




                           Tool Requirements



        • Take any snapshot.
        • Interactively construct class instances.
        • Interactively edit class instances.
        • Check constraints after each modification.
        • Generate Java code for the snapshot.
BACKGROUND       XMF       XM ODELER




             Tool Models
BACKGROUND       XMF     XM ODELER




             MVC Model
BACKGROUND    XMF   XM ODELER




             Demo
BACKGROUND                         XMF                        XM ODELER




               Availability, Documentation, Research
             http://www.eis.mdx.ac.uk/staffpages/tonyclark/




                                  XPL

More Related Content

PPTX
Introduction to Haskell: 2011-04-13
PPTX
A brief tour of modern Java
PPTX
A Brief Intro to Scala
PDF
C# for beginners
PDF
Pragmatic Real-World Scala (short version)
PDF
Scala eXchange opening
PPT
Scala Talk at FOSDEM 2009
PPT
Java user group 2015 02-09-java8
Introduction to Haskell: 2011-04-13
A brief tour of modern Java
A Brief Intro to Scala
C# for beginners
Pragmatic Real-World Scala (short version)
Scala eXchange opening
Scala Talk at FOSDEM 2009
Java user group 2015 02-09-java8

What's hot (17)

PDF
Introduction to Groovy (Serbian Developer Conference 2013)
PDF
Scala: A brief tutorial
PDF
scalaliftoff2009.pdf
PDF
camel-scala.pdf
PDF
Solr Query Parsing
PPTX
ECMAScript 2015
PPTX
The Evolution of Scala
PPT
Oscon keynote: Working hard to keep it simple
PPTX
Compilers Are Databases
PPTX
Java class 6
PPTX
PPTX
Java class 3
PDF
The Evolution of Scala / Scala進化論
PDF
Functional Programming In Practice
PPTX
Java class 4
PPTX
Lecture 13, 14 & 15 c# cmd let programming and scripting
PDF
Quick introduction to scala
Introduction to Groovy (Serbian Developer Conference 2013)
Scala: A brief tutorial
scalaliftoff2009.pdf
camel-scala.pdf
Solr Query Parsing
ECMAScript 2015
The Evolution of Scala
Oscon keynote: Working hard to keep it simple
Compilers Are Databases
Java class 6
Java class 3
The Evolution of Scala / Scala進化論
Functional Programming In Practice
Java class 4
Lecture 13, 14 & 15 c# cmd let programming and scripting
Quick introduction to scala
Ad

Viewers also liked (9)

PDF
Dsl overview
PDF
Patterns 200711
PPT
Filmstrip testing
PDF
Dsl tutorial
PDF
Hcse pres
PPTX
Ast 09
PPTX
Leap isec 2011
PPTX
Kiss at oopsla 09
PDF
Context-Aware Content-Centric Collaborative Workflow Management for Mobile De...
Dsl overview
Patterns 200711
Filmstrip testing
Dsl tutorial
Hcse pres
Ast 09
Leap isec 2011
Kiss at oopsla 09
Context-Aware Content-Centric Collaborative Workflow Management for Mobile De...
Ad

Similar to Kings 120711 (20)

PDF
Erlang Message Passing Concurrency, For The Win
ODP
Getting started with Clojure
PDF
Introduction to libre « fulltext » technology
PDF
Clojure intro
PDF
Лев Валкин — Программируем функционально
PDF
Diving into Functional Programming
PDF
Clojure talk at Münster JUG
PPTX
Tools for reading papers
PDF
Elixir
PPTX
Intro to Open Babel
PDF
XSLT 3 for EPUB and Print - Liam R.E. Quin (Barefoot Computing) - ebookcraft ...
PPTX
Metaprogramming in julia
PDF
Making Your Own Domain Specific Language
PDF
Elixir introd
PDF
Logic Programming and ILP
PPT
Programming in Computational Biology
PDF
A Generic Mapping-based Query Translation from SPARQL to Various Target Datab...
PPTX
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
PDF
DML Syntax and Invocation process
PDF
S1 DML Syntax and Invocation
Erlang Message Passing Concurrency, For The Win
Getting started with Clojure
Introduction to libre « fulltext » technology
Clojure intro
Лев Валкин — Программируем функционально
Diving into Functional Programming
Clojure talk at Münster JUG
Tools for reading papers
Elixir
Intro to Open Babel
XSLT 3 for EPUB and Print - Liam R.E. Quin (Barefoot Computing) - ebookcraft ...
Metaprogramming in julia
Making Your Own Domain Specific Language
Elixir introd
Logic Programming and ILP
Programming in Computational Biology
A Generic Mapping-based Query Translation from SPARQL to Various Target Datab...
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
DML Syntax and Invocation process
S1 DML Syntax and Invocation

More from ClarkTony (19)

PDF
The Uncertain Enterprise
PDF
Actors for Behavioural Simulation
PDF
LEAP A Language for Architecture Design, Simulation and Analysis
PDF
A Common Basis for Modelling Service-Oriented and Event-Driven Architecture
PDF
Context Aware Reactive Applications
PDF
Model Slicing
PDF
Iswim for testing
PPT
Iswim for testing
PPTX
Mcms and ids sig
PPTX
Ocl 09
PPTX
Scam 08
PPTX
Reverse engineering and theory building v3
PDF
Onward presentation.en
PPTX
Formalizing homogeneous language embeddings
PPTX
Dsm as theory building
PDF
Code gen 09 kiss results
PPTX
Cg 2011
PPT
Iswim for testing
PPT
UML01
The Uncertain Enterprise
Actors for Behavioural Simulation
LEAP A Language for Architecture Design, Simulation and Analysis
A Common Basis for Modelling Service-Oriented and Event-Driven Architecture
Context Aware Reactive Applications
Model Slicing
Iswim for testing
Iswim for testing
Mcms and ids sig
Ocl 09
Scam 08
Reverse engineering and theory building v3
Onward presentation.en
Formalizing homogeneous language embeddings
Dsm as theory building
Code gen 09 kiss results
Cg 2011
Iswim for testing
UML01

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Empathic Computing: Creating Shared Understanding
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Approach and Philosophy of On baking technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPT
Teaching material agriculture food technology
PPTX
Cloud computing and distributed systems.
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The AUB Centre for AI in Media Proposal.docx
Unlocking AI with Model Context Protocol (MCP)
Empathic Computing: Creating Shared Understanding
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation_ Review paper, used for researhc scholars
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Approach and Philosophy of On baking technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Dropbox Q2 2025 Financial Results & Investor Presentation
Agricultural_Statistics_at_a_Glance_2022_0.pdf
cuic standard and advanced reporting.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Encapsulation theory and applications.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Building Integrated photovoltaic BIPV_UPV.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Teaching material agriculture food technology
Cloud computing and distributed systems.
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Kings 120711

  • 1. BACKGROUND XMF XM ODELER XMF and XModeler Tony Clark1 1 School of Engineering and Information Sciences University of Middlesex August 6, 2011
  • 2. BACKGROUND XMF XM ODELER Outline Background History Technologies XMF Executable (Meta-)Modelling Language Engineering Code Templates Daemons XModeler Tool Models A Snapshot Tool Conclusion
  • 3. BACKGROUND XMF XM ODELER OMG, UML 2.0 • Around 1999 Clark, Evans, Kent started attending OMG. • UML 2.0 started around this time. • The 2U Submission: UML as family of languages: • Templates. • Package Extension. • Tools and methods emerged for model-based language engineering: • Language Architectures. • Denotational Semantics. • Operational Semantics.
  • 4. BACKGROUND XMF XM ODELER Modelling and Programming • Aim: to merge modelling and programming. • Tools: MMT, XMT, XMF. • Programming language based on FP and OCL. • Important features: meta-; reflection; OO. • Tools for Language Engineering.
  • 5. BACKGROUND XMF XM ODELER Xactium • Clark, Evans set up in 2003. • Developed XModeler (XMF-Mosaic) on top of XMF. • 2003-2008. • Clients: BAES; BT; Citi-Group; Artisan; BSkyB.
  • 6. BACKGROUND XMF XM ODELER XMF • Meta-Circular Language (like MOF and ECore). • XCore Based on ObjvLisp. • File based or world-state. • Features for: • Packages of models/programs. • Higher-order operations. • OCL. • Meta-Object Prototcol (MOP). • Language Engineering (grammars, syntax processing). • Daemons (object listeners). • Pattern matching. • Code generation templates. • Threads. • XML processing (parsing). • Java integration.
  • 7. BACKGROUND XMF XM ODELER XModeler • Eclipse RCP Tool. • Layered on (and written in) XMF. • MVC Architecture. • File interface for building XMF applications. • Functional interface e.g. deploy XML, check constraints. • Clients are all extensible: Client: XMF Command Listener. Client: Browsing all data. Client: Editing all data. Client: Diagrams: class; snapshot. Client: Text editing, HTML browsing.
  • 8. BACKGROUND XMF XM ODELER Meta-language
  • 9. BACKGROUND XMF XM ODELER Models parserImport XOCL; context Root @Package BasicLibrary @Class Library @Attribute books : Set(Book) end @Attribute readers : Set(Reader) end @Attribute borrows : Set(Borrows) end end @Class Book @Attribute title : String end end @Class Reader @Attribute name : String end end @Class Borrows @Attribute reader : Reader end @Attribute book : Book end end end
  • 10. BACKGROUND XMF XM ODELER Behaviour
  • 11. BACKGROUND XMF XM ODELER Programs: XOCL parserImport XOCL; import BasicLibrary; context Book @Constructor(title) end context Library @Operation addBook(title:String) let b = Book(title) in self.books := books->including(b); b end end context Library @Operation findBook(title:String):Book let B = books->select(b | b.title = title) in if B->isEmpty then null else B->asSeq->head end end end
  • 12. BACKGROUND XMF XM ODELER Snapshots context Root @Operation test() let S = Snapshot("library",Seq{BasicLibrary}) in S.add("l",Library()); let l = S::l in S.add("b",l.addBook("War and Peace")); S.add("r",l.addReader("Fred")); S.add("b_x_r",l.addBorrows(S::r,S::b)); S end end end
  • 13. BACKGROUND XMF XM ODELER Defining Constraints (1) context Library @Constraint all_borrowed_books_belong_to_library borrows.book->forAll(b | books->includes(b)) fail "can only borrow books in library" end context Library @Constraint all_borrowing_readers_belong_to_library borrows.reader->forAll(r | readers->includes(r)) fail "only registered readers can borrow books" end
  • 14. BACKGROUND XMF XM ODELER Defining Constraints (2) context Library @Constraint cannot_borrow_same_book_twice borrows->forAll(b1 | borrows->forAll(b2 | b1 <> b2 implies b1.book <> b2.book)) fail "cannot borrow the same book twice" end context Library @Constraint all_books_have_unique_titles books->forAll(b1 | books->forAll(b2 | b1 <> b2 implies b1.title <> b2.title)) fail "books should have unique titles" end context Library @Constraint all_readers_have_unique_names readers->forAll(r1 | readers->forAll(r2 | r1 <> r2 implies r1.name <> r2.name)) fail "readers should have unique names" end
  • 15. BACKGROUND XMF XM ODELER Checking Constraints context Root @Operation test_illegal() let S = Snapshot("library",Seq{BasicLibrary}); b = Book("War and Peace") in S.add("l",Library()); S.add("r",(S::l).addReader("Fred")); S.add("b_x_r",(S::l).addBorrows(S::r,b)); S end end [1] XMF> test_illegal().checkConstraints().failures(); Seq{ConstraintReport(<Library d9ff5f>, <Constraint all_borrowed_books_belong_to_library>, false, can only borrow books in library)} [1] XMF>
  • 16. BACKGROUND XMF XM ODELER Syntax Classes
  • 17. BACKGROUND XMF XM ODELER Quasi-Quotes context Root @Operation add1_exp(exp:Performable):Performable [| 1 + <exp> |] end context Root @Operation seq_exp(exps:Seq(Performable)):Performable exps->iterate(e x = [| Seq{} |] | [| <x>->including(<e>) |]) end [ 1 ] XMF> add1_exp ( [ | x + y | ] ) ; BinExp ( IntExp ( 1 ) , + , BinExp ( Var ( x ) , + , Var ( y ) ) ) [ 1 ] XMF> seq_exp ( Seq { [ | 1 | ] , [ | x | ] , t r u e . l i f t ( ) } ) ; CollExp ( CollExp ( CollExp ( SetExp ( Seq , Seq { } ) , including , Seq{ IntExp ( 1 ) } ) , including , Seq{ Var ( x ) } ) , including , Seq{ BoolExp ( t r u e ) } ) [ 1 ] XMF> seq_exp ( Seq { [ | 1 | ] , [ | x | ] , t r u e . l i f t ( ) } ) . p p r i n t ( ) ; Seq{}−> including ( 1 )−>including ( x )−>including ( t r u e ) [ 1 ] XMF>
  • 18. BACKGROUND XMF XM ODELER Grammars parserImport Parser::BNF; parserImport XOCL; Root::g := @Grammar Start ::= i=Int o=Op j=Int { @Case o of "+" do i + j end "*" do i * j end end }. Op ::= ’+’ { "+" } | ’*’ { "*" }. end; [ 1 ] XMF> g . parseString ( " 1 + 2 " , " S t a r t " , Seq { } ) ; 3 [ 1 ] XMF>
  • 19. BACKGROUND XMF XM ODELER Embedded Language Features (Usage) context Library @Subset all_borrowed_books_belong_to_library borrows.book books end context Library @Subset all_borrowing_readers_belong_to_library borrows.reader readers end context Library @Unique cannot_borrow_same_book_twice borrows book end context Library @Unique all_books_have_unique_titles books title end context Library @Unique all_readers_have_unique_names readers name end
  • 20. BACKGROUND XMF XM ODELER Embedded Language Features (Def 1) parserImport XOCL; parserImport Parser::BNF; context Root @Class Unique @Grammar Unique ::= name=Name collection=Name field=Name { [| @Constraint unique self.<collection>->forAll(x | self.<collection>->forAll (y | x <> y implies x.<field> <> y.<field>)) end.name := "UNIQUE:" + <name.lift()> |] }. end end
  • 21. BACKGROUND XMF XM ODELER Embedded Language Features (Def 2) parserImport XOCL; parserImport Parser::BNF; import OCL; context Root @Class Subset @Grammar Subset ::= name=Name sub=Path super=Path { [| @Constraint contained <sub>->forAll(x | <super>->includes(x)) end.name := "CONTAINED:" + <name.lift()> |] }. Path ::= root=Name fields=(’.’ Name)* { fields->iterate(field exp = Var(root) | [| <exp>.<field> |]) }. end end
  • 22. BACKGROUND XMF XM ODELER Generating Code context Library @Operation borrowsTable() let sout = StringOutputChannel() in @HTML(sout,0) <TABLE border=1> { @Loop borrow in borrows do [ <TR> <TD> { borrow.reader.name } </TD> <TD> { borrow.book.title } </TD> </TR> ] e_nd } </TABLE> end; sout.getString() end end
  • 23. BACKGROUND XMF XM ODELER Tooling Requirements
  • 24. BACKGROUND XMF XM ODELER Adding Daemons o.addDaemon( @Operation(slot,new,old) ... something to do... end)
  • 25. BACKGROUND XMF XM ODELER Clients
  • 26. BACKGROUND XMF XM ODELER HTML
  • 27. BACKGROUND XMF XM ODELER Tool Requirements • Take any snapshot. • Interactively construct class instances. • Interactively edit class instances. • Check constraints after each modification. • Generate Java code for the snapshot.
  • 28. BACKGROUND XMF XM ODELER Tool Models
  • 29. BACKGROUND XMF XM ODELER MVC Model
  • 30. BACKGROUND XMF XM ODELER Demo
  • 31. BACKGROUND XMF XM ODELER Availability, Documentation, Research http://www.eis.mdx.ac.uk/staffpages/tonyclark/ XPL