Namespace funnyqt.extensional

Specify models extensionally.

Other Namespaces

Show/Hide
funnyqt.bidi
Bidirectional transformations (BX).
funnyqt.coevo.tg
Co-Evolution transformations on TGraphs.
funnyqt.edn
Printing/persisting and reading/loading query results and transformation traces as EDN.
funnyqt.emf
Core functions for accessing and manipulating EMF models.
funnyqt.generic
Generic protocols extended upon many different types, and generic functions.
funnyqt.in-place
In-place transformation stuff.
funnyqt.model2model
Rule-base out-place transformations similar to ATL or QVTo.
funnyqt.pmatch
Graph Pattern Matching on arbitrary models.
funnyqt.polyfns
Polymorphic functions dispatching on types of model elements.
funnyqt.query
Generic query functions like regular path expressions & quantified expressions.
funnyqt.query.emf
EMF-specific query functions
funnyqt.query.tg
TG-specific query functions
funnyqt.relational
Relational Model Querying.
funnyqt.tg
Core functions for accessing and manipulating TGraphs.
funnyqt.utils
Generic utility functions, e.g., for signaling errors, debugging, and profiling,
funnyqt.visualization
Model visualization functions.
funnyqt.xmltg
Convert XML to DOM-like TGraphs.
Index Page
Alphabetic Var Index

Public Vars

Usage Documentation

Show/Hide
Specify models extensionally.
Back to top

Details of Public Vars

Dynamic Var: *arch*

  A map of the form {TargetMetaClass {TargetInstance Archetype}}.
  The inner maps from images to archetypes only contain the concrete
  TargetMetaclass instances, not subclass instances.  So a lookup has to
  consider the class hierarchy.

  Don't use this map directly but use the general resolving functions

    - `funnyqt.extensional/image`
    - `funnyqt.extensional/archetype`
Back to top View Source

Dynamic Var: *img*

  A map of the form {TargetMetaClass {Archetype TargetInstance}}.
  The inner maps from archetypes to images only contain the concrete
  TargetMetaclass instances, not subclass instances.  So a lookup has to
  consider the class hierarchy.

  Don't use that directly but use the special resolving functions

    - `funnyqt.extensional/element-image`
    - `funnyqt.extensional/element-archetype`
    - `funnyqt.extensional/source-image`
    - `funnyqt.extensional/source-archetype`
    - `funnyqt.extensional/target-image`
    - `funnyqt.extensional/target-images`

  or the general resolving functions

    - `funnyqt.extensional/image`
    - `funnyqt.extensional/archetype`
Back to top View Source

Dynamic Var: *omit-trace-recording*

  If true, recording of traceability mappings is omitted.  Don't
  this directly but use the `without-trace-recording` macro.
Back to top View Source

Function: add-adjs!

Arglists:
=========

  (add-adjs! m cls ref reffn)

Docstring:
==========

  In model `m`, adds to the multi-valued `ref` reference of `cls` elements
  according to `reffn`.

  `reffn` must be a function of zero args and has to return either a map {elem
  refed...}, a collection of tuples ([elem refed]...), or a function of one
  argument which is applied to every instance of the class declaring the
  reference and has to return the refed value to be set for the reference of
  that instance.  In all three cases, refed must be a collection of referenced
  elements.

  In `reffn`, `funnyqt.extensional/element-image` is bound to a function that
  given an archetype of the metamodel class defining the `ref` (i.e., `cls`)
  returns its image, that is, the instance of the defining class (or subclass)
  that has been created for the given archetype.  The reverse lookup function
  `funnyqt.extensional/element-archetype` is bound, too.  Likewise,
  `funnyqt.extensional/target-image` is bound to a resolving function for
  `ref`s target metamodel class, and `funnyqt.extensional/target-images` is
  bound to a function that resolves all archetypes in a collection according to
  `ref`s target metamodel class.

  In certain modeling environments, setting adjacencies implies the creation of
  explicit relationships (e.g., in JGraLab).  When using this function, no
  trace mappings are created for those.
Back to top View Source

Function: archetype

Arglists:
=========

  (archetype cls img)
  (archetype m cls img)

Docstring:
==========

  Returns the archetype of `img` for element or relationship class `cls`.
  If there is no archetype, returns nil.  `cls` may either by a metamodel class
  or a symbol denoting the name of the metamodel class.  In the latter case, a
  model `m` is required to resolve the metamodel class.
Back to top View Source

Function: archetype-map

Arglists:
=========

  (archetype-map cls)
  (archetype-map m cls)

Docstring:
==========

  Returns a map of archetype traceability mappings of element or relationship
  class `cls` and its subclasses.
Back to top View Source

Function: create-elements!

Arglists:
=========

  (create-elements! m cls archfn)

Docstring:
==========

  In model `m` creates one element of metamodel class `cls` for every
  archetype returned by `archfn`.  `archfn` must return a collection of
  arbitrary objects.  It's value is taken as a set.  Traceability mappings are
  established implicitly in `funnyqt.extensional/*img*` and
  `funnyqt.extensional/*arch*`.  Returns the sequence of new elements.
Back to top View Source

Function: create-relationships!

Arglists:
=========

  (create-relationships! m cls archfn)

