1 / 19

Model Transformations

Model Transformations. Colin Clark. Antranig Basman. Bridging between views. Users view the world in terms of their needs Solution developers view the world in terms of what they can provide We need a system for smoothly transferring information back and forth between these worlds.

hateya
Download Presentation

Model Transformations

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. Model Transformations Colin Clark Antranig Basman

  2. Bridging between views • Users view the world in terms of their needs • Solution developers view the world in terms of what they can provide • We need a system for smoothly transferring information back and forth between these worlds

  3. A Preferences Statement • { • "display": { • "screenEnhancement": { • "fontSize": 24, • "foregroundColor": "white", • "backgroundColor": "black", • "magnification": 2.0, • "tracking": "mouse", • "invertImages": true, • "showCrosshairs": true • } • } • } A JSON document – in this case following the Access4All Specification (ISO 24751)

  4. A Solution’s Settings (Linux) • “org.gnome.desktop.a11y.magnifier”: { • “mag-factor”: 2.0, • “mouse-tracking”: “centered”, • "showCrosshairs": true • }

  5. This Simple Case: • General format: • This is a simple example of a transformation document { "mag-factor“ : "display.screenEnhancement.magnification“ } "<output path>": "<input path>"

  6. Three important advantages Transformation documents make it — easier to figure out how to reverse the transformation easier to produce tools for authoring and visualisation easier to store, retrieve and parse in database technologies “lift” a transformation of documents into the corresponding transformation of schemata

  7. Inverting this document • Simply flip keys and values • Not this easy in general! { “display.screenEnhancement.magnification” : "mag-factor“ }

  8. Lenses in the Literature Aaron Bohannon, Jeffrey A. Vaughan, and Benjamin C. Pierce. Relational Lenses: A Language for Updateable Views. In Principles of Database Systems (PODS), 2006. Extended version available as University of Pennsylvania technical report MS-CIS-05-27. [ bib | tech report | .pdf ] Benjamin C. Pierce. Foundations for Bidirectional Programming, or: How To Build a Bidirectional Programming Language, June 2009. Keynote address at International Conference on Model Transformation (ICMT). [ bib | slides ]

  9. Lifting (all documents) Lens for Schemas Schema A Schema B Governs Governs LIFT! Lens for Documents Document B Document A

  10. The next class of issue User and solution don’t share the same value scale: • “$HKEY_CURRENT_USER\\Software\\Microsoft\\ScreenMagnifier”: { • “Magnification”: 200, [REG_DWORD INT] • “Invert”: 1 [REG_DWORD BOOL], • "FollowMouse": 1 [REG_DWORD BOOL] • } User uses a scale factor – solution uses a percentage

  11. Transformation Lenses • Data-oriented • Declarative and functional • Bi-directional • Useful collection of lenses out of the box • Can be extended with new transformers • AT integrators don’t have to write code

  12. A Transformer Function Is just a • gpii.transformer.scaleValue = function (value, expander, expandSpec) { • var factor = (expandSpec.factor === undefined ? 1.0 : expandSpec.factor); • return value * factor; • }; Implemented as a standard JavaScript function, with a global name and a particular signature: As well as the function, you need a little metadata to describe it to the system: fluid.defaults("gpii.transformer.scaleValue", { gradeNames: "fluid.standardTransformFunction" });

  13. Standard “function grades” fluid.function • Inheritance of documents, not types – unlike in C++, this diamond works : ) fluid.transformFunction fluid.standardInputTransformFunction fluid.standardOutputTransformFunction fluid.lens fluid.standardTransformFunction

  14. In context in a transformation record (Windows) • "capabilitiesTransformations": { • "Magnification": { • "expander": { • "type": "gpii.transformer.scaleValue", • "inputPath": "display.screenEnhancement.magnification", • "outputPath": "value", • "factor": 100 • }, • "dataType": { • "expander": { • "type": "fluid.model.transform.literalValue", • "value": "REG_DWORD" • } • } • }, • ...

  15. Transform (Linux) • "capabilitiesTransformations": { • "mag-factor": "display.screenEnhancement.magnification", • "show-cross-hairs": "display.screenEnhancement.showCrosshairs", • "mouse-tracking": { • "expander": { • "type": "fluid.model.transform.valueMapper", • "inputPath": "display.screenEnhancement.tracking", • "options": { • "mouse": { • "outputValue": "centered" • } • } • } • } • }

  16. Making choices – the ValueMapper • "mouse-tracking": { • "expander": { • "type": "fluid.model.transform.valueMapper", • "inputPath": "display.screenEnhancement.tracking", • "options": { • "mouse": { • "outputValue": "centered" • }, • “caret”: { • “outputValue”: “none” • } • } • } • }

  17. Dumping Values – The Literal Value Transform • "<output path>": { • "expander": { • "type": "fluid.model.transform.literalValue", • "inputPath": "This will literally be the output." • } • }

  18. Source Code • https://github.com/GPII/universal • The Model Transformation System • (Fluid Infusion github): • http://bit.ly/LaXMbJ • Preferences statement: http://bit.ly/LN4iEB • Settings Handler: http://bit.ly/M6mDfD • Solutions Registry: http://bit.ly/KrLo6Z

  19. Questions? Colin Clark e: cclark@ocad.ca t: @colinbdclark Antranig Basman e: amb26@ponder.org.uk fluidproject.org gpii.net

More Related