Namespace funnyqt.generic

Generic protocols extended upon many different types, and generic functions.

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.extensional
Specify models extensionally.
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
Generic protocols extended upon many different types, and generic functions.
Back to top

Details of Public Vars

Protocol: IAttributeValueAccess

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

  A protocol for generically accessing attributes on some object.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EObject
  - interface de.uni_koblenz.jgralab.AttributedElement
  - interface de.uni_koblenz.jgralab.Record

Signatures:
===========

  (aval el attr)
  
    Returns the value of `el`s `attr` attribute.
    `attr` is the attribute name given as keyword.

  (set-aval! el attr val)
  
    Sets the value of `el`s `attr` attribute to `val`.
    `attr` is the attribute name given as keyword.

Back to top View Source

Protocol: IContainer

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EObject
  - interface de.uni_koblenz.jgralab.Vertex

Signatures:
===========

  (container this)
  (container this ts-or-role)
  
    Returns the container of this element.
    A container is an element that references `this` element by some link with
    containment semantics.  If `ts-or-role` is given, the container must me
    referenced with a link matching this type-spec or role name.

Back to top View Source

Protocol: IContents

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EObject
  - interface de.uni_koblenz.jgralab.Vertex

Signatures:
===========

  (contents this)
  (contents this ts-or-role)
  
    Returns the seq of `this` element's direct contents possibly restricted by
    the type-spec or role `ts-or-role`.

Back to top View Source

Protocol: ICopyModel

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.resource.Resource
  - interface de.uni_koblenz.jgralab.Graph

Signatures:
===========

  (copy-model this)
  
    Returns a copy of the given model and all its elements.

Back to top View Source

Protocol: ICreateElement

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.resource.Resource
  - interface de.uni_koblenz.jgralab.Graph

Signatures:
===========

  (create-element! model cls)
  (create-element! model cls prop-map)
  
    Creates a new element of type `cls` in `model`.
    Properties are set according to `prop-map`, a map from property name keywords
    to property values.

Back to top View Source

Protocol: ICreateRelationship

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

  No docs attached.

Extenders:
==========

  - interface de.uni_koblenz.jgralab.Graph

Signatures:
===========

  (create-relationship! model cls src-elem trg-elem)
  (create-relationship! model cls src-elem trg-elem attr-map)
  
    Creates a new relationship of type `cls` in `model` connecting `src-elem`
    to `trg-elem`.  The valid values for `cls` are framework specific.  For
    TGraphs it is a symbol denoting an EdgeClass name, for EMF it is a keyword
    denoting an EReference name.  The return value is also framework specific.
    For TGraphs it is an Edge, for EMF it is the tuple [src-elem trg-elem].
    `attr-map` is a map from attribute names (as keywords) to values to be set.
    Clearly, this is unsupported by frameworks without explicit relationships with
    attributes.

Back to top View Source

Protocol: IDelete

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

  A protocol for deleting elements.

Extenders:
==========

  - interface java.util.Collection
  - interface org.eclipse.emf.ecore.EObject
  - interface de.uni_koblenz.jgralab.Vertex
  - interface de.uni_koblenz.jgralab.Edge

Signatures:
===========

  (delete! this)
  (delete! this recursively)
  
    Deletes this element and returns it.  If `recursively` is true (default),
    delete also elements contained by `this`.  Of course, `recursively` has no
    meaning for edges.  Implementations are provided for Vertex, Edge, EObject,
    and collections thereof.

Back to top View Source

Protocol: IDescribe

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

  A protocol for elements supporting describe.

Extenders:
==========

  - interface de.uni_koblenz.jgralab.schema.BasicDomain
  - interface de.uni_koblenz.jgralab.schema.MapDomain
  - interface de.uni_koblenz.jgralab.schema.CollectionDomain
  - interface de.uni_koblenz.jgralab.schema.EdgeClass
  - interface de.uni_koblenz.jgralab.schema.GraphClass
  - interface de.uni_koblenz.jgralab.Edge
  - interface de.uni_koblenz.jgralab.schema.EnumDomain
  - interface de.uni_koblenz.jgralab.schema.RecordDomain
  - interface de.uni_koblenz.jgralab.Graph
  - interface de.uni_koblenz.jgralab.schema.VertexClass
  - interface org.eclipse.emf.ecore.EObject
  - interface de.uni_koblenz.jgralab.Vertex
  - interface org.eclipse.emf.ecore.EClass

Signatures:
===========

  (describe this)
  
    Describes `this` attributed element or attributed element class.

Back to top View Source

Protocol: IElement

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

  No docs attached.

Extenders:
==========

  - class java.lang.Object
  - nil
  - interface org.eclipse.emf.ecore.EObject
  - interface de.uni_koblenz.jgralab.Vertex

Signatures:
===========

  (element? this)
  
    Returns true if `this` is an element.

Back to top View Source

Protocol: IElements

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.resource.Resource
  - interface org.eclipse.emf.ecore.resource.ResourceSet
  - interface de.uni_koblenz.jgralab.Graph

Signatures:
===========

  (elements model)
  (elements model type-spec)
  
    Returns the lazy sequence of elements in `model` restricted by `type-spec`.

