Namespace funnyqt.query

Generic query functions like regular path expressions & quantified expressions.

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.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.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 query functions like regular path expressions & quantified expressions.
Back to top

Details of Public Vars

Method: --->

Specified by protocol ISimpleRegularPathExpression.

Arglists:
=========

  (---> n)
  (---> n spec)
  (---> n spec pred)

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

  Returns the ordered set of nodes reachable from `n` via one forward edge
  which must not be a containment edge.  May be restricted by a type
  specification (TG) or reference specification (EMF) `spec` and a predicate
  `pred` on the edge.  The 3-arity version with `pred` is not supported for EMF
  because there are no first-class edges in EMF.
Back to top View Source

Method: --<>

Specified by protocol ISimpleRegularPathExpression.

Arglists:
=========

  (--<> n)
  (--<> n spec)
  (--<> n spec pred)

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

  Returns the ordered set of nodes reachable from `n` via one (strict)
  containment edge from part to whole (`n` is contained in the result), no
  matter if incoming or outgoing.  May be restricted by a type specification
  (TG) or reference specification (EMF) `spec` and a predicate `pred` on the
  edge.  The 3-arity version with `pred` is not supported for EMF because there
  are no first-class edges in EMF.
Back to top View Source

Method: -->

Specified by protocol ISimpleRegularPathExpression.

Arglists:
=========

  (--> n)
  (--> n spec)
  (--> n spec pred)

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

  Returns the ordered set of nodes reachable from `n` via one forward edge.
  May be restricted by a type specification (TG) or reference
  specification (EMF) `spec` and a predicate `pred` on the edge.  The 3-arity
  version with `pred` is not supported for EMF because there are no first-class
  edges in EMF.
Back to top View Source

Method: <--

Specified by protocol ISimpleRegularPathExpression.

Arglists:
=========

  (<-- n)
  (<-- n spec)
  (<-- n spec pred)

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

  Returns the ordered set of nodes reachable from `n` via one backward edge.
  May be restricted by a type specification (TG) or reference
  specification (EMF) `spec` and a predicate `pred` on the edge.  For EMF, only
  bidirectional references are considered, and the 3-arity version with `pred`
  is not supported because there are no first-class edges in EMF.
Back to top View Source

Method: <---

Specified by protocol ISimpleRegularPathExpression.

Arglists:
=========

  (<--- n)
  (<--- n spec)
  (<--- n spec pred)

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

  Returns the ordered set of nodes reachable from `n` via one backward edge
  which must not be a containment edge.  May be restricted by a type
  specification (TG) or reference specification (EMF) `spec` and a predicate
  `pred` on the edge.For EMF, only bidirectional references are considered, and
  the 3-arity version with `pred` is not supported because there are no
  first-class edges in EMF.
Back to top View Source

Method: <-->

Specified by protocol ISimpleRegularPathExpression.

Arglists:
=========

  (<--> n)
  (<--> n spec)
  (<--> n spec pred)

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

  Returns the ordered set of nodes reachable from `n` via one edge which
  must not be a containment edge, no matter if incoming or outgoing.  May be
  restricted by a type specification (TG) or reference specification (EMF)
  `spec` and a predicate `pred` on the edge.  For EMF, only bidirectional
  references are considered, and the 3-arity version with `pred` is not
  supported because there are no first-class edges in EMF.
Back to top View Source

Method: <->

Specified by protocol ISimpleRegularPathExpression.

Arglists:
=========

  (<-> n)
  (<-> n spec)
  (<-> n spec pred)

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

  Returns the ordered set of nodes reachable from `n` via one edge, no
  matter if incoming or outgoing.  May be restricted by a type specification
  (TG) or reference specification (EMF) `spec` and a predicate `pred` on the
  edge.  For EMF, only bidirectional references are considered, and the 3-arity
  version with `pred` is not supported because there are no first-class edges
  in EMF.
Back to top View Source

Method: <>--

Specified by protocol ISimpleRegularPathExpression.

