blob: 3045bf2027719909b6d41fa56a0a2c2c0e112042 [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>Core concepts - 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=#core-concepts-and-general-usage 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=../../img/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> Core concepts </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=../../img/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--active md-nav__item--nested"> <input class="md-toggle md-nav__toggle" data-md-toggle=nav-2 type=checkbox id=nav-2 checked> <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=../installation/ title=Installation class=md-nav__link> Installation </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> Core concepts </label> <a href=./ title="Core concepts" class="md-nav__link md-nav__link--active"> Core concepts </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=#components class=md-nav__link> Components </a> </li> <li class=md-nav__item> <a href=#general-usage class=md-nav__link> General usage </a> </li> <li class=md-nav__item> <a href=#managing-indexes-with-the-hawk-view class=md-nav__link> Managing indexes with the Hawk view </a> </li> <li class=md-nav__item> <a href=#creating-a-new-index class=md-nav__link> Creating a new index </a> </li> <li class=md-nav__item> <a href=#managing-metamodels class=md-nav__link> Managing metamodels </a> </li> <li class=md-nav__item> <a href=#managing-repositories class=md-nav__link> Managing repositories </a> </li> <li class=md-nav__item> <a href=#managing-indexed-attributes class=md-nav__link> Managing indexed attributes </a> </li> <li class=md-nav__item> <a href=#managing-derived-attributes class=md-nav__link> Managing derived attributes </a> </li> <li class=md-nav__item> <a href=#querying-the-graph class=md-nav__link> Querying the graph </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../examples-xmi/ title="Examples (XMI)" class=md-nav__link> Examples (XMI) </a> </li> <li class=md-nav__item> <a href=../examples-modelio/ title="Examples (Modelio)" class=md-nav__link> Examples (Modelio) </a> </li> <li class=md-nav__item> <a href=../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--nested"> <input class="md-toggle md-nav__toggle" data-md-toggle=nav-3 type=checkbox id=nav-3> <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=../../advanced-use/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-use/advanced-props/ title="Advanced properties" class=md-nav__link> Advanced properties </a> </li> <li class=md-nav__item> <a href=../../advanced-use/meta-queries/ title="Meta-level queries" class=md-nav__link> Meta-level queries </a> </li> <li class=md-nav__item> <a href=../../advanced-use/temporal-queries/ title="Temporal queries" class=md-nav__link> Temporal queries </a> </li> <li class=md-nav__item> <a href=../../advanced-use/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> <a href=../../additional-resources/ title="Additional resources" class=md-nav__link> Additional resources </a> </li> <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://ci.eclipse.org/hawk/ title=Builds class=md-nav__link> Builds </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=#components class=md-nav__link> Components </a> </li> <li class=md-nav__item> <a href=#general-usage class=md-nav__link> General usage </a> </li> <li class=md-nav__item> <a href=#managing-indexes-with-the-hawk-view class=md-nav__link> Managing indexes with the Hawk view </a> </li> <li class=md-nav__item> <a href=#creating-a-new-index class=md-nav__link> Creating a new index </a> </li> <li class=md-nav__item> <a href=#managing-metamodels class=md-nav__link> Managing metamodels </a> </li> <li class=md-nav__item> <a href=#managing-repositories class=md-nav__link> Managing repositories </a> </li> <li class=md-nav__item> <a href=#managing-indexed-attributes class=md-nav__link> Managing indexed attributes </a> </li> <li class=md-nav__item> <a href=#managing-derived-attributes class=md-nav__link> Managing derived attributes </a> </li> <li class=md-nav__item> <a href=#querying-the-graph class=md-nav__link> Querying the graph </a> </li> </ul> </nav> </div> </div> </div> <div class=md-content> <article class="md-content__inner md-typeset"> <h1 id=core-concepts-and-general-usage>Core concepts and general usage<a class=headerlink href=#core-concepts-and-general-usage title="Permanent link">&para;</a></h1> <h2 id=components>Components<a class=headerlink href=#components title="Permanent link">&para;</a></h2> <p>Hawk is an extensible system. Currently, it contains the following kinds of components:</p> <table> <thead> <tr> <th>Type</th> <th>Role</th> <th>Current implementations</th> </tr> </thead> <tbody> <tr> <td>Change listeners</td> <td>React to changes in the graph produced by the updaters</td> <td>Tracing, Validation</td> </tr> <tr> <td>Graph backends</td> <td>Integrate database technologies</td> <td><a href=http://neo4j.com/ >Neo4j</a>, <a href=http://orientdb.com/ >OrientDB</a>, <a href=https://greycat.ai/doc/ >Greycat</a></td> </tr> <tr> <td>Model drivers</td> <td>Integrate modelling technologies</td> <td><a href=https://eclipse.org/modeling/emf/ >Ecore</a>, <a href=http://www.bpmn.org/ >BPMN</a>, <a href=https://www.modelio.org/ >Modelio</a>, <a href=http://www.buildingsmart-tech.org/specifications/ifc-overview>IFC2x3/IFC4</a> in <a href=https://github.com/mondo-project/mondo-hawk-ifc>this repo</a>, and <a href=https://wiki.eclipse.org/MDT/UML2>UML2</a></td> </tr> <tr> <td>Query languages</td> <td>Translate high-level queries into efficient graph queries</td> <td><a href=http://www.eclipse.org/epsilon/doc/eol/ >Epsilon Object Language</a>, <a href=https://www.eclipse.org/epsilon/doc/epl/ >Epsilon Pattern Language</a>, <a href=https://orientdb.com/docs/2.2/SQL.html>OrientDB SQL</a></td> </tr> <tr> <td>Updaters</td> <td>Update the graph based on the detected changes in the models and metamodels</td> <td>Built-in</td> </tr> <tr> <td>VCS managers</td> <td>Integrate file-based model repositories</td> <td>Local folders, <a href=https://subversion.apache.org/ >SVN</a> repos, Eclipse workspaces, HTTP files</td> </tr> </tbody> </table> <h2 id=general-usage>General usage<a class=headerlink href=#general-usage title="Permanent link">&para;</a></h2> <p>Using Hawk generally involves these steps:</p> <ol> <li>Create a new Hawk index, based on a specific backend (e.g. Neo4j or OrientDB).</li> <li>Add the required metamodels to the index.</li> <li>Add the model repositories to be monitored.</li> <li>Wait for the initial batch insert (may take some time in large repositories).</li> <li>Add the desired indexed and derived attributes.</li> <li>Perform fast and efficient queries on the graph, using one of the supported query languages (see table above).</li> </ol> <p>In the following sections, we will show how to perform these steps.</p> <h2 id=managing-indexes-with-the-hawk-view>Managing indexes with the Hawk view<a class=headerlink href=#managing-indexes-with-the-hawk-view title="Permanent link">&para;</a></h2> <p>To manage and use Hawk indexes, first open the "Hawk" Eclipse view, using "Window &gt; Show View &gt; Other... &gt; Hawk &gt; Hawk". It should look like this:</p> <p><img alt="Hawk view in Eclipse" src=../img/hawk_view.png></p> <p>Hawk indexes are queried and managed from this view. From left to right, the buttons are:</p> <ul> <li>Query: opens the query dialog.</li> <li>Run: starts a Hawk index if it was stopped.</li> <li>Stop: stops a Hawk index if it was running.</li> <li>Sync: request the Hawk index to check the indexed repositories immediately.</li> <li>Delete: removes an index from the Hawk view, without deleting the actual database (it can be usually recovered later using the "Import" button). To remove a local index completely, select it and press <code>Shift+Delete</code>.</li> <li>New: creates a new index (more info below).</li> <li>Import: imports a Hawk index from a factory. Hawk itself only provides a "local" factory that looks at the subdirectories of the current Eclipse workspace.</li> <li>Configure: opens the index configuration dialog, which allows for managing the registered metamodels, the repositories to be indexed, the attributes to be derived and the attributes to be indexed.</li> </ul> <h2 id=creating-a-new-index>Creating a new index<a class=headerlink href=#creating-a-new-index title="Permanent link">&para;</a></h2> <p>To create a new index, open the Hawk view and use the "New" button to open this dialog:</p> <p><img alt="New Hawk index creation dialog" src=../img/new_hawk.png></p> <p>The dialog requires these fields:</p> <ul> <li>Name: a descriptive name for the index. Only used as an identifier.</li> <li>Instance type: Hawk only supports local instances, but <a href=https://github.com/mondo-project/mondo-integration>mondo-integration</a> can add support for remote instances.</li> <li>Local storage folder: folder that will store the actual database. If the folder exists, Hawk will reuse that database instead of creating a new one.</li> <li>Remote location: only used for the remote instances in <code>mondo-integrtion</code>.</li> <li>Enabled plugins: list of plugins that are currently enabled in Hawk.</li> <li>Back-end: database backend to be used (currently either Neo4j or OrientDB).</li> <li>Min/max delay: minimum and maximum delays in milliseconds between synchronisations. Hawk will start at the minimum value: every time it does not find any changes, it will double the delay up to the maximum value. If it finds a change, it will reset back to the minimum value. Periodic synchronisation can be completely disabled by changing the minimum and maximum delays to 0: in this mode, Hawk will only synchronise on startup, when a repository is added or when the user requests it manually.</li> </ul> <p>Once these fields have been filled in, Hawk will create and set up the index in a short period.</p> <h2 id=managing-metamodels>Managing metamodels<a class=headerlink href=#managing-metamodels title="Permanent link">&para;</a></h2> <p>After creating the index, the next step is to register the metamodels of the models that are going to be indexed. To do this, select the index in the Hawk view and either double click it or click on the "Configure" button. The configure dialog will open:</p> <p><img alt="Hawk configure dialog" src=../img/hawk_metamodels.png></p> <p>The configure dialog has several tabs. For managing metamodels, we need to go to the "Metamodels" tab. It will list the URIs of the currently registered metamodels. If a metamodel we need is not listed there, we can use the "Add" button to provide Hawk with the appropriate file to be indexed (e.g. the <code>.ecore</code> file for EMF-based models, or the <code>metamodel-descriptor.xml</code> for Modelio-based models). We can also "Remove" metamodels: this will remove all dependent models and metamodels as well.</p> <p>To try out Hawk, we recommend adding the <a href=https://raw.githubusercontent.com/mondo-project/mondo-hawk/master/org.hawk.emf/src/org/hawk/emf/metamodel/examples/single/JDTAST.ecore>JDTAST.ecore</a> metamodel, which was used in the <a href=http://www.emn.fr/z-info/atlanmod/index.php/GraBaTs_2009_Case_Study>GraBaTs 2009 case study from AtlanMod</a>. For Modelio metamodels, use the <a href=https://github.com/mondo-project/mondo-hawk/raw/master/tests/org.hawk.modelio.exml.tests/resources/metamodel/metamodel_descriptor.xml>metamodel-descriptor.xml</a> for Modelio 3.6 projects (for older projects, use the older descriptors included as <code>metamodel_*.xml</code> files in the Modelio 3.6 <a href=http://forge.modelio.org/projects/modelio3-development-app/files>sources</a>).</p> <p>Keep in mind that metamodels may have dependencies to others. You will need to either add all metamodels at once, or add each metamodel after those it depends upon. If adding all the metamodels at once, Hawk will rearrange their addition taking into account their mutual dependencies.</p> <p><em>Note:</em> the EMF driver can parse regular Ecore metamodels with the <code>.ecore</code> extension.</p> <p><em>Note:</em> regarding the Modelio <code>metamodel-descriptor.xml</code> files, you can find those as part of the <a href=http://forge.modelio.org/projects/modelio3-development-app/repository/show/branches/modelio3.7/platform.core/metamodel.implementation/res/migration>Modelio source code</a>.</p> <h2 id=managing-repositories>Managing repositories<a class=headerlink href=#managing-repositories title="Permanent link">&para;</a></h2> <p>Having added the metamodels of the models to be indexed, the following step is to add the repositories to be indexed. To do so, go to the "Indexed Locations" tab of the Hawk configure dialog, and use the "Add" button. Hawk will present the following dialog:</p> <p><img alt="Hawk add repository dialog" src=../img/hawk_add_repo.png></p> <p>The fields to be used are as follows:</p> <ul> <li>Type: type of repository to be indexed.</li> <li>Location: URL or path to the repository. For local folders, it is recommended to use the "Browse..." button to produce the adequate <code>file://</code> URL. For SVN, it is best to copy and paste the full URL. Finally, the location is irrelevant for workspace repositories: selecting any directory from "Browse..." will work just the same.</li> <li>User + pass: for private SVN repositories, these will be the username and password to be used to connect to the repository. Hawk will store the password on the Eclipse secure storage.</li> </ul> <p>To try out Hawk, after adding the <code>JDTAST.ecore</code> metamodel from the previous section, we recommend adding a folder with a copy of the <a href=http://docatlanmod.emn.fr/GraBaTs/set0.xmi>set0.xmi</a> file. It has around 70k model elements. To watch over the indexing process, look at the "Error Log" view or run Eclipse with the <code>-console</code> option.</p> <p>The supported file extensions are as follows:</p> <table> <thead> <tr> <th>Driver</th> <th>Extensions</th> </tr> </thead> <tbody> <tr> <td>EMF</td> <td><code>.xmi</code>, <code>.model</code>, any extensions in the EMF extension factory map that use <code>XMIResourceFactoryImpl</code>, any extensions mentioned through the <code>org.hawk.emf.model.extraExtensions</code> Java system property (e.g. <code>-Dorg.hawk.emf.model.extraExtensions=.railway,.rail</code>).</td> </tr> <tr> <td>UML2</td> <td><code>.uml</code>. <code>.profile.uml</code> files can be indexed normally and also registered as metamodels.</td> </tr> <tr> <td>BPMN</td> <td><code>.bpmn</code>, <code>.bpmn2</code>.</td> </tr> <tr> <td>Modelio</td> <td><code>.exml</code>, <code>.ramc</code>. Parses <code>mmversion.dat</code> internally for metadata.</td> </tr> <tr> <td>IFC</td> <td><code>.ifc</code>, <code>.ifcxml</code>, <code>.ifc.txt</code>, <code>.ifcxml.txt</code>, <code>.ifc.zip</code>, <code>.ifczip</code>.</td> </tr> </tbody> </table> <h2 id=managing-indexed-attributes>Managing indexed attributes<a class=headerlink href=#managing-indexed-attributes title="Permanent link">&para;</a></h2> <p>Simply indexing the models into the graph will already speed up considerably some common queries, such as finding all the instances of a type: in Hawk, this is done through direct edge traversal instead of going through the entire model. However, queries that filter model elements through the value of their attributes will need additional indexing to be set up.</p> <p>For instance, if we wanted to speed up <code>return Class.all.selectOne(c|c.name='MyClass');</code> (which returns the class named "MyClass"), we would need to index the <code>name</code> attribute in the <code>Class</code> type. To do so, we need to go to the Hawk configure dialog, select the "Indexed Attributes" tab and press the "Add" button. This dialog will open:</p> <p><img alt="Hawk dialog for adding indexed attributes" src=../img/hawk_add_indexed.png></p> <p>Its fields are as follows:</p> <ul> <li>Metamodel URI: the URI of the metamodel that has the type we want.</li> <li>Type Name: the name of the type (here "Class").</li> <li>Attribute Name: the name of the attribute to be indexed (here "name").</li> </ul> <p>Please allow some time after the dialog is closed to have Hawk generate the index.</p> <p>Currently, Hawk can index attributes with strings, booleans and numbers. Indexing will speed up not only <code>=</code>, but also <code>&gt;</code> and all the other relational operators.</p> <h2 id=managing-derived-attributes>Managing derived attributes<a class=headerlink href=#managing-derived-attributes title="Permanent link">&para;</a></h2> <p>Sometimes we will need to filter model elements through a piece of information that is not directly stored among its attributes, but is rather computed from them. To speed up the process, Hawk can keep precompute these derived attributes in the graph, keeping them up to date and indexing them. For instance, if we wanted to quickly filter UML classes by their number of operations, we would go to the Hawk configure dialog, select the "Derived Attributes" tab and click on the "Add" button. This dialog would appear:</p> <p><img alt="Hawk dialog for adding derived attributes" src=../img/hawk_add_derived.png></p> <p>The fields are as follows:</p> <ul> <li>Metamodel URI: the URI of the metamodel with the type to be extended.</li> <li>Type Name: the name of the type we are going to extend.</li> <li>Attribute Name: the name of the new derived attribute (should be unique).</li> <li>Attribute Type: the type of the new derived attribute.</li> <li>isMany: true if this is a collection of values, false otherwise.</li> <li>isOrdered: true if this is an ordered collection of values, false otherwise.</li> <li>isUnique: true if the value should provide a unique identifier, false otherwise.</li> <li>Derivation Language: query language that the derivation logic will be written on. <a href=http://www.eclipse.org/epsilon/doc/eol/ >EOL</a> is the default choice.</li> <li>Derivation Logic: expression in the chosen language that will compute the value. Hawk provides the <code>self</code> variable to access the model element being extended.</li> </ul> <p>For this particular example, we'd set the fields like this:</p> <ul> <li>Metamodel URI: the URI of the UML metamodel.</li> <li>Type Name: Class.</li> <li>Attribute Name: ownedOperationCount.</li> <li>Attribute Type: Integer.</li> <li>isMany, isOrdered, isUnique: false.</li> <li>Derivation Language: EOLQueryEngine.</li> <li>Derivation Logic: <code>return self.ownedOperation.size;</code>.</li> </ul> <p>After pressing OK, Hawk will spend some time computing the derived attribute and indexing the value. After that, queries such as <code>return Class.all.select(c|c.ownedOperationCount &gt; 20);</code> will complete much faster.</p> <h2 id=querying-the-graph>Querying the graph<a class=headerlink href=#querying-the-graph title="Permanent link">&para;</a></h2> <p>To query the indexed models, use the "Query" button of the Hawk view. This dialog will open:</p> <p><img alt="Hawk query dialog" src=../img/query_hawk.png></p> <p>The actual query can be entered through the "Query" field manually, or loaded from a file using the "Query File" button. The query should be written in the language selected in "Query Engine". The scope of the query can be limited using the "Context Repositories" and "Context Files" fields: for instance, using <code>set1.xmi</code> on the "Context Files" field would limit it to the contents of the <code>set1.xmi</code> file.</p> <p>Running the query with "Run Query" button will place the results on the "Result" field.</p> </article> </div> </div> </main> <footer class=md-footer> <div class=md-footer-nav> <nav class="md-footer-nav__inner md-grid"> <a href=../installation/ title=Installation 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> Installation </span> </div> </a> <a href=../examples-xmi/ title="Examples (XMI)" 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> Examples (XMI) </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>