Back to top View Source

Protocol: IEnumConstant

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EObject
  - interface org.eclipse.emf.ecore.resource.Resource
  - nil
  - interface de.uni_koblenz.jgralab.AttributedElement

Signatures:
===========

  (enum-constant m const)
  
    Returns the enumeration constant with the qualified name `const` in the
    metamodel of model `m`.
    In case of EMF, `m` is ignored.

Back to top View Source

Protocol: IEqualModels

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.resource.Resource
  - interface de.uni_koblenz.jgralab.Graph

Signatures:
===========

  (equal-models? m1 m2)
  (equal-models? m1 m2 link-order)
  
    Returns true only if model `m1` and model `m2` are structurally equal.
    If `link-order` is true, also consider the order of links (false by
    default).

Back to top View Source

Protocol: IIncidentRelationships

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

  No docs attached.

Extenders:
==========

  - interface de.uni_koblenz.jgralab.Vertex

Signatures:
===========

  (incident-relationships elem)
  (incident-relationships elem type-spec)
  (incident-relationships elem type-spec dir-spec)
  
    Returns the lazy seq of relationships incident to `elem`.
    May be restricted by the type specification `type-spec` and the direction
    specification `dir-spec` (:in, :out, or :inout).

Back to top View Source

Protocol: IInstanceOf

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

  A protocol for checking if an element is an instance of some meta-class.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EObject
  - interface de.uni_koblenz.jgralab.Graph
  - interface de.uni_koblenz.jgralab.Vertex
  - interface de.uni_koblenz.jgralab.Edge

Signatures:
===========

  (is-instance? object class)
  
    Returns true, iff `object` is an instance of `class`.

Back to top View Source

Protocol: IMMAbstract

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

  A protocol for checking if an element class is abstract.

Extenders:
==========

  - class java.lang.Class
  - interface org.eclipse.emf.ecore.EClass
  - interface de.uni_koblenz.jgralab.schema.GraphElementClass

Signatures:
===========

  (mm-abstract? this)
  
    Returns true, iff the element class is abstract.
    Implementations are provided for:
  
      - java.lang.Class: default impl in this namespace
      - de.uni_koblenz.jgralab.schema.GraphElementClass: funnyqt.tg
      - org.eclipse.emf.ecore.EClass: funnyqt.emf

Back to top View Source

Protocol: IMMAllSubclasses

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EClass
  - interface de.uni_koblenz.jgralab.schema.GraphElementClass

Signatures:
===========

  (mm-all-subclasses cls)
  
    Returns the sequence of all subclasses of `cls`.  Those are direct and
      indirect subclasses.

Back to top View Source

Protocol: IMMAttributes

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EClass
  - interface de.uni_koblenz.jgralab.schema.AttributedElementClass

Signatures:
===========

  (mm-attributes cls)
  
    Returns the sequence of attributes declared for class `cls`.
    Each attribute is represented as a keyword.

Back to top View Source

Protocol: IMMBooleanAttribute

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EClass
  - interface de.uni_koblenz.jgralab.schema.AttributedElementClass

Signatures:
===========

  (mm-boolean-attribute? cls attr)
  
    Returns true iff `attr` (given as keyword) is a boolean attribute of
    metamodel class `cls`.

Back to top View Source

Protocol: IMMClass

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

  No docs attached.

Extenders:
==========

  - class java.lang.Object
  - nil
  - interface org.eclipse.emf.ecore.EClass
  - interface org.eclipse.emf.ecore.EObject
  - interface org.eclipse.emf.ecore.resource.ResourceSet
  - interface org.eclipse.emf.ecore.resource.Resource
  - interface de.uni_koblenz.jgralab.schema.AttributedElementClass
  - interface de.uni_koblenz.jgralab.AttributedElement
  - interface de.uni_koblenz.jgralab.schema.Schema

Signatures:
===========

  (mm-class model-element)
  (mm-class model mm-class-sym)
  
    Returns the given model-element's metamodel class,
    or the metamodel class named mm-class-sym (a symbol).

  (mm-class? obj)
  
    Returns true if the given `obj` is a metamodel class.
    Default implementations exist for java.lang.Object and nil which simply
    return false.

Back to top View Source

Protocol: IMMContainmentReference

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EClass
  - interface de.uni_koblenz.jgralab.schema.VertexClass

Signatures:
===========

  (mm-containment-reference? class role)
  
    Returns true if `role` (given as keyword) is a containment reference of `class`,
    i.e., the target objects are contained by `class`.

Back to top View Source

Protocol: IMMDirectSuperclasses

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EClass
  - interface de.uni_koblenz.jgralab.schema.GraphElementClass

Signatures:
===========

  (mm-direct-superclasses metamodel-type)
  
    Returns the direct superclasses of metamodel-type.

Back to top View Source

Protocol: IMMElementClass

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

  No docs attached.

Extenders:
==========

  - class java.lang.Object
  - nil
  - interface org.eclipse.emf.ecore.EClass
  - interface de.uni_koblenz.jgralab.schema.VertexClass

Signatures:
===========

  (mm-element-class? obj)
  
    Returns true iff `obj` is an element class.