Arglists:
=========

  (<>-- n)
  (<>-- n spec)
  (<>-- n spec pred)

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

  Returns the ordered set of nodes reachable from `n` via one (strict)
  containment edge from whole to part (`n` is the container of the result), no
  matter if incoming or outgoing.  May be restricted by a type specification
  (TG) or reference specification (EMF) `spec` and a predicate `pred` on the
  edge.  The 3-arity version with `pred` is not supported for EMF because there
  are no first-class edges in EMF.
Back to top View Source

Protocol: ISimpleRegularPathExpression

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

  No docs attached.

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

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

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

  (--> n)
  (--> n spec)
  (--> n spec pred)
  
    Returns the ordered set of nodes reachable from `n` via one forward edge.
    May be restricted by a type specification (TG) or reference
    specification (EMF) `spec` and a predicate `pred` on the edge.  The 3-arity
    version with `pred` is not supported for EMF because there are no first-class
    edges in EMF.

  (---> n)
  (---> n spec)
  (---> n spec pred)
  
    Returns the ordered set of nodes reachable from `n` via one forward edge
    which must not be a containment edge.  May be restricted by a type
    specification (TG) or reference specification (EMF) `spec` and a predicate
    `pred` on the edge.  The 3-arity version with `pred` is not supported for EMF
    because there are no first-class edges in EMF.

  (<-- n)
  (<-- n spec)
  (<-- n spec pred)
  
    Returns the ordered set of nodes reachable from `n` via one backward edge.
    May be restricted by a type specification (TG) or reference
    specification (EMF) `spec` and a predicate `pred` on the edge.  For EMF, only
    bidirectional references are considered, and the 3-arity version with `pred`
    is not supported because there are no first-class edges in EMF.

  (<--- n)
  (<--- n spec)
  (<--- n spec pred)
  
    Returns the ordered set of nodes reachable from `n` via one backward edge
    which must not be a containment edge.  May be restricted by a type
    specification (TG) or reference specification (EMF) `spec` and a predicate
    `pred` on the edge.For EMF, only bidirectional references are considered, and
    the 3-arity version with `pred` is not supported because there are no
    first-class edges in EMF.

  (<-> n)
  (<-> n spec)
  (<-> n spec pred)
  
    Returns the ordered set of nodes reachable from `n` via one edge, no
    matter if incoming or outgoing.  May be restricted by a type specification
    (TG) or reference specification (EMF) `spec` and a predicate `pred` on the
    edge.  For EMF, only bidirectional references are considered, and the 3-arity
    version with `pred` is not supported because there are no first-class edges
    in EMF.

  (<--> n)
  (<--> n spec)
  (<--> n spec pred)
  
    Returns the ordered set of nodes reachable from `n` via one edge which
    must not be a containment edge, no matter if incoming or outgoing.  May be
    restricted by a type specification (TG) or reference specification (EMF)
    `spec` and a predicate `pred` on the edge.  For EMF, only bidirectional
    references are considered, and the 3-arity version with `pred` is not
    supported because there are no first-class edges in EMF.

  (<>-- n)
  (<>-- n spec)
  (<>-- n spec pred)
  
    Returns the ordered set of nodes reachable from `n` via one (strict)
    containment edge from whole to part (`n` is the container of the result), no
    matter if incoming or outgoing.  May be restricted by a type specification
    (TG) or reference specification (EMF) `spec` and a predicate `pred` on the
    edge.  The 3-arity version with `pred` is not supported for EMF because there
    are no first-class edges in EMF.

  (--<> n)
  (--<> n spec)
  (--<> n spec pred)
  
    Returns the ordered set of nodes reachable from `n` via one (strict)
    containment edge from part to whole (`n` is contained in the result), no
    matter if incoming or outgoing.  May be restricted by a type specification
    (TG) or reference specification (EMF) `spec` and a predicate `pred` on the
    edge.  The 3-arity version with `pred` is not supported for EMF because there
    are no first-class edges in EMF.