Docstring:
==========

  In model `m` creates one relationship of metamodel class `cls` for every
  archetype returned by `archfn`.  `cls` is a symbol denoting the qualified
  name of the relationship class.

  `archfn` must return a collection of triples [arch src trg].  arch is an
  arbitrary object taken as archetype for the new relationship, and src and trg
  are the new relationship's source and target element.  Traceability mappings
  are established implicitly in `funnyqt.extensional/*img*` and
  `funnyqt.extensional/*arch*`.

  In `archfn`, `funnyqt.extensional/source-image`,
  `funnyqt.extensional/source-archetype` and `funnyqt.extensional/target-image`
  are bound to functions that return the image of the given archetype in the
  image-mapping of the new edge's source/target element class.

  Returns the sequence of new relationships.
Back to top View Source

Dynamic Var: element-archetype

  Resolves the archetype of the given `image` in the archetype
  function corresponding to the metamodel class for which the current attribute
  or reference is declared.
Back to top View Source

Dynamic Var: element-image

  Resolves the image of the given `archetype` in the image function
  corresponding to the metamodel class for which the current attribute or
  reference is declared.
Back to top View Source

Macro: ensure-trace-mappings

Arglists:
=========

  (ensure-trace-mappings & body)

Docstring:
==========

  Executes `body` with the current trace mappings in place, i.e., the current
  ones are altered by `body`.  If there are no mappings in
  place, (ensure-trace-mappings body) is equivalent to (with-trace-mappings
  body).
Back to top View Source

Function: image

Arglists:
=========

  (image cls arch)
  (image m cls arch)

Docstring:
==========

  Returns the image of `arch` for element or relationship class `cls`.
  If there is no image, returns nil.  `cls` may either by a metamodel class or
  a symbol denoting the name of the metamodel class.  In the latter case, a
  model `m` is required to resolve the metamodel class.
Back to top View Source

Function: image-map

Arglists:
=========

  (image-map cls)
  (image-map m cls)

Docstring:
==========

  Returns a map of image traceability mappings of element or relationship
  class `cls` and its subclasses.
Back to top View Source

Function: set-adjs!

Arglists:
=========

  (set-adjs! m cls ref reffn)

Docstring:
==========

  In model `m`, sets the `ref` reference of `cls` elements according to
  `reffn`.

  `reffn` must be a function of zero args and has to return either a map {elem
  refed...}, a collection of tuples ([elem refed]...), or a function of one
  argument which is applied to every instance of the class declaring the
  reference and has to return the refed value to be set for the reference of
  that instance.  In all three cases, refed must be a collection of referenced
  elements.

  In `reffn`, `funnyqt.extensional/element-image` is bound to a function that
  given an archetype of the metamodel class defining the `ref` (i.e., `cls`)
  returns its image, that is, the instance of the defining class (or subclass)
  that has been created for the given archetype.  The reverse lookup function
  `funnyqt.extensional/element-archetype` is bound, too.  Likewise,
  `funnyqt.extensional/target-image` is bound to a resolving function for
  `ref`s target metamodel class, and `funnyqt.extensional/target-images` is
  bound to a function that resolves all archetypes in a collection according to
  `ref`s target metamodel class.

  In certain modeling environments, setting adjacencies implies the creation of
  explicit relationships (e.g., in JGraLab).  When using this function, no
  trace mappings are created for those.
Back to top View Source

Function: set-avals!

Arglists:
=========

  (set-avals! m cls attr valfn)

Docstring:
==========

  In model `m` sets the `attr` values for all `cls` elements according to
  `valfn`.  `valfn` is a function of zero arguments which has to return either
  a map {elem attr-value...}, a collection of pairs [elem attr-value], or a
  function of one argument which is applied to every instance of the class
  declaring the attribute and has to return the value to be set for the
  attribute of that instance.

  In `valfn`, `funnyqt.extensional/element-image` is bound to a function that
  given an archetype of the class defining `attr` (i.e., `cls`) returns its
  image, that is, the instance of the defining class (or subclass) that has
  been created for the given archetype.  Likewise, the reverse function
  `funnyqt.extensional/element-archetype` is also bound.
Back to top View Source

Dynamic Var: source-archetype

  Resolves the archetype of the given `image` in the archetype
  function corresponding to the source element class of the current
  relationship class.
Back to top View Source

Dynamic Var: source-image

  Resolves the image of the given `archetype` in the img function
  corresponding to the source element class of the current relationship class.
Back to top View Source

Dynamic Var: target-image

  Resolves the image of the given `archetype` in the img function
  corresponding to the target element class of the current relationship class
  or reference.
Back to top View Source

Dynamic Var: target-images

  Returns the images of the given collection of `archetypes` in the
  image function of the current reference's target class.
Back to top View Source

Macro: with-trace-mappings

Arglists:
=========

  (with-trace-mappings & body)

Docstring:
==========

  Establishes new, empty traceability maps (`*arch*` and `*img*`), executes
  `body`, and then re-establishes the previous traceability maps.
Back to top View Source

Macro: without-trace-recording

Arglists:
=========

  (without-trace-recording & body)

Docstring:
==========

  Executes `body` without recording traceability mappings, then re-establishes
  the previous traceability maps.
Back to top View Source