Back to top View Source

Protocol: IMMElementClasses

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EClass
  - interface org.eclipse.emf.ecore.resource.Resource
  - interface org.eclipse.emf.ecore.resource.ResourceSet
  - interface de.uni_koblenz.jgralab.schema.GraphElementClass
  - interface de.uni_koblenz.jgralab.schema.Schema

Signatures:
===========

  (mm-element-classes mm-or-cls)
  
    Returns all element classes in the metamodel `mm-or-cls` or in the
      metamodel containing class `mm-or-cls`.

Back to top View Source

Protocol: IMMEnumClasses

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

  No docs attached.

Extenders:
==========

  - class java.lang.Object
  - nil
  - interface de.uni_koblenz.jgralab.schema.Schema
  - interface de.uni_koblenz.jgralab.schema.AttributedElementClass
  - interface de.uni_koblenz.jgralab.AttributedElement

Signatures:
===========

  (mm-enum-classes m)
  
    Returns a map of the following form:
      {EnumClass (CONST1 CONST2 ...), ...}

Back to top View Source

Protocol: IMMMultiValuedProperty

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EClass
  - interface de.uni_koblenz.jgralab.schema.AttributedElementClass

Signatures:
===========

  (mm-multi-valued-property? cls prop)
  
    Returns true iff `prop` (given as keyword) is a multi-valued property
    of `cls`.

Back to top View Source

Protocol: IMMReferencedElementClass

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EClass
  - interface de.uni_koblenz.jgralab.schema.VertexClass

Signatures:
===========

  (mm-referenced-element-class cls ref)
  
    Returns the element class referenced by `cls`s `ref` reference.

Back to top View Source

Protocol: IMMReferences

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EClass
  - interface de.uni_koblenz.jgralab.schema.VertexClass

Signatures:
===========

  (mm-references cls)
  
    Returns the sequence of references declared for class `cls`.
    Each reference is represented as a keyword.

Back to top View Source

Protocol: IMMRelationshipClass

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

  No docs attached.

Extenders:
==========

  - class java.lang.Object
  - nil
  - interface de.uni_koblenz.jgralab.schema.EdgeClass

Signatures:
===========

  (mm-relationship-class? obj)
  
    Returns true iff `obj` is a relationship class.

Back to top View Source

Protocol: IMMRelationshipClassSourceTarget

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

  No docs attached.

Extenders:
==========

  - interface de.uni_koblenz.jgralab.schema.EdgeClass

Signatures:
===========

  (mm-relationship-class-source rel-cls)
  
    Returns the source element class of the relationship class `rel-cls`.

  (mm-relationship-class-target rel-cls)
  
    Returns the target element class of the relationship class `rel-cls`.

Back to top View Source

Protocol: IMMRelationshipClasses

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

  No docs attached.

Extenders:
==========

  - interface de.uni_koblenz.jgralab.schema.GraphElementClass
  - interface de.uni_koblenz.jgralab.schema.Schema

Signatures:
===========

  (mm-relationship-classes mm-or-cls)
  
    Returns all relationship classes in the metamodel `mm-or-cls` or in the
      metamodel containing class `mm-or-cls`.

Back to top View Source

Protocol: IMMSuperclass

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EClass
  - interface de.uni_koblenz.jgralab.schema.GraphElementClass

Signatures:
===========

  (mm-superclass? super sub)
  
    Return true iff super is a direct or indirect super class of sub.
    (mm-superclass? c c) is false.

Back to top View Source

Protocol: IModifyAdjacencies

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EObject
  - interface de.uni_koblenz.jgralab.Vertex

Signatures:
===========

  (set-adj! obj role robj)
  
    Sets the single-valued `role` of `obj` to `robj`.
    Returns `obj` again.

  (set-adjs! obj role robjs)
  
    Sets the multi-valued `role` of `obj` to `robjs` (a collection of model
    elements).  Returns `obj` again.

  (add-adj! obj role robj)
  
    Adds `robj` to `obj`s `role`.  Returns `obj` again.

  (add-adjs! obj role robjs)
  
    Adds all `robjs` to `obj`s `role`.  Returns `obj` again.

  (remove-adj! obj role robj)
  
    Removes `robj` from `obj`s `role`.  Returns `obj` again.

  (remove-adjs! obj role robjs)
  
    Removes all `robjs` from `obj`s `role`.  Returns `obj` again.

Back to top View Source

Protocol: INeighbors

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EObject
  - interface de.uni_koblenz.jgralab.Vertex

Signatures:
===========

  (neighbors elem)
  
    Returns the sequence of `elem`s neighbors.
    Neighbors are all elements that are referenced by `elem` using an arbitrary
    reference.

Back to top View Source

Protocol: IQualifiedName

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

  A protocol for qualified names.

Extenders:
==========

  - interface de.uni_koblenz.jgralab.schema.MapDomain
  - interface de.uni_koblenz.jgralab.AttributedElement
  - interface de.uni_koblenz.jgralab.schema.Schema
  - interface de.uni_koblenz.jgralab.schema.Domain
  - interface org.eclipse.emf.ecore.EEnumLiteral
  - interface de.uni_koblenz.jgralab.schema.AttributedElementClass
  - interface de.uni_koblenz.jgralab.schema.SetDomain
  - interface org.eclipse.emf.ecore.EObject
  - interface de.uni_koblenz.jgralab.schema.ListDomain
  - interface org.eclipse.emf.ecore.EPackage
  - interface org.eclipse.emf.ecore.EClassifier