Back to top View Source

Function: and*

Arglists:
=========

  (and* & xs)

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

  Logical AND, implemented as a function, so not short-cirquiting, but
  you can pass it to higher-order functions.
Back to top View Source

Function: and-fn

Arglists:
=========

  (and-fn & ps)

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

  Takes a seq of predicates `ps` and returns a varargs function that returns
  logical true iff all predicates return true.
  If no predicate is given, the returned fn returns constantly true.
Back to top View Source

Function: exist-n?

Arglists:
=========

  (exist-n? n pred coll)

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

  Returns logical true iff `pred` holds for exactly `n` elements in `coll`.
Back to top View Source

Function: exists?

Arglists:
=========

  (exists? pred coll)

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

  Returns logical true iff `pred` holds at least for one element in `coll`.
Back to top View Source

Function: forall?

Arglists:
=========

  (forall? pred coll)

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

  Returns logical true, iff `pred` holds forall elements in `coll`.
Back to top View Source

Function: member?

Arglists:
=========

  (member? e coll)

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

  Returns true iff `e` is a member of `coll`.
Back to top View Source

Macro: nand

Arglists:
=========

  (nand & xs)

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

  Logical NAND.
Back to top View Source

Function: nand*

Arglists:
=========

  (nand* & xs)

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

  Logical NAND, implemented as a function, so not short-cirquiting, but
  you can pass it to higher-order functions.
Back to top View Source

Function: nand-fn

Arglists:
=========

  (nand-fn & ps)

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

  Takes a seq of predicates `ps` and returns a varargs function that returns
  logical true iff at least one predicate returns false.
  If no predicate is given, the returned fn returns constantly false.
Back to top View Source

Macro: nor

Arglists:
=========

  (nor & xs)

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

  Logical NOR.
Back to top View Source

Function: nor*

Arglists:
=========

  (nor* & xs)

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

  Logical NOR, implemented as a function, so not short-cirquiting, but you
  can pass it to higher-order functions.
Back to top View Source

Function: nor-fn

Arglists:
=========

  (nor-fn & ps)

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

  Takes a seq of predicates `ps` and returns a varargs function that returns
  logical true iff none of the predicate returns true.
  If no predicate is given, the returned fn returns constantly true.
Back to top View Source

Function: or*

Arglists:
=========

  (or* & xs)

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

  Logical OR, implemented as a function, so not short-cirquiting, but
  you can pass it to higher-order functions.
Back to top View Source

Function: or-fn

Arglists:
=========

  (or-fn & ps)

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

  Takes a seq of predicates `ps` and returns a varargs function that returns
  logical true iff at least one of the predicates returns true.
  If no predicate is given, the returned fn returns constantly false.
Back to top View Source

Function: p-*

Arglists:
=========

  (p-* n p)

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

  Path iteration starting at `n` and traversing `p` zero or many times.
  `n` may be a node or a collection of nodes.
  `p` is a path expression.
Back to top View Source

Function: p-+

Arglists:
=========

  (p-+ n p)

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

  Path iteration starting at `n` and traversing `p` one or many times.
  `n` may be a node or a collection of nodes.
  `p` is a path expression.
Back to top View Source

Function: p-alt

Arglists:
=========

  (p-alt n & ps)

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

  Path alternative starting at `n` and traversing each alternative in `ps`.
  `n` may be a node or a collection of nodes.
  `ps` is a varags seq of the alternative path expressions.
Back to top View Source

Function: p-apply

Arglists:
=========

  (p-apply n p)

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

  Applies the regular path expression `p` to the start node or set of start
  nodes `n`.
Back to top View Source

Function: p-exp

Arglists:
=========

  (p-exp n l u p)
  (p-exp n i p)

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

  Path exponent starting at `n` and traversing `p` `i` times, or at least `l`
  and at most `u` times.
  `n` may be a node or a collection of nodes.
  `n` or `l` and `u` are integers with `l` <= `u`.
  `p` is a path expression.
Back to top View Source

