blob: 19a7a64f7b6b6a70724e55967edbc1ad73b98525 [file] [log] [blame]
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link rel="shortcut icon" href="../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.4.2">
<title>Temporal queries - Eclipse Hawk</title>
<link rel="stylesheet" href="../../assets/stylesheets/application.30686662.css">
<link rel="stylesheet" href="../../assets/stylesheets/application-palette.a8b3c06d.css">
<meta name="theme-color" content="#7e57c2">
<script src="../../assets/javascripts/modernizr.74668098.js"></script>
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono&display=fallback">
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
<link rel="stylesheet" href="../../assets/fonts/material-icons.css">
<link rel="stylesheet" href="../../stylesheets/extra.css">
<!-- FAVICON -->
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="manifest" href="/img/site.webmanifest">
<link rel="mask-icon" href="/img/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/img/favicon.ico">
<meta name="msapplication-TileColor" content="#b91d47">
<meta name="msapplication-config" content="/img/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
</head>
<body dir="ltr" data-md-color-primary="deep-purple" data-md-color-accent="deep-purple">
<svg class="md-svg">
<defs>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#data-model" tabindex="1" class="md-skip">
Skip to content
</a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../.." title="Eclipse Hawk" class="md-header-nav__button md-logo">
<img src="../../assets/images/hawk-logo-white.svg" width="24" height="24">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">
Eclipse Hawk
</span>
<span class="md-header-nav__topic">
Temporal queries
</span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
&#xE5CD;
</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://git.eclipse.org/c/hawk/hawk.git/" title="Go to repository" class="md-source" data-md-source="">
<div class="md-source__repository">
Git repository @ Eclipse
</div>
</a>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container">
<main class="md-main" role="main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../.." title="Eclipse Hawk" class="md-nav__button md-logo">
<img src="../../assets/images/hawk-logo-white.svg" width="48" height="48">
</a>
Eclipse Hawk
</label>
<div class="md-nav__source">
<a href="https://git.eclipse.org/c/hawk/hawk.git/" title="Go to repository" class="md-source" data-md-source="">
<div class="md-source__repository">
Git repository @ Eclipse
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../.." title="Home" class="md-nav__link">
Home
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-2" type="checkbox" id="nav-2">
<label class="md-nav__link" for="nav-2">
Basic use
</label>
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
<label class="md-nav__title" for="nav-2">
Basic use
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../basic-use/installation/" title="Installation" class="md-nav__link">
Installation
</a>
</li>
<li class="md-nav__item">
<a href="../../basic-use/core-concepts/" title="Core concepts" class="md-nav__link">
Core concepts
</a>
</li>
<li class="md-nav__item">
<a href="../../basic-use/examples-xmi/" title="Examples (XMI)" class="md-nav__link">
Examples (XMI)
</a>
</li>
<li class="md-nav__item">
<a href="../../basic-use/examples-modelio/" title="Examples (Modelio)" class="md-nav__link">
Examples (Modelio)
</a>
</li>
<li class="md-nav__item">
<a href="../../basic-use/papyrus/" title="Papyrus UML support" class="md-nav__link">
Papyrus UML support
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3" checked>
<label class="md-nav__link" for="nav-3">
Advanced use
</label>
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
<label class="md-nav__title" for="nav-3">
Advanced use
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../graph-as-emf/" title="Graph as EMF model" class="md-nav__link">
Graph as EMF model
</a>
</li>
<li class="md-nav__item">
<a href="../advanced-props/" title="Advanced properties" class="md-nav__link">
Advanced properties
</a>
</li>
<li class="md-nav__item">
<a href="../meta-queries/" title="Meta-level queries" class="md-nav__link">
Meta-level queries
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
Temporal queries
</label>
<a href="./" title="Temporal queries" class="md-nav__link md-nav__link--active">
Temporal queries
</a>
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="__toc">Table of contents</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#data-model" class="md-nav__link">
Data model
</a>
</li>
<li class="md-nav__item">
<a href="#basic-history-traversal-primitives" class="md-nav__link">
Basic history traversal primitives
</a>
</li>
<li class="md-nav__item">
<a href="#temporal-assertions" class="md-nav__link">
Temporal assertions
</a>
</li>
<li class="md-nav__item">
<a href="#scoping-views-predicate-based" class="md-nav__link">
Scoping views (predicate-based)
</a>
</li>
<li class="md-nav__item">
<a href="#scoping-views-context-based" class="md-nav__link">
Scoping views (context-based)
</a>
</li>
<li class="md-nav__item">
<a href="#scoping-views-based-on-derived-attributes" class="md-nav__link">
Scoping views (based on derived attributes)
</a>
</li>
<li class="md-nav__item">
<a href="#global-operations-on-the-model" class="md-nav__link">
Global operations on the model
</a>
</li>
<li class="md-nav__item">
<a href="#some-examples" class="md-nav__link">
Some examples
</a>
</li>
<li class="md-nav__item">
<a href="#timeline-queries" class="md-nav__link">
Timeline queries
</a>
</li>
<li class="md-nav__item">
<a href="#current-limitations" class="md-nav__link">
Current limitations
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../oomph/" title="Oomph and Hawk" class="md-nav__link">
Oomph and Hawk
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4">
<label class="md-nav__link" for="nav-4">
Server
</label>
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
<label class="md-nav__title" for="nav-4">
Server
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../server/architecture/" title="Architecture" class="md-nav__link">
Architecture
</a>
</li>
<li class="md-nav__item">
<a href="../../server/api/" title="Thrift API" class="md-nav__link">
Thrift API
</a>
</li>
<li class="md-nav__item">
<a href="../../server/api-security/" title="Thrift API security" class="md-nav__link">
Thrift API security
</a>
</li>
<li class="md-nav__item">
<a href="../../server/deployment/" title="Deployment" class="md-nav__link">
Deployment
</a>
</li>
<li class="md-nav__item">
<a href="../../server/cli/" title="Console client" class="md-nav__link">
Console client
</a>
</li>
<li class="md-nav__item">
<a href="../../server/eclipse/" title="Eclipse client" class="md-nav__link">
Eclipse client
</a>
</li>
<li class="md-nav__item">
<a href="../../server/file-config/" title="File-based configuration" class="md-nav__link">
File-based configuration
</a>
</li>
<li class="md-nav__item">
<a href="../../server/logging/" title="Logging" class="md-nav__link">
Logging
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5">
<label class="md-nav__link" for="nav-5">
Developers
</label>
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
<label class="md-nav__title" for="nav-5">
Developers
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../developers/run-from-source/" title="Run GUI from source" class="md-nav__link">
Run GUI from source
</a>
</li>
<li class="md-nav__item">
<a href="../../developers/server-from-source/" title="Run Server from source" class="md-nav__link">
Run Server from source
</a>
</li>
<li class="md-nav__item">
<a href="../../developers/plain-maven/" title="Build with plain Maven" class="md-nav__link">
Build with plain Maven
</a>
</li>
<li class="md-nav__item">
<a href="../../developers/website/" title="Work on the website" class="md-nav__link">
Work on the website
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-6" type="checkbox" id="nav-6">
<label class="md-nav__link" for="nav-6">
Community
</label>
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
<label class="md-nav__title" for="nav-6">
Community
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="https://www.eclipse.org/forums/index.php/f/442/" title="Forum" class="md-nav__link">
Forum
</a>
</li>
<li class="md-nav__item">
<a href="https://gitlab.eclipse.org/eclipse/hawk/hawk/-/issues/new" title="File a bug" class="md-nav__link">
File a bug
</a>
</li>
<li class="md-nav__item">
<a href="https://gitlab.eclipse.org/eclipse/hawk/hawk/-/issues" title="Open bugs" class="md-nav__link">
Open bugs
</a>
</li>
<li class="md-nav__item">
<a href="https://ci.eclipse.org/hawk/" title="Builds" class="md-nav__link">
Builds
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../additional-resources/" title="Additional resources" class="md-nav__link">
Additional resources
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="__toc">Table of contents</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#data-model" class="md-nav__link">
Data model
</a>
</li>
<li class="md-nav__item">
<a href="#basic-history-traversal-primitives" class="md-nav__link">
Basic history traversal primitives
</a>
</li>
<li class="md-nav__item">
<a href="#temporal-assertions" class="md-nav__link">
Temporal assertions
</a>
</li>
<li class="md-nav__item">
<a href="#scoping-views-predicate-based" class="md-nav__link">
Scoping views (predicate-based)
</a>
</li>
<li class="md-nav__item">
<a href="#scoping-views-context-based" class="md-nav__link">
Scoping views (context-based)
</a>
</li>
<li class="md-nav__item">
<a href="#scoping-views-based-on-derived-attributes" class="md-nav__link">
Scoping views (based on derived attributes)
</a>
</li>
<li class="md-nav__item">
<a href="#global-operations-on-the-model" class="md-nav__link">
Global operations on the model
</a>
</li>
<li class="md-nav__item">
<a href="#some-examples" class="md-nav__link">
Some examples
</a>
</li>
<li class="md-nav__item">
<a href="#timeline-queries" class="md-nav__link">
Timeline queries
</a>
</li>
<li class="md-nav__item">
<a href="#current-limitations" class="md-nav__link">
Current limitations
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset">
<h1>Temporal queries</h1>
<p>The latest versions of Hawk have the capability to index every version of all the models in the locations being monitored. To enable this capability, your Hawk index must meet certain conditions:</p>
<ul>
<li>You must be using a time-aware backend (currently, Greycat).</li>
<li>You must be using the time-aware updater (TimeAwareModelUpdater) and not the standard one.</li>
<li>You must be using the time-aware indexer factory and not the standard one (TimeAwareHawkFactory).</li>
<li>You must query the index with a time-aware query language:</li>
<li><code>org.hawk.timeaware.queries.TimeAwareEOLQueryEngine</code></li>
<li><code>org.hawk.timeaware.queries.TimelineEOLQueryEngine</code></li>
</ul>
<p>If you meet these constraints, you can index a SVN repository with models and Hawk will turn the full history of every model into an integrated temporal graph database, or index a workspace/local folder and have Hawk remember the history of every model from then onwards. You will be able to query this temporal graph through an extension of Hawk's EOL dialect.</p>
<p>This functionality was first discussed in our <a href="http://st.inf.tu-dresden.de/MRT18/">MRT 2018</a> paper, "Reflecting on the past and the present with temporal graph-based models".</p>
<h2 id="data-model">Data model<a class="headerlink" href="#data-model" title="Permanent link">&para;</a></h2>
<p>The usual type -&gt; model element graph in Hawk is extended to give both types and model elements their own histories. The histories are defined as follows:</p>
<ul>
<li>Types are immortal: they are created at the first endpoint in the graph and last to the "end of time" of the graph. There is a new version whenever an instance of the type is created or destroyed.</li>
<li>Model elements are created at a certain timepoint, and either survive or are destroyed at another timepoint. Model elements are assumed to have a persistent identity: either its natural/artificial identifier, or its location within the model. New versions are produced when an attribute or a reference changes.</li>
</ul>
<p>Timepoints are provided by the Hawk connectors, and they tend to be commit timestamps or file timestamps. In SVN, these are commit timestamps to millisecond precision.</p>
<h2 id="basic-history-traversal-primitives">Basic history traversal primitives<a class="headerlink" href="#basic-history-traversal-primitives" title="Permanent link">&para;</a></h2>
<p>The actual primitives are quite simple. In the time-aware dialect of Hawk, types and model elements expose the following additional attributes and operations:</p>
<ul>
<li><code>x.versions</code>: returns the sequence of all versions for <code>x</code>, from newest to oldest</li>
<li><code>x.getVersionsBetween(from, to)</code>: versions within a range of timepoints</li>
<li><code>x.getVersionsFrom(from)</code>: versions from a timepoint (included)</li>
<li><code>x.getVersionsUpTo(from)</code>: versions up to a timepoint (included) </li>
<li><code>x.earliest</code>, <code>x.latest</code>: earliest / latest version</li>
<li><code>x.next</code>, <code>x.prev</code>/<code>x.previous</code>: next / previous version</li>
<li><code>x.time</code>: version timepoint</li>
</ul>
<h2 id="temporal-assertions">Temporal assertions<a class="headerlink" href="#temporal-assertions" title="Permanent link">&para;</a></h2>
<p>It is possible to evaluate assertions over the history of a type or model element:</p>
<ul>
<li><code>x.always(version | predicate over version)</code>: true if and only if ("iff") the predicate is true for every version of <code>x</code>.</li>
<li><code>x.never(version | predicate over version)</code>: true iff the predicate is false for every version of <code>x</code>.</li>
<li><code>x.eventually(version | predicate over version)</code>: true iff the predicate is true for some version of <code>x</code>.</li>
<li><code>x.eventuallyAtLeast(version | predicate over version, count)</code>: true iff the predicate is true in at least <code>count</code> versions of <code>x</code>.</li>
<li><code>x.eventuallyAtMost(version | predicate over version, count)</code>: true iff the predicate is true in at least one version and at most <code>count</code> versions of <code>x</code>.</li>
</ul>
<h2 id="scoping-views-predicate-based">Scoping views (predicate-based)<a class="headerlink" href="#scoping-views-predicate-based" title="Permanent link">&para;</a></h2>
<p>The versions in scope for the above assertions and primitives can be limited with:</p>
<ul>
<li><code>x.since(version | predicate over version)</code> will return the type/model element in the oldest timepoint since that of <code>x</code> for which the predicate holds, or <code>null</code> if it does not exist. The returned type/model element will only report versions from its timepoint onwards. This esentially imposes a left-closed version interval.</li>
<li><code>x.after(version | predicate over version)</code> will return the type/model element in the timepoint immediately after the oldest timepoint for which the predicate holds, or <code>null</code> if it does not exist. It is essentially a variant of <code>x.since</code> that implements a left-open interval.</li>
<li><code>x.until(version | predicate over version)</code> will return the the same type/model element, but it will only report versions up to and including the first one for which the predicate holds, or <code>null</code> if such a version does not exist. This implements a right-closed version interval.</li>
<li><code>x.before(version | predicate over version)</code> will return the same type/model element, but it will only report versions before (excluding) the first one for which the predicate holds, or <code>null</code> if such a version does not exist. This implements a right-open interval.</li>
<li><code>x.when(version | predicate over version)</code> will return the type/model element in the oldest timepoint since that of <code>x</code> for which the predicate holds, or <code>null</code> if it does not exist. The returned type/model element will only report versions from its timepoint onwards that match the predicate. This is a left-closed, filtered interval.</li>
</ul>
<h2 id="scoping-views-context-based">Scoping views (context-based)<a class="headerlink" href="#scoping-views-context-based" title="Permanent link">&para;</a></h2>
<p>You can also limit the available versions from an existing type / model element:</p>
<ul>
<li><code>x.sinceThen</code>: version of <code>x</code> that will only report the versions from <code>x</code> onwards (included).</li>
<li><code>x.afterThen</code>: next version of <code>x</code> that will only report the versions after <code>x</code> (excluded). <code>null</code> if a next version does not exist.</li>
<li><code>x.untilThen</code>: version of <code>x</code> that will only report the versions up to <code>x</code> (included).</li>
<li><code>x.beforeThen</code>: previous version of <code>x</code> that will only report the versions before <code>x</code> (excluded). <code>null</code> if a previous version does not exist.</li>
</ul>
<p>You can undo the scoping with <code>.unscoped</code>. This will give you the same model element or type, but with all the versions available once more.</p>
<h2 id="scoping-views-based-on-derived-attributes">Scoping views (based on derived attributes)<a class="headerlink" href="#scoping-views-based-on-derived-attributes" title="Permanent link">&para;</a></h2>
<p>Some of the events we may be interested in may be very rare. In long histories, it may be very expensive to find such rare events by iterating over all the versions of a model element. In these cases, it is possible to define a derived Boolean attribute (e.g. <code>HasManyChildren</code> for a <code>Tree</code>, with definiton <code>return self.children.size &gt; 100;</code>) on a type, and then use these additional operations:</p>
<ul>
<li><code>x.whenAnnotated('AttributeName')</code>: returns a view of the model element <code>x</code> that exposes all the versions when the derived attribute named <code>AttributeName</code> defined on the type of <code>x</code> was <code>true</code>. The view will be at the earliest timepoint when this happened.</li>
<li><code>x.sinceAnnotated('AttributeName')</code>: equivalent to <code>since</code>, but using the derived attribute <code>AttributeName</code>.</li>
<li><code>x.afterAnnotated('AttributeName')</code>: equivalent to <code>after</code>. See above.</li>
<li><code>x.untilAnnotated('AttributeName')</code>: equivalent to <code>until</code>. See above.</li>
<li><code>x.beforeAnnotated('AttributeName')</code>: equivalent to <code>before</code>. See above.</li>
</ul>
<p><em>IMPORTANT</em>: until <a href="/mondo-project/mondo-hawk/issues/83">#83</a> is resolved, you will need to define these derived attributes <em>before</em> you index any model versions.</p>
<h2 id="global-operations-on-the-model">Global operations on the model<a class="headerlink" href="#global-operations-on-the-model" title="Permanent link">&para;</a></h2>
<p>The <code>Model</code> global reference is extended with new operations:</p>
<ul>
<li><code>Model.allInstancesNow</code> returns all instances of the model at the timepoint equal to current system time.</li>
<li><code>Model.allInstancesAt(timepoint)</code> returns all instances of the model at the specified timepoint, measured in the integer amount of milliseconds elapsed since the epoch.</li>
<li><code>Model.getRepository(object)</code> will return a node representing the repository (VCS) that the object belongs to at its current timepoint. From the returned node, you may retrieve the <code>.revision</code> (SVN revision, folder timestamp or Git SHA-1), and the <code>.message</code> associated with the corresponding revision.</li>
</ul>
<h2 id="some-examples">Some examples<a class="headerlink" href="#some-examples" title="Permanent link">&para;</a></h2>
<p>A simple query to find the number of instances of X in the latest version of the model would be:</p>
<div class="codehilite"><pre><span></span><code>return X.latest.all.size;
</code></pre></div>
<p>If we want to do find the second last time that instances of X were created, we could write something like:</p>
<div class="codehilite"><pre><span></span><code>return X.latest.prev.time;
</code></pre></div>
<p>If we want to find an X that at some point had <code>y</code> greater than 0 and still survives to the latest revision, we could write something like:</p>
<div class="codehilite"><pre><span></span><code>return X.latest.all.select(x|x.versions.exists(vx|vx.y &gt; 0));
</code></pre></div>
<p>More advanced queries can be found in the <a href="https://gitlab.com/a.garcia-dominguez/hawk-mrt2018/tree/master/code/uk.ac.aston.mrt2018.queries">Git repository for the MRT 2018 experiment tool</a>.</p>
<h2 id="timeline-queries">Timeline queries<a class="headerlink" href="#timeline-queries" title="Permanent link">&para;</a></h2>
<p>If you want to obtain the results of a certain query for all versions of a model, you can use the TimelineEOLQueryEngine instead. This operates by repeating the same query while changing the global timepoint of the graph, so you can write your query as a normal one and see how it evolves over time. For instance, if using <code>return Model.allInstances.size;</code>, you would see how the number of instances evolved over the various versions of the graph.</p>
<p>NOTE: due to current implementation restrictions, this will only process versions where type nodes changed (i.e. objects were created or deleted). We plan to lift this restriction in the near future.</p>
<h2 id="current-limitations">Current limitations<a class="headerlink" href="#current-limitations" title="Permanent link">&para;</a></h2>
<ul>
<li>Subtree contexts, file-first/derived allOf and traversal scoping are not yet implemented for this query engine. File/repository patterns <em>do</em> work.</li>
<li>Derived features will only work if added before any VCSes are added, and the impact of adding multiple VCS with their own histories has not been tested yet. Please make sure to report any issues!</li>
</ul>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="../meta-queries/" title="Meta-level queries" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Meta-level queries
</span>
</div>
</a>
<a href="../oomph/" title="Oomph and Hawk" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
Oomph and Hawk
</span>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
Copyright © Eclipse Foundation, Inc. All Rights Reserved.
</div>
powered by
<a href="https://www.mkdocs.org">MkDocs</a>
and
<a href="https://squidfunk.github.io/mkdocs-material/">Material for MkDocs</a>
</div>
<div class="md-footer-copyright hawk-eclipse-links">
<ul>
<li><a href="https://www.eclipse.org/legal/privacy.php">Privacy Policy</a></li>
<li><a href="https://www.eclipse.org/legal/termsofuse.php">Terms of Use</a></li>
<li><a href="https://www.eclipse.org/legal/copyright.php">Copyright Agent</a></li>
</ul>
</div>
</div>
</div>
</footer>
</div>
<script src="../../assets/javascripts/application.c648116f.js"></script>
<script>app.initialize({version:"1.0.4",url:{base:"../.."}})</script>
</body>
</html>