Signatures:
===========

  (qname this)
  
    Returns the qualified name of this named element's class or named element
    class as a symbol.  For collection domains, it returns a vector of symbols:
    [List Integer] where Integer is the base domain, or [Map Integer String]
    where Integer is the key domain and String is the value domain.  Of course,
    that may be recursive, so [Map Integer [List String]] corresponds to the java
    domain Map<Integer, List<String>>.

Back to top View Source

Protocol: IRelationship

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

  No docs attached.

Extenders:
==========

  - class java.lang.Object
  - nil
  - interface de.uni_koblenz.jgralab.Edge

Signatures:
===========

  (relationship? this)
  
    Returns true if `this` is a relationship.

Back to top View Source

Protocol: IRelationshipSourceTarget

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

  No docs attached.

Extenders:
==========

  - interface de.uni_koblenz.jgralab.Edge

Signatures:
===========

  (source rel)
  
    Returns the element where this `rel` starts.

  (target rel)
  
    Returns the element where this `rel` ends.

Back to top View Source

Protocol: IRelationships

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

  No docs attached.

Extenders:
==========

  - interface de.uni_koblenz.jgralab.Graph

Signatures:
===========

  (relationships model)
  (relationships modes type-spec)
  
    Returns the lazy seq of relationships in `model` restricted by `type-spec`.
    This is intended to be extended upon models with first-class relationships such as
    JGraLab where `type-spec` is a type specification on relationship classes.

Back to top View Source

Protocol: ITypeMatcher

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EObject
  - interface org.eclipse.emf.ecore.resource.Resource
  - interface org.eclipse.emf.ecore.resource.ResourceSet
  - interface de.uni_koblenz.jgralab.GraphElement
  - interface de.uni_koblenz.jgralab.Graph

Signatures:
===========

  (type-matcher model type-spec)
  
    Returns a type-matcher function based on the metamodel of model.
    A type-matcher function accepts one object and returns true if the object
    matches the `type-spec`, or false otherwise.
  
    A type-spec may be composed of:
  
      - nil                     Every type is accepted
      - a predicate p           Accepted if (p obj) is true
      - a qname symbol
        - Foo                   Accepts objects of type Foo and subtypes
        - Foo!                  Accepts objects of exact type Foo
        - !Foo                  Accepts objects not of type Foo or subtypes
        - !Foo!                 Accepts objects not of exact type Foo
      - a metamodel type        Accepts instances of that type
      - a vector of the form    op is a logical operator (:or, :and, :nand, :nor, :xor),
        [op ts1 ts2 ...]        and ts1, ts2, etc are type-specs.  Accepts objects
                                whose type matches the individual type-specs ts1, ts2,
                                etc with the respective semantics of the logical
                                operator.

Back to top View Source

Protocol: IUniqueName

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EClassifier
  - interface org.eclipse.emf.ecore.EEnumLiteral
  - interface org.eclipse.emf.ecore.EObject
  - interface de.uni_koblenz.jgralab.schema.NamedElement
  - interface de.uni_koblenz.jgralab.AttributedElement

Signatures:
===========

  (uname this)
  
    Returns the unique name of element class `this` as a symbol.
    The unique name is the class' simple name if it is unique in the complete
    metamodel, else, i.e., there's a foo.X and a bar.X class in the metamodel, it
    is the qualified name.

Back to top View Source

Protocol: IUnset

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

  No docs attached.

Extenders:
==========

  - interface org.eclipse.emf.ecore.EObject
  - interface de.uni_koblenz.jgralab.AttributedElement

Signatures:
===========

  (unset? this prop)
  
    Returns true iff the property `prop` (given as keyword) is unset.

Back to top View Source

Method: add-adj!

Specified by protocol IModifyAdjacencies.

Arglists:
=========

  (add-adj! obj role robj)

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

  Adds `robj` to `obj`s `role`.  Returns `obj` again.
Back to top View Source

Method: add-adjs!

Specified by protocol IModifyAdjacencies.

Arglists:
=========

  (add-adjs! obj role robjs)

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

  Adds all `robjs` to `obj`s `role`.  Returns `obj` again.
Back to top View Source

Function: adj

Arglists:
=========

  (adj elem role & roles)

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

  Traverses single-valued `role` and more `roles` starting at `elem`.
  Returns the target object.
  Errors if a role is undefined, intermediate targets are nil, or there are
  more elements that can be reached that way.
Back to top View Source

Function: adj*

Arglists:
=========

  (adj* elem role & roles)

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

  Like `adj`, but doesn't error if some role is not defined.  In that case, it
  simply returns nil.
Back to top View Source

Function: adjs

Arglists:
=========

  (adjs elem role & roles)

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

  Traverses `role` and more `roles` starting at `elem`.
  Returns a vector of target objects.
  Errors if a role is undefined.