Function: p-opt

Arglists:
=========

  (p-opt n p)

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

  Path option starting at `n` and maybe traversing `p`.
  `n` may be a node or a collection of nodes.
  `p` is a path expression.
Back to top View Source

Function: p-restr

Arglists:
=========

  (p-restr n spec)
  (p-restr n spec pred)

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

  Path restriction concerning `ts` and `pred` on node `n` or each node in `n`.
  `ts` is a type specification (see `funnyqt.generic/type-matcher`), `pred` a
  predicate on nodes.
Back to top View Source

Function: p-seq

Arglists:
=========

  (p-seq n & ps)

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

  Path sequence starting at `n` and traversing `ps`.
  `n` may be a node or a collection of nodes.
  `ps` is a varargs seq of regular path expressions.
Back to top View Source

Function: pred-seq

Arglists:
=========

  (pred-seq s)

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

  Predecessor Seq: Returns a lazy seq of pairs of seq `s`s elements.
  Each pair has the form [elems-predecessor-in-s elem].
Back to top View Source

Function: pred-succ-seq

Arglists:
=========

  (pred-succ-seq s)

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

  Predecessor-Successor Seq: Returns a lazy seq of triples of seq `s`s elements.
  Each triple has the form [pred cur succ].
Back to top View Source

Function: seq-comparator

Arglists:
=========

  (seq-comparator & cmps)

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

  Returns a sequence comparator function that compares 2 sequences element by
  element according to the given comparators `cmps`, i.e., the first 2 elements
  are compared with the first comparator, the second 2 elements with the second
  comparator, and so on.  Evaluates only as many comparators as are needed to
  distinguish the sequences, i.e., evaluates the comparators until one returns
  non-zero.

  `cmps` must be comparator functions that get 2 elements and returns 0 if the
  elements are equal, a negative integer if the first is "smaller", or a
  positive integer if the second is "smaller".

  If all comparators evaluate to 0, then the hash-codes are used as a last
  resort.

  Example: Sort a seq of 3-tuples of form [number number string] with
  descending order of the first component, ascending order of second component,
  and ascending orded of third components.  Clearly, for numbers - is a valid
  comparator, and for the strings we use compare which sorts lexicographically.

    (sort (seq-comparator #(- %2 %1) - compare)
          [[1 10 "b"] [3 7 "b"] [1 2 "b"] [1 10 "c"] [3.0 17 "a"]])
    ;=> ([3 7 "b"] [3.0 17 "a"] [1 2 "b"] [1 10 "b"] [1 10 "c"])
Back to top View Source

Function: sort-topologically

Arglists:
=========

  (sort-topologically deps-fn els)

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

  Returns the objects `els` as topologically sorted vector or false if there's
  a cycle.  `deps-fn` is a function that given an object of `els` returns its
  "dependencies", i.e., objects that need to be sorted before it.
Back to top View Source

Function: succ-seq

Arglists:
=========

  (succ-seq s)

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

  Successor Seq: Returns a lazy seq of pairs of seq `s`s elements.
  Each pair has the form [elem elems-successor-in-s].
Back to top View Source

Function: the

Arglists:
=========

  (the s)
  (the pred s)

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

  Returns the only element of sequable `s` (which satisfies `pred`) and errors
  if `s` contains more or less elements.
Back to top View Source

Macro: xor

Arglists:
=========

  (xor)
  (xor x)
  (xor x y)
  (xor x y & more)

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

  Logical XOR: returns logical true iff an odd number of arguments is true.
Back to top View Source

Function: xor*

Arglists:
=========

  (xor* & xs)

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

  Logical XOR: returns true iff an odd number of arguments is true.
  Implemented as a function, so not short-cirquiting, but you can pass
  it to higher-order functions.
Back to top View Source

Function: xor-fn

Arglists:
=========

  (xor-fn & ps)

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

  Takes a seq of predicates `ps` and returns a varargs function that returns
  logical true iff an odd number of the predicates returns true.
Back to top View Source