Back to top View Source

Function: adjs*

Arglists:
=========

  (adjs* elem role & roles)

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

  Like `adjs`, but doesn't error if some role is not defined.  In that case,
  it simply returns the empty vector.
Back to top View Source

Function: adjs*-transducer

Arglists:
=========

  (adjs*-transducer role & roles)

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

  Returns a transducer traversing `role` and `roles` one after the other.
Back to top View Source

Function: adjs-transducer

Arglists:
=========

  (adjs-transducer role & roles)

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

  Returns a transducer traversing `role` and `roles` one after the other.
  Errors if some role is not defined for an element.
Back to top View Source

Method: aval

Specified by protocol IAttributeValueAccess.

Arglists:
=========

  (aval el attr)

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

  Returns the value of `el`s `attr` attribute.
  `attr` is the attribute name given as keyword.
Back to top View Source

Method: container

Specified by protocol IContainer.

Arglists:
=========

  (container this)
  (container this ts-or-role)

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

  Returns the container of this element.
  A container is an element that references `this` element by some link with
  containment semantics.  If `ts-or-role` is given, the container must me
  referenced with a link matching this type-spec or role name.
Back to top View Source

Method: contents

Specified by protocol IContents.

Arglists:
=========

  (contents this)
  (contents this ts-or-role)

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

  Returns the seq of `this` element's direct contents possibly restricted by
  the type-spec or role `ts-or-role`.
Back to top View Source

Method: copy-model

Specified by protocol ICopyModel.

Arglists:
=========

  (copy-model this)

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

  Returns a copy of the given model and all its elements.
Back to top View Source

Method: create-element!

Specified by protocol ICreateElement.

Arglists:
=========

  (create-element! model cls)
  (create-element! model cls prop-map)

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

  Creates a new element of type `cls` in `model`.
  Properties are set according to `prop-map`, a map from property name keywords
  to property values.
Back to top View Source

Method: create-relationship!

Specified by protocol ICreateRelationship.

Arglists:
=========

  (create-relationship! model cls src-elem trg-elem)
  (create-relationship! model cls src-elem trg-elem attr-map)

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

  Creates a new relationship of type `cls` in `model` connecting `src-elem`
  to `trg-elem`.  The valid values for `cls` are framework specific.  For
  TGraphs it is a symbol denoting an EdgeClass name, for EMF it is a keyword
  denoting an EReference name.  The return value is also framework specific.
  For TGraphs it is an Edge, for EMF it is the tuple [src-elem trg-elem].
  `attr-map` is a map from attribute names (as keywords) to values to be set.
  Clearly, this is unsupported by frameworks without explicit relationships with
  attributes.
Back to top View Source

Method: delete!

Specified by protocol IDelete.

Arglists:
=========

  (delete! this)
  (delete! this recursively)

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

  Deletes this element and returns it.  If `recursively` is true (default),
  delete also elements contained by `this`.  Of course, `recursively` has no
  meaning for edges.  Implementations are provided for Vertex, Edge, EObject,
  and collections thereof.
Back to top View Source

Method: describe

Specified by protocol IDescribe.

Arglists:
=========

  (describe this)

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

  Describes `this` attributed element or attributed element class.
Back to top View Source

Method: element?

Specified by protocol IElement.

Arglists:
=========

  (element? this)

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

  Returns true if `this` is an element.
Back to top View Source

Method: elements

Specified by protocol IElements.

Arglists:
=========

  (elements model)
  (elements model type-spec)

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

  Returns the lazy sequence of elements in `model` restricted by `type-spec`.
Back to top View Source

Method: enum-constant

Specified by protocol IEnumConstant.

Arglists:
=========

  (enum-constant m const)

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

  Returns the enumeration constant with the qualified name `const` in the
  metamodel of model `m`.
  In case of EMF, `m` is ignored.
Back to top View Source

Method: equal-models?

Specified by protocol IEqualModels.

Arglists:
=========

  (equal-models? m1 m2)
  (equal-models? m1 m2 link-order)

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

  Returns true only if model `m1` and model `m2` are structurally equal.
  If `link-order` is true, also consider the order of links (false by
  default).
Back to top View Source

Function: escaped-uname-str

Arglists:
=========

  (escaped-uname-str cls)

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

  Returns the unique name of metamodel `cls` as a string where dots are
  replaced by $ (in the fully qualified case).
  Utility function used by the API generator macros.
Back to top View Source

Macro: generate-metamodel-functions

Arglists:
=========

  (generate-metamodel-functions mm-file)
  (generate-metamodel-functions mm-file nssym)
  (generate-metamodel-functions mm-file nssym alias)
  (generate-metamodel-functions mm-file nssym alias prefix)

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

  Generates a metamodel-specific API consisting of functions for creating
  elements and functions for accessing properties (attributes and references).

  `mm-file` is the file containing the metamodel for which to generate the API.
  This file must be loadable with `mm-load` which see.

  `nssym` is a symbol denoting the new namespace in which to generate.  It may
  be nil in which case the current namespace is used.

  `alias` is an alias under which the newly generated namespace will be
  required.

  `prefix` is an optional prefix all generated functions should use.  (That's
  mostly useful when generating in an existing namespace to prevent name
  clashes.)

  The following functions are generated:

  For any element class Foo in the metamodel, a (create-Foo! model) function,
  an (all-Foos model) function, and a (isa-Foo? el) type check predicate is
  generated.

  For any relationship class Bar in the metamodel, a (create-Bar! model start
  end) function, an (all-Bars model) function, an (incident-Bars el dir)
  function (dir is optional and may be :in, :out, or :inout [default]), and
  a (isa-Foo?  el) type check predicate is generated.

  For any attribute name attr, the following functions are generated:

    (attr el)          ;; Returns the attr value of el
    (set-attr! el val) ;; Sets the attr value of el to val

  For boolean attributes the getter is named attr?.

  For any reference name ref, the following functions are generated:

    (->ref el)                  ;; Returns the element(s) in el's ref role
    (->set-ref! el refed)       ;; Sets el's ref reference to refed
    (->add-ref! el r1 r2 r3...) ;; Adds r1, r2, and r3 to el's ref reference
    (->addall-ref! el rs)       ;; Adds all elements in rs to el's ref reference

  The add-* functions are only generated if ref occurs as a multi-valued
  reference.  If el's ref-reference is multi-valued, then the setter wants a
  collection of elements, else a single element.
Back to top View Source

Function: has-type?

Arglists:
=========

  (has-type? el type-spec)

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

  Returns true if model element `el` matches the type specification `type-spec`.
  See protocol funnyqt.generic/ITypeMatcher.
Back to top View Source

Method: incident-relationships

Specified by protocol IIncidentRelationships.

Arglists:
=========

  (incident-relationships elem)
  (incident-relationships elem type-spec)
  (incident-relationships elem type-spec dir-spec)

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

  Returns the lazy seq of relationships incident to `elem`.
  May be restricted by the type specification `type-spec` and the direction
  specification `dir-spec` (:in, :out, or :inout).
Back to top View Source

Method: is-instance?

Specified by protocol IInstanceOf.

Arglists:
=========

  (is-instance? object class)

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

  Returns true, iff `object` is an instance of `class`.
Back to top View Source

Macro: metamodel-api-generator

Arglists:
=========

  (metamodel-api-generator
   mm-file
   nssym
   alias
   prefix
   element-class-fn
   relationship-class-fn
   attr-fn
   ref-fn)
  (metamodel-api-generator
   mm-file
   nssym
   alias
   prefix
   element-class-fn
   relationship-class-fn
   attr-fn
   ref-fn
   extension-hook)

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

  A helper macro to generate metamodel specific APIs in some namespace.

  `mm-file` is the file containing the metamodel (an ecore or tg file, or
  something that's recognized by `mm-load`).

  The `nssym` denotes the name of the namespace in which to generate the API.
  If `nssym` is nil, generate it in the current namespace.

  The new namespace (in case nssym was given) is required using the given
  `alias` (if non-nil): (require '[nssym :as alias])

  `prefix` is an optional prefix all generated functions should have given as
  symbol or string.  (This is mainly useful if the functions are generated in
  the current namespace in order not to clash with standard functions such as
  clojure.core/name.)

  `element-class-fn` is a function receiving a metamodel class and the
  `prefix`.  It should return a valid definition-form, e.g., a (defn
  <prefix>do-eclass [...]  ...).

  `relationship-class-fn` is to be a function that receives a relationship
  class and `prefix` and returns a valid definition-form.

  `attr-fn` is a function receiving an attribute name as keyword, a set of
  classes that have such an attribute, and the `prefix`.  It should return a
  valid definition-form.

  `ref-fn` is a function receiving a reference name as keyword, a set of
  element classes that have such a reference, and the `prefix`.  It should
  return a valid definition-form.

  The functions are called with all classes/attributes/references of the
  metamodel.

  Lastly, an optional `extension-hook` may be given.  This is a function that
  gets the loaded metamodel and should return a seq of extension code which
  will be spliced in.  You can use that for example to generate accessor for
  enum literals or other custom data types.
Back to top View Source

Method: mm-abstract?

Specified by protocol IMMAbstract.

Arglists:
=========

  (mm-abstract? this)

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

  Returns true, iff the element class is abstract.
  Implementations are provided for:

    - java.lang.Class: default impl in this namespace
    - de.uni_koblenz.jgralab.schema.GraphElementClass: funnyqt.tg
    - org.eclipse.emf.ecore.EClass: funnyqt.emf
Back to top View Source

Function: mm-all-attributes

Arglists:
=========

  (mm-all-attributes cls)

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

  Returns the set of all attributes of `cls`, i.e., own and inherited
  attributes.
Back to top View Source

Function: mm-all-references

Arglists:
=========

  (mm-all-references cls)

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

  Returns the set of all references of `cls`, i.e., own and inherited
  references.
Back to top View Source

Method: mm-all-subclasses

Specified by protocol IMMAllSubclasses.

Arglists:
=========

  (mm-all-subclasses cls)

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

  Returns the sequence of all subclasses of `cls`.  Those are direct and
    indirect subclasses.
Back to top View Source

Function: mm-all-superclasses

Arglists:
=========

  (mm-all-superclasses cls)

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

  Returns the set of all direct and indirect superclasses of `cls`.
Back to top View Source

Method: mm-attributes

Specified by protocol IMMAttributes.

Arglists:
=========

  (mm-attributes cls)

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

  Returns the sequence of attributes declared for class `cls`.
  Each attribute is represented as a keyword.
Back to top View Source

Method: mm-boolean-attribute?

Specified by protocol IMMBooleanAttribute.

Arglists:
=========

  (mm-boolean-attribute? cls attr)

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

  Returns true iff `attr` (given as keyword) is a boolean attribute of
  metamodel class `cls`.
Back to top View Source

Method: mm-class

Specified by protocol IMMClass.

Arglists:
=========

  (mm-class model-element)
  (mm-class model mm-class-sym)

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

  Returns the given model-element's metamodel class,
  or the metamodel class named mm-class-sym (a symbol).
Back to top View Source

Method: mm-class?

Specified by protocol IMMClass.

Arglists:
=========

  (mm-class? obj)

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

  Returns true if the given `obj` is a metamodel class.
  Default implementations exist for java.lang.Object and nil which simply
  return false.
Back to top View Source

Method: mm-containment-reference?

Specified by protocol IMMContainmentReference.

Arglists:
=========

  (mm-containment-reference? class role)

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

  Returns true if `role` (given as keyword) is a containment reference of `class`,
  i.e., the target objects are contained by `class`.
Back to top View Source

Method: mm-direct-superclasses

Specified by protocol IMMDirectSuperclasses.

Arglists:
=========

  (mm-direct-superclasses metamodel-type)

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

  Returns the direct superclasses of metamodel-type.
Back to top View Source

Method: mm-element-class?

Specified by protocol IMMElementClass.

Arglists:
=========

  (mm-element-class? obj)

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

  Returns true iff `obj` is an element class.
Back to top View Source

Method: mm-element-classes

Specified by protocol IMMElementClasses.

Arglists:
=========

  (mm-element-classes mm-or-cls)

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

  Returns all element classes in the metamodel `mm-or-cls` or in the
    metamodel containing class `mm-or-cls`.
Back to top View Source

Method: mm-enum-classes

Specified by protocol IMMEnumClasses.

Arglists:
=========

  (mm-enum-classes m)

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

  Returns a map of the following form:
    {EnumClass (CONST1 CONST2 ...), ...}
Back to top View Source

Function: mm-load

Arglists:
=========

  (mm-load file)

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

  No docs attached.
Back to top View Source

Var: mm-load-handlers

  A map from regular expressions to functions to load a metamodel.
Back to top View Source

Method: mm-multi-valued-property?

Specified by protocol IMMMultiValuedProperty.

Arglists:
=========

  (mm-multi-valued-property? cls prop)

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

  Returns true iff `prop` (given as keyword) is a multi-valued property
  of `cls`.
Back to top View Source

Method: mm-referenced-element-class

Specified by protocol IMMReferencedElementClass.

Arglists:
=========

  (mm-referenced-element-class cls ref)

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

  Returns the element class referenced by `cls`s `ref` reference.
Back to top View Source

Method: mm-references

Specified by protocol IMMReferences.

Arglists:
=========

  (mm-references cls)

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

  Returns the sequence of references declared for class `cls`.
  Each reference is represented as a keyword.
Back to top View Source

Method: mm-relationship-class-source

Specified by protocol IMMRelationshipClassSourceTarget.

Arglists:
=========

  (mm-relationship-class-source rel-cls)

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

  Returns the source element class of the relationship class `rel-cls`.
Back to top View Source

Method: mm-relationship-class-target

Specified by protocol IMMRelationshipClassSourceTarget.

Arglists:
=========

  (mm-relationship-class-target rel-cls)

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

  Returns the target element class of the relationship class `rel-cls`.
Back to top View Source

Method: mm-relationship-class?

Specified by protocol IMMRelationshipClass.

Arglists:
=========

  (mm-relationship-class? obj)

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

  Returns true iff `obj` is a relationship class.
Back to top View Source

Method: mm-relationship-classes

Specified by protocol IMMRelationshipClasses.

Arglists:
=========

  (mm-relationship-classes mm-or-cls)

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

  Returns all relationship classes in the metamodel `mm-or-cls` or in the
    metamodel containing class `mm-or-cls`.
Back to top View Source

Method: mm-superclass?

Specified by protocol IMMSuperclass.

Arglists:
=========

  (mm-superclass? super sub)

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

  Return true iff super is a direct or indirect super class of sub.
  (mm-superclass? c c) is false.
Back to top View Source

Method: neighbors

Specified by protocol INeighbors.

Arglists:
=========

  (neighbors elem)

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

  Returns the sequence of `elem`s neighbors.
  Neighbors are all elements that are referenced by `elem` using an arbitrary
  reference.
Back to top View Source

Method: qname

Specified by protocol IQualifiedName.

Arglists:
=========

  (qname this)

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

  Returns the qualified name of this named element's class or named element
  class as a symbol.  For collection domains, it returns a vector of symbols:
  [List Integer] where Integer is the base domain, or [Map Integer String]
  where Integer is the key domain and String is the value domain.  Of course,
  that may be recursive, so [Map Integer [List String]] corresponds to the java
  domain Map<Integer, List<String>>.
Back to top View Source

Method: relationship?

Specified by protocol IRelationship.

Arglists:
=========

  (relationship? this)

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

  Returns true if `this` is a relationship.
Back to top View Source

Method: relationships

Specified by protocol IRelationships.

Arglists:
=========

  (relationships model)
  (relationships modes type-spec)

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

  Returns the lazy seq of relationships in `model` restricted by `type-spec`.
  This is intended to be extended upon models with first-class relationships such as
  JGraLab where `type-spec` is a type specification on relationship classes.
Back to top View Source

Method: remove-adj!

Specified by protocol IModifyAdjacencies.

Arglists:
=========

  (remove-adj! obj role robj)

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

  Removes `robj` from `obj`s `role`.  Returns `obj` again.
Back to top View Source

Method: remove-adjs!

Specified by protocol IModifyAdjacencies.

Arglists:
=========

  (remove-adjs! obj role robjs)

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

  Removes all `robjs` from `obj`s `role`.  Returns `obj` again.
Back to top View Source

Method: set-adj!

Specified by protocol IModifyAdjacencies.

Arglists:
=========

  (set-adj! obj role robj)

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

  Sets the single-valued `role` of `obj` to `robj`.
  Returns `obj` again.
Back to top View Source

Method: set-adjs!

Specified by protocol IModifyAdjacencies.

Arglists:
=========

  (set-adjs! obj role robjs)

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

  Sets the multi-valued `role` of `obj` to `robjs` (a collection of model
  elements).  Returns `obj` again.
Back to top View Source

Method: set-aval!

Specified by protocol IAttributeValueAccess.

Arglists:
=========

  (set-aval! el attr val)

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

  Sets the value of `el`s `attr` attribute to `val`.
  `attr` is the attribute name given as keyword.
Back to top View Source

Function: set-props!

Arglists:
=========

  (set-props! el props)
  (set-props! el prop val & more)

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

  Sets the properties of `el` and return `el` again.
  Properties may either be given as key-value pairs or as one single map from
  keywords to values.  Note that this function is not very efficient because it
  has to check for each given property if it is an attribute or a reference,
  and for the latter it has to check if it is single- or multi-valued.
Back to top View Source

Method: source

Specified by protocol IRelationshipSourceTarget.

Arglists:
=========

  (source rel)

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

  Returns the element where this `rel` starts.
Back to top View Source

Method: target

Specified by protocol IRelationshipSourceTarget.

Arglists:
=========

  (target rel)

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

  Returns the element where this `rel` ends.
Back to top View Source

Macro: type-case

Arglists:
=========

  (type-case elem & clauses)

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

  Takes an element `elem` (a GraphElement or EObject) and a set of `clauses`.
  Every clause is a pair of the form:

    type-spec result-expr

  The type-specs are tested one after the other, and if a type-spec matches the
  type of `elem`, the return value of type-case is the result-expr paired with
  the succeeding type-spec.  Note that the type-specs must not be quoted!

  A single default-expr may follow the pairs.  If no type-spec matches, the
  return value of type-case is the value of that default expression.  If there
  is no default expression and no type-spec matches, an
  IllegalArgumentException is thrown.

  Example:

    (type-case obj
      TypeA (do-a-stuff obj)
      TypeB (do-b-stuff obj)
      (do-default-stuff obj))

  Note that the type-specs must not be quoted.
Back to top View Source

Method: type-matcher

Specified by protocol ITypeMatcher.

Arglists:
=========

  (type-matcher model type-spec)

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

  Returns a type-matcher function based on the metamodel of model.
  A type-matcher function accepts one object and returns true if the object
  matches the `type-spec`, or false otherwise.

  A type-spec may be composed of:

    - nil                     Every type is accepted
    - a predicate p           Accepted if (p obj) is true
    - a qname symbol
      - Foo                   Accepts objects of type Foo and subtypes
      - Foo!                  Accepts objects of exact type Foo
      - !Foo                  Accepts objects not of type Foo or subtypes
      - !Foo!                 Accepts objects not of exact type Foo
    - a metamodel type        Accepts instances of that type
    - a vector of the form    op is a logical operator (:or, :and, :nand, :nor, :xor),
      [op ts1 ts2 ...]        and ts1, ts2, etc are type-specs.  Accepts objects
                              whose type matches the individual type-specs ts1, ts2,
                              etc with the respective semantics of the logical
                              operator.
Back to top View Source

Method: uname

Specified by protocol IUniqueName.

Arglists:
=========

  (uname this)

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

  Returns the unique name of element class `this` as a symbol.
  The unique name is the class' simple name if it is unique in the complete
  metamodel, else, i.e., there's a foo.X and a bar.X class in the metamodel, it
  is the qualified name.
Back to top View Source

Method: unset?

Specified by protocol IUnset.

Arglists:
=========

  (unset? this prop)

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

  Returns true iff the property `prop` (given as keyword) is unset.
Back to top View Source