<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dev.simantics.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Teemu+M%C3%A4t%C3%A4sniemi</id>
	<title>Developer Documents - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://dev.simantics.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Teemu+M%C3%A4t%C3%A4sniemi"/>
	<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php/Special:Contributions/Teemu_M%C3%A4t%C3%A4sniemi"/>
	<updated>2026-04-05T22:55:06Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3359</id>
		<title>Check list: Model browser contributions</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3359"/>
		<updated>2017-07-03T13:18:29Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: /* Step 2: Implementation Plug-in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To avoid typical errors while defining ontology contributions to model browser follow the following check list:&lt;br /&gt;
&lt;br /&gt;
== Step 1: Ontology Plug-in ==&lt;br /&gt;
Define an ontology plugin (org.mylib.ontology)&lt;br /&gt;
&lt;br /&gt;
Define dependencies from Simantics plugins in MANIFEST.MF/Dependencies/Required Plug-ins&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;org.simantics.layer0&lt;br /&gt;
org.simantics.modeling.ontology&lt;br /&gt;
org.simantics.viewpoint.ontology&lt;br /&gt;
org.simantics.action.ontology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Include the following definitions into your ontology file (*.pgraph)&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;L0 = &amp;lt;http://www.simantics.org/Layer0-1.1&amp;gt;&lt;br /&gt;
VP = &amp;lt;http://www.simantics.org/Viewpoint-1.2&amp;gt;&lt;br /&gt;
ACT = &amp;lt;http://www.simantics.org/Action-1.1&amp;gt;&lt;br /&gt;
MOD = &amp;lt;http://www.simantics.org/Modeling-1.2&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new library (www.mylib.org) for your ontology under Simantics root (&#039;&#039;http://&#039;&#039;):&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_LIB = &amp;lt;http://www.mylib.org&amp;gt; : L0.Library&lt;br /&gt;
  @L0.new&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define your ontology  under the library and specify its ResourceClass&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_ONTOLOGY = &amp;lt;http://www.mylib.org/MyOntology-1.0&amp;gt; : L0.Ontology&lt;br /&gt;
  @L0.new&lt;br /&gt;
  L0.HasResourceClass &amp;quot;org.mylib.MyOntologyResource&amp;quot; : L0.String&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the Name property of ontology plugin in MANIFEST.MF/Overview/General Information. It has to match with URI (without version number) of your ontology.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Name: http://www.mylib.org/MyOntology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export the package (org.mylib) of ResourceClass in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
Define a new context and include it into MOD.ModelingActionContext&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC = MY_ONTOLOGY.MyActionContext : VP.BrowseContext&lt;br /&gt;
  VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new ActionContribution for each action in this context&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC&lt;br /&gt;
 VP.BrowseContext.HasActionContribution _ : VP.ActionContribution&lt;br /&gt;
  L0.HasLabel &amp;quot;My action...&amp;quot;        &lt;br /&gt;
  VP.ActionContribution.HasAction MY_ONTOLOGY.MyAction : ACT.Action&lt;br /&gt;
  VP.ActionContribution.HasNodeType&lt;br /&gt;
   L0.Entity&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 2: Implementation Plug-in ==&lt;br /&gt;
Define a plugin for implementation (org.mylib). Options: Generate an activator=checked, This plug-in will make contributions to the UI=checked.&lt;br /&gt;
&lt;br /&gt;
Define dependencies from Simantics plugins in MANIFEST.MF/Dependencies/Required Plug-ins&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;org.simantics.db.layer0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new package src/org.mylib.actions&lt;br /&gt;
&lt;br /&gt;
Define a new Java class MyAction.java under org.mylib.actions package&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;package org.mylib.actions;&lt;br /&gt;
import org.simantics.db.layer0.adapter.ActionFactory;&lt;br /&gt;
import org.simantics.db.Resource;&lt;br /&gt;
&lt;br /&gt;
public class MyAction implements ActionFactory {&lt;br /&gt;
    @Override&lt;br /&gt;
    public Runnable create(Object target) {&lt;br /&gt;
        if (!(target instanceof Resource))&lt;br /&gt;
            return null;&lt;br /&gt;
        final Resource res = (Resource) target;&lt;br /&gt;
        return new Runnable() {&lt;br /&gt;
            @Override&lt;br /&gt;
            public void run() {&lt;br /&gt;
                // TODO: put your code here&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
    }&lt;br /&gt;
} &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new file (adapters.xml) under implementation plugin to map URI (unversioned) of your action to Java class implementation. The content of the file is as follows:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;adapters&amp;gt;&lt;br /&gt;
    &amp;lt;target interface=&amp;quot;org.simantics.db.layer0.adapter.ActionFactory&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;resource&lt;br /&gt;
            uri=&amp;quot;http://www.mylib.org/MyOntology-0.0/MyAction&amp;quot;&lt;br /&gt;
            class=&amp;quot;org.mylib.actions.MyAction&amp;quot; /&amp;gt;       &lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/adapters&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check correctness of URI by Graph debugger to search a resource:&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.mylib.org/MyOntology-1.0/MyAction&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note! Use versioned URI (0.0 -&amp;gt; 1.0) while searching.&lt;br /&gt;
&lt;br /&gt;
Include adapters.xml into build configuration in MANIFEST.MF/Build/Binary Build. Also, include SCL packages and SCL modules if your use them in your implementation.&lt;br /&gt;
&lt;br /&gt;
Export the implementation package (org.mylib.actions) of MyAction.java in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
== Step 3: Product ==&lt;br /&gt;
Include the ontology and the implementation plugins into your product configuration (Debug Configurations/Plug-ins) and validate Plug-ins dependencies before running the product.&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3358</id>
		<title>Check list: Model browser contributions</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3358"/>
		<updated>2017-07-03T13:08:42Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: /* Step 2: Implementation Plug-in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To avoid typical errors while defining ontology contributions to model browser follow the following check list:&lt;br /&gt;
&lt;br /&gt;
== Step 1: Ontology Plug-in ==&lt;br /&gt;
Define an ontology plugin (org.mylib.ontology)&lt;br /&gt;
&lt;br /&gt;
Define dependencies from Simantics plugins in MANIFEST.MF/Dependencies/Required Plug-ins&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;org.simantics.layer0&lt;br /&gt;
org.simantics.modeling.ontology&lt;br /&gt;
org.simantics.viewpoint.ontology&lt;br /&gt;
org.simantics.action.ontology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Include the following definitions into your ontology file (*.pgraph)&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;L0 = &amp;lt;http://www.simantics.org/Layer0-1.1&amp;gt;&lt;br /&gt;
VP = &amp;lt;http://www.simantics.org/Viewpoint-1.2&amp;gt;&lt;br /&gt;
ACT = &amp;lt;http://www.simantics.org/Action-1.1&amp;gt;&lt;br /&gt;
MOD = &amp;lt;http://www.simantics.org/Modeling-1.2&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new library (www.mylib.org) for your ontology under Simantics root (&#039;&#039;http://&#039;&#039;):&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_LIB = &amp;lt;http://www.mylib.org&amp;gt; : L0.Library&lt;br /&gt;
  @L0.new&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define your ontology  under the library and specify its ResourceClass&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_ONTOLOGY = &amp;lt;http://www.mylib.org/MyOntology-1.0&amp;gt; : L0.Ontology&lt;br /&gt;
  @L0.new&lt;br /&gt;
  L0.HasResourceClass &amp;quot;org.mylib.MyOntologyResource&amp;quot; : L0.String&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the Name property of ontology plugin in MANIFEST.MF/Overview/General Information. It has to match with URI (without version number) of your ontology.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Name: http://www.mylib.org/MyOntology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export the package (org.mylib) of ResourceClass in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
Define a new context and include it into MOD.ModelingActionContext&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC = MY_ONTOLOGY.MyActionContext : VP.BrowseContext&lt;br /&gt;
  VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new ActionContribution for each action in this context&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC&lt;br /&gt;
 VP.BrowseContext.HasActionContribution _ : VP.ActionContribution&lt;br /&gt;
  L0.HasLabel &amp;quot;My action...&amp;quot;        &lt;br /&gt;
  VP.ActionContribution.HasAction MY_ONTOLOGY.MyAction : ACT.Action&lt;br /&gt;
  VP.ActionContribution.HasNodeType&lt;br /&gt;
   L0.Entity&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 2: Implementation Plug-in ==&lt;br /&gt;
Define a plugin for implementation (org.mylib). Options: Generate an activator=checked, This plug-in will make contributions to the UI=checked.&lt;br /&gt;
&lt;br /&gt;
Define dependencies from Simantics plugins in MANIFEST.MF/Dependencies/Required Plug-ins&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;org.simantics.db.layer0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a package src/org.mylib.actions&lt;br /&gt;
&lt;br /&gt;
Define a new Java class MyAction.java under org.mylib.actions package&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;package org.mylib.actions;&lt;br /&gt;
import org.simantics.db.layer0.adapter.ActionFactory;&lt;br /&gt;
import org.simantics.db.Resource;&lt;br /&gt;
&lt;br /&gt;
public class MyAction implements ActionFactory {&lt;br /&gt;
    @Override&lt;br /&gt;
    public Runnable create(Object target) {&lt;br /&gt;
        if (!(target instanceof Resource))&lt;br /&gt;
            return null;&lt;br /&gt;
        final Resource res = (Resource) target;&lt;br /&gt;
        return new Runnable() {&lt;br /&gt;
            @Override&lt;br /&gt;
            public void run() {&lt;br /&gt;
                // TODO: put your code here&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
    }&lt;br /&gt;
} &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new file (adapters.xml) under implementation plugin to map URI (unversioned) of your action to Java class implementation. The content of the file is as follows:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;adapters&amp;gt;&lt;br /&gt;
    &amp;lt;target interface=&amp;quot;org.simantics.db.layer0.adapter.ActionFactory&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;resource&lt;br /&gt;
            uri=&amp;quot;http://www.mylib.org/MyOntology-0.0/MyAction&amp;quot;&lt;br /&gt;
            class=&amp;quot;org.mylib.actions.MyAction&amp;quot; /&amp;gt;       &lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/adapters&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check correctness of URI by Graph debugger to search a resource:&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.mylib.org/MyOntology-1.0/MyAction&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note! Use versioned URI (0.0 -&amp;gt; 1.0) while searching.&lt;br /&gt;
&lt;br /&gt;
Include adapters.xml into build configuration in MANIFEST.MF/Build/Binary Build. Also, include SCL packages and SCL modules if your use them in your implementation.&lt;br /&gt;
&lt;br /&gt;
Export the implementation package (org.mylib.actions) of MyAction.java in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
== Step 3: Product ==&lt;br /&gt;
Include the ontology and the implementation plugins into your product configuration (Debug Configurations/Plug-ins) and validate Plug-ins dependencies before running the product.&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3357</id>
		<title>Check list: Model browser contributions</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3357"/>
		<updated>2017-07-03T13:03:57Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: /* Step 2: Implementation Plug-in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To avoid typical errors while defining ontology contributions to model browser follow the following check list:&lt;br /&gt;
&lt;br /&gt;
== Step 1: Ontology Plug-in ==&lt;br /&gt;
Define an ontology plugin (org.mylib.ontology)&lt;br /&gt;
&lt;br /&gt;
Define dependencies from Simantics plugins in MANIFEST.MF/Dependencies/Required Plug-ins&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;org.simantics.layer0&lt;br /&gt;
org.simantics.modeling.ontology&lt;br /&gt;
org.simantics.viewpoint.ontology&lt;br /&gt;
org.simantics.action.ontology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Include the following definitions into your ontology file (*.pgraph)&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;L0 = &amp;lt;http://www.simantics.org/Layer0-1.1&amp;gt;&lt;br /&gt;
VP = &amp;lt;http://www.simantics.org/Viewpoint-1.2&amp;gt;&lt;br /&gt;
ACT = &amp;lt;http://www.simantics.org/Action-1.1&amp;gt;&lt;br /&gt;
MOD = &amp;lt;http://www.simantics.org/Modeling-1.2&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new library (www.mylib.org) for your ontology under Simantics root (&#039;&#039;http://&#039;&#039;):&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_LIB = &amp;lt;http://www.mylib.org&amp;gt; : L0.Library&lt;br /&gt;
  @L0.new&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define your ontology  under the library and specify its ResourceClass&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_ONTOLOGY = &amp;lt;http://www.mylib.org/MyOntology-1.0&amp;gt; : L0.Ontology&lt;br /&gt;
  @L0.new&lt;br /&gt;
  L0.HasResourceClass &amp;quot;org.mylib.MyOntologyResource&amp;quot; : L0.String&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the Name property of ontology plugin in MANIFEST.MF/Overview/General Information. It has to match with URI (without version number) of your ontology.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Name: http://www.mylib.org/MyOntology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export the package (org.mylib) of ResourceClass in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
Define a new context and include it into MOD.ModelingActionContext&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC = MY_ONTOLOGY.MyActionContext : VP.BrowseContext&lt;br /&gt;
  VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new ActionContribution for each action in this context&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC&lt;br /&gt;
 VP.BrowseContext.HasActionContribution _ : VP.ActionContribution&lt;br /&gt;
  L0.HasLabel &amp;quot;My action...&amp;quot;        &lt;br /&gt;
  VP.ActionContribution.HasAction MY_ONTOLOGY.MyAction : ACT.Action&lt;br /&gt;
  VP.ActionContribution.HasNodeType&lt;br /&gt;
   L0.Entity&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 2: Implementation Plug-in ==&lt;br /&gt;
Define a plugin for action implementation (org.mylib). Options: Generate an activator=checked, This plug-in will make contributions to the UI=checked.&lt;br /&gt;
&lt;br /&gt;
Define a package src/org.mylib.actions&lt;br /&gt;
&lt;br /&gt;
Define a new Java class MyAction.java under org.mylib.actions package&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;package org.mylib.actions;&lt;br /&gt;
import org.simantics.db.layer0.adapter.ActionFactory;&lt;br /&gt;
import org.simantics.db.Resource;&lt;br /&gt;
&lt;br /&gt;
public class MyAction implements ActionFactory {&lt;br /&gt;
    @Override&lt;br /&gt;
    public Runnable create(Object target) {&lt;br /&gt;
        if (!(target instanceof Resource))&lt;br /&gt;
            return null;&lt;br /&gt;
        final Resource res = (Resource) target;&lt;br /&gt;
        return new Runnable() {&lt;br /&gt;
            @Override&lt;br /&gt;
            public void run() {&lt;br /&gt;
                // TODO: put your code here&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
    }&lt;br /&gt;
} &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new file (adapters.xml) under implementation plugin to map URI (unversioned) of your action to Java class implementation. The content of the file is as follows:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;adapters&amp;gt;&lt;br /&gt;
    &amp;lt;target interface=&amp;quot;org.simantics.db.layer0.adapter.ActionFactory&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;resource&lt;br /&gt;
            uri=&amp;quot;http://www.mylib.org/MyOntology-0.0/MyAction&amp;quot;&lt;br /&gt;
            class=&amp;quot;org.mylib.actions.MyAction&amp;quot; /&amp;gt;       &lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/adapters&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check correctness of URI by Graph debugger to search a resource:&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.mylib.org/MyOntology-1.0/MyAction&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note! Use versioned URI (0.0 -&amp;gt; 1.0) while searching.&lt;br /&gt;
&lt;br /&gt;
Include adapters.xml into build configuration in MANIFEST.MF/Build/Binary Build. Also, include SCL packages and SCL modules if your use them in your implementation.&lt;br /&gt;
&lt;br /&gt;
Export the implementation package (org.mylib.actions) of MyAction.java in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
== Step 3: Product ==&lt;br /&gt;
Include the ontology and the implementation plugins into your product configuration (Debug Configurations/Plug-ins) and validate Plug-ins dependencies before running the product.&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3356</id>
		<title>Check list: Model browser contributions</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3356"/>
		<updated>2017-07-03T12:59:43Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: /* Step 1: Ontology Plug-in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To avoid typical errors while defining ontology contributions to model browser follow the following check list:&lt;br /&gt;
&lt;br /&gt;
== Step 1: Ontology Plug-in ==&lt;br /&gt;
Define an ontology plugin (org.mylib.ontology)&lt;br /&gt;
&lt;br /&gt;
Define dependencies from Simantics plugins in MANIFEST.MF/Dependencies/Required Plug-ins&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;org.simantics.layer0&lt;br /&gt;
org.simantics.modeling.ontology&lt;br /&gt;
org.simantics.viewpoint.ontology&lt;br /&gt;
org.simantics.action.ontology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Include the following definitions into your ontology file (*.pgraph)&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;L0 = &amp;lt;http://www.simantics.org/Layer0-1.1&amp;gt;&lt;br /&gt;
VP = &amp;lt;http://www.simantics.org/Viewpoint-1.2&amp;gt;&lt;br /&gt;
ACT = &amp;lt;http://www.simantics.org/Action-1.1&amp;gt;&lt;br /&gt;
MOD = &amp;lt;http://www.simantics.org/Modeling-1.2&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new library (www.mylib.org) for your ontology under Simantics root (&#039;&#039;http://&#039;&#039;):&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_LIB = &amp;lt;http://www.mylib.org&amp;gt; : L0.Library&lt;br /&gt;
  @L0.new&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define your ontology  under the library and specify its ResourceClass&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_ONTOLOGY = &amp;lt;http://www.mylib.org/MyOntology-1.0&amp;gt; : L0.Ontology&lt;br /&gt;
  @L0.new&lt;br /&gt;
  L0.HasResourceClass &amp;quot;org.mylib.MyOntologyResource&amp;quot; : L0.String&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the Name property of ontology plugin in MANIFEST.MF/Overview/General Information. It has to match with URI (without version number) of your ontology.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Name: http://www.mylib.org/MyOntology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export the package (org.mylib) of ResourceClass in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
Define a new context and include it into MOD.ModelingActionContext&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC = MY_ONTOLOGY.MyActionContext : VP.BrowseContext&lt;br /&gt;
  VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new ActionContribution for each action in this context&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC&lt;br /&gt;
 VP.BrowseContext.HasActionContribution _ : VP.ActionContribution&lt;br /&gt;
  L0.HasLabel &amp;quot;My action...&amp;quot;        &lt;br /&gt;
  VP.ActionContribution.HasAction MY_ONTOLOGY.MyAction : ACT.Action&lt;br /&gt;
  VP.ActionContribution.HasNodeType&lt;br /&gt;
   L0.Entity&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 2: Implementation Plug-in ==&lt;br /&gt;
Define a plugin for action implementation (org.mylib)&lt;br /&gt;
&lt;br /&gt;
Define a package src/org.mylib.actions&lt;br /&gt;
&lt;br /&gt;
Define a new Java class MyAction.java under org.mylib.actions package&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;package org.mylib.actions;&lt;br /&gt;
import org.simantics.db.layer0.adapter.ActionFactory;&lt;br /&gt;
import org.simantics.db.Resource;&lt;br /&gt;
&lt;br /&gt;
public class MyAction implements ActionFactory {&lt;br /&gt;
    @Override&lt;br /&gt;
    public Runnable create(Object target) {&lt;br /&gt;
        if (!(target instanceof Resource))&lt;br /&gt;
            return null;&lt;br /&gt;
        final Resource res = (Resource) target;&lt;br /&gt;
        return new Runnable() {&lt;br /&gt;
            @Override&lt;br /&gt;
            public void run() {&lt;br /&gt;
                // TODO: put your code here&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
    }&lt;br /&gt;
} &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new file (adapters.xml) under implementation plugin to map URI (unversioned) of your action to Java class implementation. The content of the file is as follows:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;adapters&amp;gt;&lt;br /&gt;
    &amp;lt;target interface=&amp;quot;org.simantics.db.layer0.adapter.ActionFactory&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;resource&lt;br /&gt;
            uri=&amp;quot;http://www.mylib.org/MyOntology-0.0/MyAction&amp;quot;&lt;br /&gt;
            class=&amp;quot;org.mylib.actions.MyAction&amp;quot; /&amp;gt;       &lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/adapters&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check correctness of URI by Graph debugger to search a resource:&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.mylib.org/MyOntology-1.0/MyAction&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note! Use versioned URI (0.0 -&amp;gt; 1.0) while searching.&lt;br /&gt;
&lt;br /&gt;
Include adapters.xml into build configuration in MANIFEST.MF/Build/Binary Build. Also, include SCL packages and SCL modules if your use them in your implementation.&lt;br /&gt;
&lt;br /&gt;
Export the implementation package (org.mylib.actions) of MyAction.java in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
== Step 3: Product ==&lt;br /&gt;
Include the ontology and the implementation plugins into your product configuration (Debug Configurations/Plug-ins) and validate Plug-ins dependencies before running the product.&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3355</id>
		<title>Check list: Model browser contributions</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3355"/>
		<updated>2017-07-03T12:16:25Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: /* Step 1: Ontology Plug-in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To avoid typical errors while defining ontology contributions to model browser follow the following check list:&lt;br /&gt;
&lt;br /&gt;
== Step 1: Ontology Plug-in ==&lt;br /&gt;
Define an ontology plugin (org.mylib.ontology)&lt;br /&gt;
&lt;br /&gt;
Define dependencies from Simantics plugins in MANIFEST.MF/Dependencies/Required Plug-ins&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;org.simantics.layer0&lt;br /&gt;
org.simantics.modeling.ontology&lt;br /&gt;
org.simantics.viewpoint.ontology&lt;br /&gt;
org.simantics.action.ontology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Include the following definitions into your ontology file (*.pgraph)&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;L0 = &amp;lt;http://www.simantics.org/Layer0-1.1&amp;gt;&lt;br /&gt;
VP = &amp;lt;http://www.simantics.org/Viewpoint-1.2&amp;gt;&lt;br /&gt;
ACT = &amp;lt;http://www.simantics.org/Action-1.1&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new library (www.mylib.org) for your ontology under Simantics root (&#039;&#039;http://&#039;&#039;):&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_LIB = &amp;lt;http://www.mylib.org&amp;gt; : L0.Library&lt;br /&gt;
  @L0.new&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define your ontology  under the library and specify its ResourceClass&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_ONTOLOGY = &amp;lt;http://www.mylib.org/MyOntology-1.0&amp;gt; : L0.Ontology&lt;br /&gt;
  @L0.new&lt;br /&gt;
  L0.HasResourceClass &amp;quot;org.mylib.MyOntologyResource&amp;quot; : L0.String&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the Name property of ontology plugin in MANIFEST.MF/Overview/General Information. It has to match with URI (without version number) of your ontology.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Name: http://www.mylib.org/MyOntology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export the package (org.mylib) of ResourceClass in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
Define a new context and include it into MOD.ModelingActionContext&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC = MY_ONTOLOGY.MyActionContext : VP.BrowseContext&lt;br /&gt;
  VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new ActionContribution for each action in this context&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC&lt;br /&gt;
 VP.BrowseContext.HasActionContribution _ : VP.ActionContribution&lt;br /&gt;
  L0.HasLabel &amp;quot;My action...&amp;quot;        &lt;br /&gt;
  VP.ActionContribution.HasAction MY_ONTOLOGY.MyAction : ACT.Action&lt;br /&gt;
  VP.ActionContribution.HasNodeType&lt;br /&gt;
   L0.Entity&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 2: Implementation Plug-in ==&lt;br /&gt;
Define a plugin for action implementation (org.mylib)&lt;br /&gt;
&lt;br /&gt;
Define a package src/org.mylib.actions&lt;br /&gt;
&lt;br /&gt;
Define a new Java class MyAction.java under org.mylib.actions package&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;package org.mylib.actions;&lt;br /&gt;
import org.simantics.db.layer0.adapter.ActionFactory;&lt;br /&gt;
import org.simantics.db.Resource;&lt;br /&gt;
&lt;br /&gt;
public class MyAction implements ActionFactory {&lt;br /&gt;
    @Override&lt;br /&gt;
    public Runnable create(Object target) {&lt;br /&gt;
        if (!(target instanceof Resource))&lt;br /&gt;
            return null;&lt;br /&gt;
        final Resource res = (Resource) target;&lt;br /&gt;
        return new Runnable() {&lt;br /&gt;
            @Override&lt;br /&gt;
            public void run() {&lt;br /&gt;
                // TODO: put your code here&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
    }&lt;br /&gt;
} &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new file (adapters.xml) under implementation plugin to map URI (unversioned) of your action to Java class implementation. The content of the file is as follows:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;adapters&amp;gt;&lt;br /&gt;
    &amp;lt;target interface=&amp;quot;org.simantics.db.layer0.adapter.ActionFactory&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;resource&lt;br /&gt;
            uri=&amp;quot;http://www.mylib.org/MyOntology-0.0/MyAction&amp;quot;&lt;br /&gt;
            class=&amp;quot;org.mylib.actions.MyAction&amp;quot; /&amp;gt;       &lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/adapters&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check correctness of URI by Graph debugger to search a resource:&lt;br /&gt;
&amp;lt;pre&amp;gt;http://www.mylib.org/MyOntology-1.0/MyAction&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note! Use versioned URI (0.0 -&amp;gt; 1.0) while searching.&lt;br /&gt;
&lt;br /&gt;
Include adapters.xml into build configuration in MANIFEST.MF/Build/Binary Build. Also, include SCL packages and SCL modules if your use them in your implementation.&lt;br /&gt;
&lt;br /&gt;
Export the implementation package (org.mylib.actions) of MyAction.java in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
== Step 3: Product ==&lt;br /&gt;
Include the ontology and the implementation plugins into your product configuration (Debug Configurations/Plug-ins) and validate Plug-ins dependencies before running the product.&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3354</id>
		<title>Check list: Model browser contributions</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3354"/>
		<updated>2017-07-03T11:38:24Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: /* Step 1: Ontology Plug-in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To avoid typical errors while defining ontology contributions to model browser follow the following check list:&lt;br /&gt;
&lt;br /&gt;
== Step 1: Ontology Plug-in ==&lt;br /&gt;
Define a new ontology plugin (org.mylib.ontology)&lt;br /&gt;
&lt;br /&gt;
Define dependencies from Simantics plugins in MANIFEST.MF/Dependencies/Required Plug-ins&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;org.simantics.layer0&lt;br /&gt;
org.simantics.modeling.ontology&lt;br /&gt;
org.simantics.viewpoint.ontology&lt;br /&gt;
org.simantics.action.ontology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Include the following definitions into your ontology file (*.pgraph)&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;L0 = &amp;lt;http://www.simantics.org/Layer0-1.1&amp;gt;&lt;br /&gt;
VP = &amp;lt;http://www.simantics.org/Viewpoint-1.2&amp;gt;&lt;br /&gt;
ACT = &amp;lt;http://www.simantics.org/Action-1.1&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new library (www.mylib.org) for your ontology under Simantics root (&#039;&#039;http://&#039;&#039;):&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_LIB = &amp;lt;http://www.mylib.org&amp;gt; : L0.Library&lt;br /&gt;
  @L0.new&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define your ontology  under the library and specify its ResourceClass&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_ONTOLOGY = &amp;lt;http://www.mylib.org/MyOntology-1.0&amp;gt; : L0.Ontology&lt;br /&gt;
  @L0.new&lt;br /&gt;
  L0.HasResourceClass &amp;quot;org.mylib.MyOntologyResource&amp;quot; : L0.String&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the Name property of ontology plugin in MANIFEST.MF/Overview/General Information. It has to match with URI (without version number) of your ontology.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Name: http://www.mylib.org/MyOntology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export the package (org.mylib) of ResourceClass in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
Define a new context and include it into MOD.ModelingActionContext&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC = MY_ONTOLOGY.MyActionContext : VP.BrowseContext&lt;br /&gt;
  VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new ActionContribution for each action in this context&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC&lt;br /&gt;
 VP.BrowseContext.HasActionContribution _ : VP.ActionContribution&lt;br /&gt;
  L0.HasLabel &amp;quot;My action...&amp;quot;        &lt;br /&gt;
  VP.ActionContribution.HasAction MY_LIB.MyAction : ACT.Action&lt;br /&gt;
  VP.ActionContribution.HasNodeType&lt;br /&gt;
   L0.Entity&lt;br /&gt;
&lt;br /&gt;
== Step 2: Implementation Plug-in ==&lt;br /&gt;
Define a plugin for action implementation(org.mylib)&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3353</id>
		<title>Check list: Model browser contributions</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3353"/>
		<updated>2017-07-03T11:37:12Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: /* Step 1: Ontology Plug-in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To avoid typical errors while defining ontology contributions to model browser follow the following check list:&lt;br /&gt;
&lt;br /&gt;
== Step 1: Ontology Plug-in ==&lt;br /&gt;
Define a new ontology plugin (org.mylib.ontology)&lt;br /&gt;
&lt;br /&gt;
Define dependencies from Simantics plugins in MANIFEST.MF/Dependencies/Required Plug-ins&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;org.simantics.layer0&lt;br /&gt;
org.simantics.modeling.ontology&lt;br /&gt;
org.simantics.viewpoint.ontology&lt;br /&gt;
org.simantics.action.ontology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Include the following definitions into your ontology file (*.pgraph)&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;L0 = &amp;lt;http://www.simantics.org/Layer0-1.1&amp;gt;&lt;br /&gt;
VP = &amp;lt;http://www.simantics.org/Viewpoint-1.2&amp;gt;&lt;br /&gt;
ACT = &amp;lt;http://www.simantics.org/Action-1.1&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new library (www.mylib.org) for your ontology under Simantics root (&#039;&#039;http://&#039;&#039;):&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_LIB = &amp;lt;http://www.mylib.org&amp;gt; : L0.Library&lt;br /&gt;
  @L0.new&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define your ontology  under the library and specify its ResourceClass&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_ONTOLOGY = &amp;lt;http://www.mylib.org/MyOntology-1.0&amp;gt; : L0.Ontology&lt;br /&gt;
  @L0.new&lt;br /&gt;
  L0.HasResourceClass &amp;quot;org.mylib.Resource&amp;quot; : L0.String&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the Name property of ontology plugin in MANIFEST.MF/Overview/General Information. It has to match with URI (without version number) of your ontology.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Name: http://www.mylib.org/MyOntology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export the package (org.mylib) of ResourceClass in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
Define a new context and include it into MOD.ModelingActionContext&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC = MY_ONTOLOGY.MyActionContext : VP.BrowseContext&lt;br /&gt;
  VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new ActionContribution for each action in this context&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC&lt;br /&gt;
 VP.BrowseContext.HasActionContribution _ : VP.ActionContribution&lt;br /&gt;
  L0.HasLabel &amp;quot;My action...&amp;quot;        &lt;br /&gt;
  VP.ActionContribution.HasAction MY_LIB.MyAction : ACT.Action&lt;br /&gt;
  VP.ActionContribution.HasNodeType&lt;br /&gt;
   L0.Entity&lt;br /&gt;
&lt;br /&gt;
== Step 2: Implementation Plug-in ==&lt;br /&gt;
Define a plugin for action implementation(org.mylib)&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3352</id>
		<title>Check list: Model browser contributions</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3352"/>
		<updated>2017-07-03T11:30:14Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: /* Step 1: Ontology Plug-in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To avoid typical errors while defining ontology contributions to model browser follow the following check list:&lt;br /&gt;
&lt;br /&gt;
== Step 1: Ontology Plug-in ==&lt;br /&gt;
Define a new ontology plugin (org.mylib.ontology)&lt;br /&gt;
&lt;br /&gt;
Include the following definitions into your ontology file (*.pgraph)&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;L0 = &amp;lt;http://www.simantics.org/Layer0-1.1&amp;gt;&lt;br /&gt;
VP = &amp;lt;http://www.simantics.org/Viewpoint-1.2&amp;gt;&lt;br /&gt;
ACT = &amp;lt;http://www.simantics.org/Action-1.1&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new library (www.mylib.fi) for your ontology under Simantics root (&#039;&#039;http://&#039;&#039;):&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_LIB = &amp;lt;http://www.mylib.org&amp;gt; : L0.Library&lt;br /&gt;
  @L0.new&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define your ontology  under the library and specify its ResourceClass&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_ONTOLOGY = &amp;lt;http://www.mylib.org/MyOntology-1.0&amp;gt; : L0.Ontology&lt;br /&gt;
  @L0.new&lt;br /&gt;
  L0.HasResourceClass &amp;quot;org.mylib.Resource&amp;quot; : L0.String&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the Name property of ontology plugin in MANIFEST.MF/Overview/General Information. It has to match with URI (without version number) of your ontology.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Name: http://www.mylib.org/MyOntology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export the package (org.mylib) of ResourceClass in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
Define a new context and include it into MOD.ModelingActionContext&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC = MY_ONTOLOGY.MyActionContext : VP.BrowseContext&lt;br /&gt;
  VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new ActionContribution for each action in this context&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC&lt;br /&gt;
 VP.BrowseContext.HasActionContribution _ : VP.ActionContribution&lt;br /&gt;
  L0.HasLabel &amp;quot;My action...&amp;quot;        &lt;br /&gt;
  VP.ActionContribution.HasAction MY_LIB.MyAction : ACT.Action&lt;br /&gt;
  VP.ActionContribution.HasNodeType&lt;br /&gt;
   L0.Entity&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3351</id>
		<title>Check list: Model browser contributions</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3351"/>
		<updated>2017-07-03T11:28:30Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To avoid typical errors while defining ontology contributions to model browser follow the following check list:&lt;br /&gt;
&lt;br /&gt;
== Step 1: Ontology Plug-in ==&lt;br /&gt;
Define a new ontology plugin (org.mylib.ontology)&lt;br /&gt;
&lt;br /&gt;
Include the following definitions into your ontology file (*.pgraph)&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;L0 = &amp;lt;http://www.simantics.org/Layer0-1.1&amp;gt;&lt;br /&gt;
VP = &amp;lt;http://www.simantics.org/Viewpoint-1.2&amp;gt;&lt;br /&gt;
ACT = &amp;lt;http://www.simantics.org/Action-1.1&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new library (www.mylib.fi) for your ontology under Simantics root (&#039;&#039;http://&#039;&#039;):&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_LIB = &amp;lt;http://www.mylib.org&amp;gt; : L0.Library&lt;br /&gt;
  @L0.new&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define your ontology  under the library and specify its ResourceClass&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_ONTOLOGY = &amp;lt;http://www.mylib.org/MyOntology-1.0&amp;gt; : L0.Ontology&lt;br /&gt;
  @L0.new&lt;br /&gt;
  L0.HasResourceClass &amp;quot;org.mylib.Resource&amp;quot; : L0.String&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the Name property of ontology plugin in MANIFEST.MF/Overview/General Information. It has to match with URI (without version number) of your ontology.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Name: http://www.mylib.org/MyOntology&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export the package (org.mylib) of ResourceClass in MANIFEST.MF/Runtime/Exported Packages.&lt;br /&gt;
&lt;br /&gt;
Define a new context and include it into ModelingActionContext&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC = MY_ONTOLOGY.MyActionContext : VP.BrowseContext&lt;br /&gt;
  VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Define a new ActionContribution for each action in this context&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MY_AC&lt;br /&gt;
 VP.BrowseContext.HasActionContribution _ : VP.ActionContribution&lt;br /&gt;
  L0.HasLabel &amp;quot;My action...&amp;quot;        &lt;br /&gt;
  VP.ActionContribution.HasAction MY_LIB.MyAction : ACT.Action&lt;br /&gt;
  VP.ActionContribution.HasNodeType&lt;br /&gt;
   L0.Entity&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3350</id>
		<title>Check list: Model browser contributions</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Check_list:_Model_browser_contributions&amp;diff=3350"/>
		<updated>2017-07-03T10:49:32Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: Created page with &amp;quot;To avoid typical errors while defining ontology contributions to model browser follow the following check list:  == Step 1: Ontology Plug-in == Define a new library (www.mylib...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To avoid typical errors while defining ontology contributions to model browser follow the following check list:&lt;br /&gt;
&lt;br /&gt;
== Step 1: Ontology Plug-in ==&lt;br /&gt;
Define a new library (www.mylib.fi) for ontology under Simantics root (&#039;&#039;http://&#039;&#039;):&lt;br /&gt;
MyLib = &amp;lt;&#039;&#039;http://www.mylib.fi&#039;&#039;&amp;gt; : L0.Library&lt;br /&gt;
&#039;&#039;    @L0.new&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Simantics_Developer_Documentation&amp;diff=3349</id>
		<title>Simantics Developer Documentation</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Simantics_Developer_Documentation&amp;diff=3349"/>
		<updated>2017-07-03T10:41:11Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
[[image:Simantics_logo_pile_01.png|right|border|400px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simantics&#039;&#039;&#039; is a software platform for modelling and simulation. The system has client-server architecture with a semantic ontology-based modelling database and Eclipse framework -based client software with plug-in interface. The Simantics platform and many of its components are open source under [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License (EPL)].&lt;br /&gt;
&lt;br /&gt;
The philosophy of the Simantics platform is to offer an open, high level application platform on which different computational tools can be easily integrated to form a common environment for modelling and simulation. The platform includes several modelling tools, so-called editors, for e.g. 2D graph-like hierarchical model composition and semantic graph browsing.&lt;br /&gt;
&lt;br /&gt;
One of the biggest innovations in the Simantics platform is the semantic modelling approach itself and high-level ontology tools. The semantic database, i.e. triplestore, on the server side enables high performance data management and arbitrary mappings of data. This enables e.g. efficient mapping of simulation and measurement data to the model configuration and its visualisation.&lt;br /&gt;
&lt;br /&gt;
The Simantics development and maintenance process is built to be solid and scalable from the very beginning. The objective is to aim far to the future what comes to requirements for scalability, usability, and reliability.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;Simantics Developer Documentation&#039;&#039; is targeted to programmers and software developers developing either the platform itself or additional plug-ins to be used with or on the platform. The [[userwiki:Main_Page|Simantics End User Documentation]] complements to documentation for the Simantics platform offering overview and detailed information about the platform from the user&#039;s point of view. The [https://www.simantics.org/simantics Simantics] website is the source of information for the Simantics project and related subjects[[Tutorials|.]]&lt;br /&gt;
&amp;lt;div style=&amp;quot;color:white;&amp;quot;&amp;gt;Disclaimer Warning: This site may cause narcolepsia in some readers. Consult your doctor if sensitive to boredom.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|width=&amp;quot;75%&amp;quot;&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
* [[Glossary]]&lt;br /&gt;
* [[Introduction to Simantics Architecture]]&lt;br /&gt;
* [[Roadmap]]&lt;br /&gt;
* [[Data View]]&lt;br /&gt;
* [[Component View]]&lt;br /&gt;
* [[Licensing|Licensing]]&lt;br /&gt;
* [[Useful Links]]&lt;br /&gt;
&amp;lt;!--* [[Simantics Specifications|Specifications]]--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous Documents ===&lt;br /&gt;
&lt;br /&gt;
* [[Quick Development Environment Setup|Quick Development Environment Setup Guide]]&lt;br /&gt;
* [[Target Platform]]&lt;br /&gt;
* [[Development Practices]]&lt;br /&gt;
* [[Internationalization]]&lt;br /&gt;
* [[Update Site]]&lt;br /&gt;
* [[Coding Convention]]&lt;br /&gt;
* [[Tools]]&lt;br /&gt;
* [[Testing]]&lt;br /&gt;
* [[FAQ]]&lt;br /&gt;
* [[Migration To Git]]&lt;br /&gt;
&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|width=&amp;quot;100%&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
=== Ontology Development ===&lt;br /&gt;
&lt;br /&gt;
* [[:Media:Layer0.pdf|Layer0.pdf]] ([[:File:Layer0.pdf|log]])&lt;br /&gt;
* [[Graph Compiler]]&lt;br /&gt;
* [[Transferable Graph]]&lt;br /&gt;
* [[Binary Container Format]]&lt;br /&gt;
* [[Graph File Format]]&lt;br /&gt;
* [[Version Migration]]&lt;br /&gt;
* [[Tutorial: Ontology Development]]&lt;br /&gt;
* [[Check list: Model browser contributions]]&lt;br /&gt;
* [[XML Schema Conversion]]&lt;br /&gt;
&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
=== Database Development ===&lt;br /&gt;
&lt;br /&gt;
* [[Interface summary]]&lt;br /&gt;
* [[Tutorial: Quickstart]]&lt;br /&gt;
* [[Tutorial: Database Development]]&lt;br /&gt;
* [[Resource Adaptation]]&lt;br /&gt;
* [[Resource Serialization]]&lt;br /&gt;
* [[Inverse Relations]]&lt;br /&gt;
* [[Virtual Graphs]]&lt;br /&gt;
* [[Functions]]&lt;br /&gt;
* [[Procedural Values]]&lt;br /&gt;
* [[Variable]]&lt;br /&gt;
* [[Undo Mechanism]]&lt;br /&gt;
* [[Team Features]]&lt;br /&gt;
* [[Subgraph Extents]]&lt;br /&gt;
* [[Database Testing]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
=== Data management &amp;amp; Experiment Control ===&lt;br /&gt;
&lt;br /&gt;
* [[Databoard Specification]]&lt;br /&gt;
* [[Databoard Developer Manual|Databoard Java Manual]]&lt;br /&gt;
* [[Experiment Control]]&lt;br /&gt;
* [[Dataflows]]&lt;br /&gt;
&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
=== UI Development ===&lt;br /&gt;
&lt;br /&gt;
* [[Org.simantics.browsing.ui_Manual|Browser Manual]]&lt;br /&gt;
* [[org.simantics.browsing.ui.feature|Browser Component]]&lt;br /&gt;
* [[Org.simantics.scenegraph.loader|Scene Graph Loader]]&lt;br /&gt;
* [[Org.simantics.message|Messages]]&lt;br /&gt;
* [[Org.simantics.views|Modelled Views]]&lt;br /&gt;
* [[Org.simantics.document|Documents]]&lt;br /&gt;
* [[Selection View]]&lt;br /&gt;
|}&lt;br /&gt;
{|width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
=== Simantics Constraint Language===&lt;br /&gt;
&lt;br /&gt;
* [http://www.simantics.org/~niemisto/Introduction%20to%20SCL.pptx Introduction to SCL]&lt;br /&gt;
* [[SCL Compiler]]&lt;br /&gt;
* [[SCL Tutorial]]&lt;br /&gt;
* [[SCL Types]]&lt;br /&gt;
&amp;lt;!--* [[SCL_Language|SCL Language]] --&amp;gt;&lt;br /&gt;
&amp;lt;!--* [https://www.simantics.org/wiki/index.php/Org.simantics.scl_Compiler SCL Compiler]--&amp;gt;&lt;br /&gt;
* [[Org.simantics.objmap_Manual|Object Map Manual]]&lt;br /&gt;
* [[SCL Registry]]&lt;br /&gt;
* [http://www.simantics.org/SCLDocumentation/StandardLibrary/Prelude.html SCL Reference]&lt;br /&gt;
* [http://www.simantics.org/~niemisto/Transformations.pdf Transformation language specification]&lt;br /&gt;
* [http://www.simantics.org/~niemisto/Transformations_2015_01_23.pdf Transformation language presentation]&lt;br /&gt;
* [http://www.simantics.org/~niemisto/CHRGuide.html CHR Guide]&lt;br /&gt;
&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
=== Model Development ===&lt;br /&gt;
&lt;br /&gt;
* [[Structural Ontology]]&lt;br /&gt;
* [[Users and Roles]]&lt;br /&gt;
* [[Models]]&lt;br /&gt;
* [[Concept Versioning]]&lt;br /&gt;
* [[Component Identification]]&lt;br /&gt;
* [[Tutorial: Model Development]]&lt;br /&gt;
&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
=== Project Development ===&lt;br /&gt;
&lt;br /&gt;
* [[Project Management Conceptual Model]]&lt;br /&gt;
* [[Project Development]]&lt;br /&gt;
* [[Tutorial: Project Development]]&lt;br /&gt;
&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
=== Diagram Development ===&lt;br /&gt;
&lt;br /&gt;
* [[2D Ontologies]]&lt;br /&gt;
* [[org.simantics.diagram|Diagram]]&lt;br /&gt;
* [[org.simantics.scenegraph|Scene graph]]&lt;br /&gt;
* [[Diagram connections]]&lt;br /&gt;
* [[Tutorial: Diagram Development]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
{|width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
=== Issue Development ===&lt;br /&gt;
&lt;br /&gt;
* [[Issue subsystem general description]]&lt;br /&gt;
&lt;br /&gt;
|width=&amp;quot;25%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
=== Utilities ===&lt;br /&gt;
&lt;br /&gt;
* [[Simantics Generic File Import]]&lt;br /&gt;
* [[Logging in Simantics Platform]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
-----&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Tutorial:_Database_Development&amp;diff=3120</id>
		<title>Tutorial: Database Development</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Tutorial:_Database_Development&amp;diff=3120"/>
		<updated>2013-12-05T17:20:52Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: /* Asynchronous read with a SyncListener */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Basic concepts =&lt;br /&gt;
;Session: Database session / connection that allows reading and writing the database using transactions.&lt;br /&gt;
;Transaction: A database operation; either read, or write operation. Simantics supports three types of transactions: Read, Write, and WriteOnly.&lt;br /&gt;
;Resource: A single object in the database.&lt;br /&gt;
;Statement: Triple consisting of subject, predicate, and object&lt;br /&gt;
;Literal: primitive value (int, double, String,..) or an array of primitive values.&lt;br /&gt;
&lt;br /&gt;
=Reading the database=&lt;br /&gt;
&lt;br /&gt;
==Literals==&lt;br /&gt;
&lt;br /&gt;
In this example we set a Label to show a Resource’s name. A resource&#039;s name is defined using the &#039;&#039;&#039;L0.HasName&#039;&#039;&#039; property relation.&lt;br /&gt;
&lt;br /&gt;
To support Layer0 URI &amp;amp;harr; resource mapping mechanism (see [[:Media:Layer0.pdf|Layer0.pdf]] section 4), resource names have certain restrictions.&lt;br /&gt;
* A single resource cannot have more than one statement objects with &#039;&#039;&#039;L0.ConsistsOf&#039;&#039;&#039;-predicate that have the same name. For example the following graph snippet in [[Graph File Format]] does not work with the URI &amp;amp;rarr; resource discovery mechanism:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a : L0.Entity&lt;br /&gt;
    L0.ConsistsOf&lt;br /&gt;
        a : L0.Entity&lt;br /&gt;
        a : L0.Entity&lt;br /&gt;
        b : L0.Entity&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Synchronous read with a return value===&lt;br /&gt;
One way to read information stored in the database is to use synchronous reads with a return value. Return value can be any Java class, and here it is String.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
try {&lt;br /&gt;
	String name = session.syncRequest(new Read&amp;lt;String&amp;gt;() {&lt;br /&gt;
		@Override&lt;br /&gt;
		public String perform(ReadGraph graph) throws DatabaseException {&lt;br /&gt;
			Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
			return graph.getRelatedValue(resource, l0.HasName);&lt;br /&gt;
				&lt;br /&gt;
		}});&lt;br /&gt;
	label.setText(name);&lt;br /&gt;
} catch (DatabaseException e) {&lt;br /&gt;
	// handle exception here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Database connection may fail during the transaction and send an exception. Therefore you have to handle the exception in some way. Here we have wrapped the transaction inside try-catch block. In real code the most common thing to do is to let the exception propagate back to UI code.&lt;br /&gt;
&lt;br /&gt;
All literals can be read the same way, you just have to provide correct relation. There are also other methods to read literals that behave differently:&lt;br /&gt;
*getRelatedValue(): returns literal or throws and exception if value is not found&lt;br /&gt;
*getPossibleRelatedValue(): returns literal value or null, if the value does not exist.&lt;br /&gt;
&lt;br /&gt;
=== Asynchronous read ===&lt;br /&gt;
&lt;br /&gt;
Asynchronous read allows creating requests that are processed in the background. If you don’t need the result immediately, it is recommended to use asynchronous reads for performance reasons or to prevent blocking UI threads.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
session.asyncRequest(new ReadRequest() {&lt;br /&gt;
	@Override&lt;br /&gt;
	public void run(ReadGraph graph) throws DatabaseException {&lt;br /&gt;
		Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
		final String name =  graph.getRelatedValue(resource, l0.HasName);&lt;br /&gt;
		Display.getDefault().asyncExec(new Runnable() {&lt;br /&gt;
			@Override&lt;br /&gt;
			public void run() {&lt;br /&gt;
				if (!label.isDisposed())&lt;br /&gt;
					label.setText(name);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we use separate Runnable to set the label’s text (SWT components must be accessed from main / SWT thread). Note that we have to check if the label is disposed before setting the text.&lt;br /&gt;
&lt;br /&gt;
===Asynchronous read with a Procedure===&lt;br /&gt;
Using a procedure allows you to handle possible exceptions caused by failed asynchronous transaction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
session.asyncRequest(new Read&amp;lt;String&amp;gt;() {&lt;br /&gt;
	@Override&lt;br /&gt;
	public String perform(ReadGraph graph) throws DatabaseException {&lt;br /&gt;
		Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
		return graph.getRelatedValue(resource, l0.HasName);&lt;br /&gt;
	}&lt;br /&gt;
}, new Procedure&amp;lt;String&amp;gt;() {&lt;br /&gt;
	@Override&lt;br /&gt;
	public void exception(Throwable t) {&lt;br /&gt;
		// handle exception here&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	@Override&lt;br /&gt;
	public void execute(final String name) {&lt;br /&gt;
		Display.getDefault().asyncExec(new Runnable() {&lt;br /&gt;
			@Override&lt;br /&gt;
			public void run() {&lt;br /&gt;
				if (!label.isDisposed())&lt;br /&gt;
					label.setText(name);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Asynchronous read with a SyncListener===&lt;br /&gt;
Using &amp;lt;code&amp;gt;SyncListener&amp;lt;/code&amp;gt; with a read transaction leaves a listener to the database that notifies changes in the read data. There exist also &amp;lt;code&amp;gt;Listener&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;AsyncListener&amp;lt;/code&amp;gt; interfaces. SyncListener provides a &#039;&#039;ReadGraph&#039;&#039; for the listener, AsyncListener provides &#039;&#039;AsyncReadGraph&#039;&#039; for the user. Using &amp;lt;code&amp;gt;Listener&amp;lt;/code&amp;gt; provides no graph access at all, just a notification of a changed read request result.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
session.asyncRequest(new Read&amp;lt;String&amp;gt;() {&lt;br /&gt;
	@Override&lt;br /&gt;
	public String perform(ReadGraph graph) throws DatabaseException {&lt;br /&gt;
		Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
		return graph.getRelatedValue(resource, l0.HasName);&lt;br /&gt;
	}&lt;br /&gt;
}, new SyncListener&amp;lt;String&amp;gt;() {&lt;br /&gt;
	@Override&lt;br /&gt;
	public void exception(ReadGraph graph, Throwable throwable) throws DatabaseException {&lt;br /&gt;
		// handle exception here&lt;br /&gt;
	}&lt;br /&gt;
			&lt;br /&gt;
	@Override&lt;br /&gt;
	public void execute(ReadGraph graph, final String name) throws DatabaseException {&lt;br /&gt;
		Display.getDefault().asyncExec(new Runnable() {&lt;br /&gt;
			@Override&lt;br /&gt;
			public void run() {&lt;br /&gt;
				if (!label.isDisposed())&lt;br /&gt;
					label.setText(name);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	@Override&lt;br /&gt;
	public boolean isDisposed() {&lt;br /&gt;
		return label.isDisposed();&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here the listener updates the label when the name changes. The method isDisposed() controls lifecycle of the listener, and here when the label is disposed, the listener is released and it stops updating the label.&lt;br /&gt;
&lt;br /&gt;
===Triggering a read transaction (and its SyncListener) explicitely or without changes in data===&lt;br /&gt;
Idea is to embed an ExternalRead object (trigger) into a read request chain. Thus, the chain will be re-evaluated if the trigger is launched. Note, that the trigger has to be embedded with a listener. This guarantees that the trigger is kept alive.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
final TriggeringExternalRead trigger = new TriggeringExternalRead();&lt;br /&gt;
&lt;br /&gt;
session.asyncRequest(new Read&amp;lt;String&amp;gt;() {&lt;br /&gt;
	@Override&lt;br /&gt;
	public String perform(ReadGraph graph) throws DatabaseException {&lt;br /&gt;
&lt;br /&gt;
                // embed a trigger with listener into this read request chain&lt;br /&gt;
                graph.syncRequest(trigger, new Listener&amp;lt;Integer&amp;gt;(){&lt;br /&gt;
&lt;br /&gt;
				@Override&lt;br /&gt;
				public void execute(Integer result) {&lt;br /&gt;
					// TODO Auto-generated method stub&lt;br /&gt;
					&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				@Override&lt;br /&gt;
				public void exception(Throwable t) {&lt;br /&gt;
					// TODO Auto-generated method stub&lt;br /&gt;
					&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				@Override&lt;br /&gt;
				public boolean isDisposed() {&lt;br /&gt;
					// TODO Auto-generated method stub&lt;br /&gt;
					return false;&lt;br /&gt;
				}});&lt;br /&gt;
		); &lt;br /&gt;
		// end of embeding&lt;br /&gt;
&lt;br /&gt;
		Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
		return graph.getRelatedValue(resource, l0.HasName);&lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To launch a trigger in other code section just call its fire() -method.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	trigger.fire();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
Reading resources is similar to reading literals. Here is an example that reads all resources that are connected to a Resource with a ConsistsOf-relation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
try {&lt;br /&gt;
	Collection&amp;lt;Resource&amp;gt; children = session.syncRequest(new Read&amp;lt;Collection&amp;lt;Resource&amp;gt;&amp;gt;() {&lt;br /&gt;
		@Override&lt;br /&gt;
		public Collection&amp;lt;Resource&amp;gt; perform(ReadGraph graph) throws DatabaseException {&lt;br /&gt;
			Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
			return graph.getObjects(resource, l0.ConsistsOf);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} catch (DatabaseException e) {&lt;br /&gt;
	// handle exception here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Same asynchronous, Procedure, and Listener mechanisms work with reading resources. For example, you can use listener to be notified if resources are added or removed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
session.asyncRequest(new Read&amp;lt;Collection&amp;lt;Resource&amp;gt;&amp;gt;() {&lt;br /&gt;
	@Override&lt;br /&gt;
	public Collection&amp;lt;Resource&amp;gt; perform(ReadGraph graph) throws DatabaseException {&lt;br /&gt;
		Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
		return graph.getObjects(resource, l0.ConsistsOf);&lt;br /&gt;
	}&lt;br /&gt;
},new AsyncListener&amp;lt;Collection&amp;lt;Resource&amp;gt;&amp;gt;() {&lt;br /&gt;
	@Override&lt;br /&gt;
	public void exception(AsyncReadGraph graph, Throwable throwable){&lt;br /&gt;
		// handle exception here&lt;br /&gt;
	}&lt;br /&gt;
			&lt;br /&gt;
	@Override&lt;br /&gt;
	public void execute(AsyncReadGraph graph, Collection&amp;lt;Resource&amp;gt; result) {&lt;br /&gt;
		// this is run every time a resource is added or removed&lt;br /&gt;
	}&lt;br /&gt;
			&lt;br /&gt;
	@Override&lt;br /&gt;
	public boolean isDisposed() {&lt;br /&gt;
		// this must return true when the listener is not needed&lt;br /&gt;
		// anymore to release the listener&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Writing the database=&lt;br /&gt;
==Explicit clustering==&lt;br /&gt;
&lt;br /&gt;
Here we show how you can influence the way resources are grouped by the underlying implemention. You can significantly improve the dynamic behaviour of the database by grouping resources that are likely to be referenced in the same context/operation. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
try {&lt;br /&gt;
        session.syncRequest(new WriteRequest() {&lt;br /&gt;
            @Override&lt;br /&gt;
            public void perform(WriteGraph graph) throws DatabaseException {&lt;br /&gt;
                Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
                try {&lt;br /&gt;
                    graph.newClusterSet(l0.InstanceOf);&lt;br /&gt;
                } catch (ClusterSetExistException e) {&lt;br /&gt;
                    // Cluster set exits, no problem.&lt;br /&gt;
                }&lt;br /&gt;
                Resource newResource = graph.newResource(l0.InstanceOf);&lt;br /&gt;
                graph.claim(newResource, l0.InstanceOf, null, l0.Entity); &lt;br /&gt;
            }&lt;br /&gt;
        });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the same effect with setting a default for newResource method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        session.syncRequest(new WriteRequest() {&lt;br /&gt;
            @Override&lt;br /&gt;
            public void perform(WriteGraph graph) throws DatabaseException {&lt;br /&gt;
                Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
                Resource oldClusterSet = graph.setClusterSet4NewResource(l0.InstanceOf);&lt;br /&gt;
                try {&lt;br /&gt;
                    Resource newResource = graph.newResource();&lt;br /&gt;
                    graph.claim(newResource, l0.InstanceOf, null, l0.Entity);&lt;br /&gt;
                } finally {&lt;br /&gt;
                    graph.setClusterSet4NewResource(oldClusterSet);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Setting Literals==&lt;br /&gt;
&lt;br /&gt;
Here we set a name of a resource to “New name”. Both synchronous and asynchronous versions are similar, the only difference is that with synchronous way you have to handle the exception, while using an asynchronous write without a Procedure does not let you know if the transaction failed. Any exceptions will just be logged by the database client library.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
try {&lt;br /&gt;
	session.syncRequest(new WriteRequest() {&lt;br /&gt;
		@Override&lt;br /&gt;
		public void perform(WriteGraph graph) throws DatabaseException {&lt;br /&gt;
			Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
			graph.claimLiteral(resource, l0.HasName, &amp;quot;New name&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} catch (DatabaseException e) {&lt;br /&gt;
	// TODO Auto-generated catch block&lt;br /&gt;
	e.printStackTrace();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
session.asyncRequest(new WriteRequest() {	&lt;br /&gt;
	@Override&lt;br /&gt;
	public void perform(WriteGraph graph) throws DatabaseException {&lt;br /&gt;
		Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
		graph.claimLiteral(resource, l0.HasName, &amp;quot;New name&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using a Procedure with an asynchronous write transaction is similar to read transactions, so we don’t have separate example of that. Note that listeners can only be used with read transactions, not write transactions.&lt;br /&gt;
===Creating new Resources===&lt;br /&gt;
Same synchronous and asynchronous mechanisms apply to writing new Resources. The difference is that with asynchronous you can use a Callback to check if write failed, or separate WriteResult and a Procedure to return and check custom results of a write transaction.&lt;br /&gt;
&lt;br /&gt;
Here is an example that creates a new library, gives it a name “New Library” and connects it to given resource.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
session.asyncRequest(new WriteRequest() {&lt;br /&gt;
	@Override&lt;br /&gt;
	public void perform(WriteGraph graph) throws DatabaseException {&lt;br /&gt;
		Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
		Resource newResource = graph.newResource();&lt;br /&gt;
		graph.claim(newResource, l0.InstanceOf, l0.Library);&lt;br /&gt;
		graph.claimLiteral(newResource, l0.HasName, &amp;quot;New Library&amp;quot;);&lt;br /&gt;
		graph.claim(resource, l0.ConsistsOf, newResource);&lt;br /&gt;
				&lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The key points here are:&lt;br /&gt;
*New resource are created with WriteGraph.newResource()&lt;br /&gt;
*You must set resource’s type using InstanceOf-relation.&lt;br /&gt;
*If you do not connect created resources anywhere, the resources become orphan resources. For orphan resources there is no statement path to/from the database root resource. They cannot be traversed and therefore found from the database.&lt;br /&gt;
&lt;br /&gt;
===Deleting resources===&lt;br /&gt;
Here is an example that removes everything the given resource consists of directly. In the end it removes all the statements from the given resource, thereby essentially removing the resource itself. A resource is considered to not exist if it has no statements, since there&#039;s nothing to define its nature.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
session.asyncRequest(new WriteRequest() {&lt;br /&gt;
	@Override&lt;br /&gt;
	public void perform(WriteGraph graph) throws DatabaseException {&lt;br /&gt;
		Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
                for (Resource consistsOf : graph.getObjects(resource, l0.ConsistsOf)) {&lt;br /&gt;
                    // Remove all statements (consistsOf, ?p, ?o) and their possible inverse statements&lt;br /&gt;
                    graph.deny(consistsOf);&lt;br /&gt;
                }&lt;br /&gt;
                // Remove resource itself by removing any statements to/from it.&lt;br /&gt;
                graph.deny(resource);&lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Another example, that deletes the name of the given resource.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
session.asyncRequest(new WriteRequest() {&lt;br /&gt;
	@Override&lt;br /&gt;
	public void perform(WriteGraph graph) throws DatabaseException {&lt;br /&gt;
		Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
                graph.denyLiteral(resource, l0.HasName);&lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The key points here are:&lt;br /&gt;
*deny -methods are used to delete statements from the database&lt;br /&gt;
*denyLiteral -methods are used to delete literal values from the database&lt;br /&gt;
*A resource that has no statements does not exist.&lt;br /&gt;
&lt;br /&gt;
=Example case: Product and Purchase management=&lt;br /&gt;
&lt;br /&gt;
In this example, we will implement a simple product and purchase management system. The system will allow user to define new products, and create new purchase orders. To keep the example simple, the products have just a name and unit cost, and purchase orders will have name of the customer and a list of ordered products.&lt;br /&gt;
&lt;br /&gt;
We have already implemented skeleton for the system. It contains basic user interface for creating products and purchases, but it lacks several features that we are going to add during this tutorial. The base code can be found from SVN:&lt;br /&gt;
&lt;br /&gt;
*https://www.simulationsite.net/svn/simantics/tutorials/trunk/org.simantics.example&lt;br /&gt;
*https://www.simulationsite.net/svn/simantics/tutorials/trunk/org.simantics.example.feature&lt;br /&gt;
&lt;br /&gt;
Ontology that we are using is defined in &#039;&#039;Example.pgraph&#039;&#039; file. It is in &#039;&#039;org.simantics.example/graph&#039;&#039; folder. To run the example application, use &#039;&#039;simantics-example.product&#039;&#039;. After starting the example product, you should get a user interface like the one in Figure 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Eclipse will complain that AsyncPurchaseEditorFinal.java does not compile, but it does not prevent&lt;br /&gt;
starting the application. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:simantics_db_tutorial_start.png|thumb|600px|center|Figure 1: Tutorial application after one created product (Product 1) and one purchase.]]&lt;br /&gt;
&lt;br /&gt;
When you use the application you may notice following:&lt;br /&gt;
*Name of the customer or the date of the order is not shown anywhere.&lt;br /&gt;
*When purchase editor is open, new products won’t show up in it. Only closing and opening the editor shows the products.&lt;br /&gt;
*Adding new products to purchases can be done only in Example Browser&lt;br /&gt;
*While you can order several products, you cannot order multiple items of the same product.&lt;br /&gt;
&lt;br /&gt;
Org.simantics.example plug-in is split into four packages:&lt;br /&gt;
*editors: Purchase Editor implementation.&lt;br /&gt;
*handlers: UI actions.&lt;br /&gt;
*project: Project binding. See … for more details.&lt;br /&gt;
*resource:  Taxonomy generated from the used ontology.&lt;br /&gt;
&lt;br /&gt;
The most important parts of this tutorial are editors. AsyncPurchaseEditor and classes in handlers-package.&lt;br /&gt;
&lt;br /&gt;
==Adding the missing information to UI==&lt;br /&gt;
First we have to add new Text widgets to the Purchase Editor. At the beginning of AsyncPurchaseEditor.java you see:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// UI controls&lt;br /&gt;
private final Text totalCost;&lt;br /&gt;
private final TableViewer productViewer;&lt;br /&gt;
private final TableViewerColumn nameColumn;&lt;br /&gt;
private final TableViewerColumn costColumn;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Add new line after totalCost:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private final Text customer;&lt;br /&gt;
private final Text date;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then we have to instantiate text fields, create labels that inform user what the text fields mean, and setup the layout properly. In the beginning of the constructor modify:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Label l = new Label(this, SWT.NONE);&lt;br /&gt;
l.setText(&amp;quot;Total Price:&amp;quot;);&lt;br /&gt;
GridDataFactory.fillDefaults().applyTo(l);&lt;br /&gt;
&lt;br /&gt;
totalCost = new Text(this, SWT.NONE);&lt;br /&gt;
totalCost.setEditable(false);&lt;br /&gt;
GridDataFactory.fillDefaults().grab(true, false).applyTo(totalCost);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Label l = new Label(this, SWT.NONE);&lt;br /&gt;
l.setText(&amp;quot;Customer:&amp;quot;);&lt;br /&gt;
GridDataFactory.fillDefaults().applyTo(l);&lt;br /&gt;
        &lt;br /&gt;
customer = new Text(this, SWT.NONE);&lt;br /&gt;
customer.setEditable(false);&lt;br /&gt;
GridDataFactory.fillDefaults().grab(true, false).applyTo(customer);&lt;br /&gt;
&lt;br /&gt;
l = new Label(this, SWT.NONE);&lt;br /&gt;
l.setText(&amp;quot;Date:&amp;quot;);&lt;br /&gt;
GridDataFactory.fillDefaults().applyTo(l);&lt;br /&gt;
&lt;br /&gt;
date = new Text(this, SWT.NONE);&lt;br /&gt;
date.setEditable(false);&lt;br /&gt;
GridDataFactory.fillDefaults().grab(true, false).applyTo(date);&lt;br /&gt;
&lt;br /&gt;
l = new Label(this, SWT.NONE);&lt;br /&gt;
l.setText(&amp;quot;Total Price:&amp;quot;);&lt;br /&gt;
GridDataFactory.fillDefaults().applyTo(l);&lt;br /&gt;
&lt;br /&gt;
totalCost = new Text(this, SWT.NONE);&lt;br /&gt;
totalCost.setEditable(false);&lt;br /&gt;
GridDataFactory.fillDefaults().grab(true, false).applyTo(totalCost);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And finally, we have to update text fields to show the data. Modify updateUI(Model m) method to contain:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
customer.setText(m.boughtBy);&lt;br /&gt;
date.setText(m.boughtAt);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Completed code is in org.simantics.example.phases.AsyncPurchaseEditorMiddle.hava&lt;br /&gt;
&lt;br /&gt;
==Fixing the editor updates==&lt;br /&gt;
Currently the Purchase Editor loads products in the purchase when the editor is opened, but if new products are added, editor’s user interface won’t update. To fix this, modify AsyncPurhaseEditor’s setInput(Resource) method. Currently the method is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public void setInput(Resource r) {&lt;br /&gt;
    this.input = r;&lt;br /&gt;
    if (input == null)&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
    session.asyncRequest(new Read&amp;lt;Model&amp;gt;() {&lt;br /&gt;
       @Override&lt;br /&gt;
       public Model perform(ReadGraph graph) throws DatabaseException {&lt;br /&gt;
           return loadModel(graph, input);&lt;br /&gt;
       }&lt;br /&gt;
    }, new Procedure&amp;lt;Model&amp;gt;() {&lt;br /&gt;
          @Override&lt;br /&gt;
          public void exception(Throwable throwable) {&lt;br /&gt;
                ExceptionUtils.logAndShowError(throwable);&lt;br /&gt;
          }&lt;br /&gt;
          @Override&lt;br /&gt;
          public void execute(final Model result) {&lt;br /&gt;
            // Set the loaded model as the model viewed by the UI.&lt;br /&gt;
            getDisplay().asyncExec(new Runnable() {&lt;br /&gt;
               @Override&lt;br /&gt;
               public void run() {&lt;br /&gt;
                  if (isDisposed())&lt;br /&gt;
                     return;&lt;br /&gt;
                  updateUI(result);&lt;br /&gt;
               }&lt;br /&gt;
            });&lt;br /&gt;
         }&lt;br /&gt;
   });&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Hint: You have to replace the Procedure with an Listener.&lt;br /&gt;
&lt;br /&gt;
Answer:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public void setInput(Resource r) {&lt;br /&gt;
   this.input = r;&lt;br /&gt;
   if (input == null)&lt;br /&gt;
      return;&lt;br /&gt;
&lt;br /&gt;
   session.asyncRequest(new Read&amp;lt;Model&amp;gt;() {&lt;br /&gt;
      @Override&lt;br /&gt;
      public Model perform(ReadGraph graph) throws DatabaseException {&lt;br /&gt;
         return loadModel(graph, input);&lt;br /&gt;
      }&lt;br /&gt;
   }, new Listener&amp;lt;Model&amp;gt;() {&lt;br /&gt;
        @Override&lt;br /&gt;
        public boolean isDisposed() {&lt;br /&gt;
        	return AsyncPurchaseEditor.this.isDisposed();&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        @Override&lt;br /&gt;
        public void exception(AsyncReadGraph graph, Throwable throwable) {&lt;br /&gt;
        	ExceptionUtils.logAndShowError(throwable);&lt;br /&gt;
        }&lt;br /&gt;
            &lt;br /&gt;
        @Override&lt;br /&gt;
        public void execute(final Model result) {&lt;br /&gt;
            // Set the loaded model as the model viewed by the UI.&lt;br /&gt;
            getDisplay().asyncExec(new Runnable() {&lt;br /&gt;
               @Override&lt;br /&gt;
               public void run() {&lt;br /&gt;
                  if (AsyncPurchaseEditor.this.isDisposed())&lt;br /&gt;
                     return;&lt;br /&gt;
                  updateUI(result);&lt;br /&gt;
               }&lt;br /&gt;
            });&lt;br /&gt;
        }&lt;br /&gt;
    });&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this modification the editor should update its contents when the data is changed. You may try to add new product to purchase order when the editor is open to check that it really works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Completed code is in org.simantics.example.phases.AsyncPurchaseEditorMiddle2.hava&lt;br /&gt;
&lt;br /&gt;
==Adding Context Menu to Purchase Editor==&lt;br /&gt;
We are going to add context menu to Purchase editor. The context menu will be used for adding new products to a purchase.&lt;br /&gt;
&lt;br /&gt;
There are several ways to implement the context menu in Eclipse. For sake of simplicity, we are not going to implement context menu that allows contributions from plug-in definitions (plugin.xml). &lt;br /&gt;
&lt;br /&gt;
The code that Example Browser uses in its menu is in handlers.AddProductsContributionItem. Sadly, we cannot reuse that implementation, since it uses Eclipse’s selection mechanism to interpret current purchase, while we want to use the purchase that editor has opened.&lt;br /&gt;
&lt;br /&gt;
Put this class to AsyncPurchaseEditor.java:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class AddProductsContributionItem extends CompoundContributionItem {&lt;br /&gt;
&lt;br /&gt;
  public AddProductsContributionItem() {&lt;br /&gt;
    super();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  public AddProductsContributionItem(String id) {&lt;br /&gt;
    super(id);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  @Override&lt;br /&gt;
  protected IContributionItem[] getContributionItems() {&lt;br /&gt;
&lt;br /&gt;
    ProductManagerImpl manager = SimanticsUI.getProject().getHint(ProductManager.PRODUCT_MANAGER);&lt;br /&gt;
&lt;br /&gt;
    Map&amp;lt;Resource, String&amp;gt; products = manager.getProducts();&lt;br /&gt;
&lt;br /&gt;
    final Resource purchase = input;&lt;br /&gt;
            &lt;br /&gt;
    IContributionItem[] result = new IContributionItem[products.size()];&lt;br /&gt;
    int i=0;&lt;br /&gt;
    System.out.println(&amp;quot;Products count = &amp;quot; + products.size());&lt;br /&gt;
    for(Map.Entry&amp;lt;Resource, String&amp;gt; entry : products.entrySet()) {&lt;br /&gt;
      final Resource product = entry.getKey();&lt;br /&gt;
      result[i++] = new ActionContributionItem(new Action(&amp;quot;Add &amp;quot; + entry.getValue()) {&lt;br /&gt;
        @Override&lt;br /&gt;
        public void run() {&lt;br /&gt;
          SimanticsUI.getSession().asyncRequest(new WriteRequest() {&lt;br /&gt;
            @Override&lt;br /&gt;
            public void perform(WriteGraph graph) throws DatabaseException {&lt;br /&gt;
              Layer0 l0 = Layer0.getInstance(graph);&lt;br /&gt;
              if(!graph.hasStatement(purchase, l0.ConsistsOf, product))&lt;br /&gt;
                graph.claim(purchase, l0.ConsistsOf, product);&lt;br /&gt;
              }&lt;br /&gt;
           });&lt;br /&gt;
         }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
    return result;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It is the same code as handlers.AddProductsContributionItem, but the selection mechanism has been replaced with the editor input.&lt;br /&gt;
&lt;br /&gt;
To add context menu to the editor, add this code to the end of AsyncPurchaseEditor’s constructor:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
final MenuManager manager = new MenuManager();&lt;br /&gt;
manager.add(new AddProductsContributionItem());&lt;br /&gt;
Menu menu = manager.createContextMenu(productViewer.getControl());&lt;br /&gt;
&lt;br /&gt;
this.addDisposeListener(new DisposeListener() {&lt;br /&gt;
			&lt;br /&gt;
    @Override&lt;br /&gt;
    public void widgetDisposed(DisposeEvent e) {&lt;br /&gt;
	manager.dispose();&lt;br /&gt;
    }&lt;br /&gt;
});&lt;br /&gt;
        &lt;br /&gt;
productViewer.getControl().setMenu(menu);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Completed code is in org.simantics.example.phases.AsyncPurchaseEditorMiddle3.hava&lt;br /&gt;
&lt;br /&gt;
==Supporting multiple items of the same product==&lt;br /&gt;
Current ontology is designed so that one purchase order contains products, but product count cannot be stored anywhere [Figure 2].&lt;br /&gt;
&lt;br /&gt;
[[Image:simantics_db_tutorial1.png|thumb|center|700px|Figure 2: Purchases contain only links to products, and there is no way to store product count.]]&lt;br /&gt;
&lt;br /&gt;
To add support for product count we have to change the ontology. We have to introduce new type “ProductPurchase” that will have link to ordered Product and property for product count [Figure 3]. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:simantics_db_tutorial2.png|thumb|center|700px|Figure 3: Purchases contain ProductCounts that link to Products.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Open the ontology (example.pgraph) and add these to ExampleOntology:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EXAMPLE.ProductCount &amp;lt;R L0.HasProperty : L0.FunctionalRelation&lt;br /&gt;
    L0.HasDomain EXAMPLE.ProductPurchase&lt;br /&gt;
    L0.HasRange L0.Double&lt;br /&gt;
&lt;br /&gt;
EXAMPLE.ProductPurchase &amp;lt;T L0.Entity&lt;br /&gt;
    @L0.singleProperty EXAMPLE.ProductCount&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After this clean the applications workspace, since now it has a database with old ontologies.&lt;br /&gt;
 &lt;br /&gt;
To get the application working, we must update AddProductContributionsItem.java and AsyncPurchaseEditor.java. We start with the AddProduct…java. Currently its wrote transaction is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(!graph.hasStatement(purchase, l0.ConsistsOf, product))&lt;br /&gt;
   graph.claim(purchase, l0.ConsistsOf, product);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This just creates a link between the Purchase and selected Product. We need to create an instance of ProductPurchase link it to the Purchase and to selected Product:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 for (Resource productPurchase : graph.getObjects(purchase, l0.ConsistsOf)) {&lt;br /&gt;
    if (graph.hasStatement(productPurchase, l0.ConsistsOf, product)) {&lt;br /&gt;
       double amount = graph.getRelatedValue(productPurchase, e.ProductCount);&lt;br /&gt;
       graph.claimLiteral(productPurchase, e.ProductCount, amount + 1.0);&lt;br /&gt;
       return;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
	&lt;br /&gt;
Resource productPurchase = graph.newResource();&lt;br /&gt;
graph.claim(productPurchase, l0.InstanceOf, e.ProductPurchase);&lt;br /&gt;
graph.claimLiteral(productPurchase, e.ProductCount, 1.0);&lt;br /&gt;
graph.claim(purchase, l0.ConsistsOf, productPurchase);&lt;br /&gt;
 graph.claim(productPurchase, l0.ConsistsOf, product);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This code checks first if the product is already in the purchase, and increases count by one if it is.&lt;br /&gt;
&lt;br /&gt;
Then we edit AsyncPurchaseEditor.java.  Start by adding “amount” to Item:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Item {&lt;br /&gt;
   String name;&lt;br /&gt;
   double costs;&lt;br /&gt;
   double amount;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Next, change loadModel() method to read the data in current form and include product count:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (g.isInstanceOf(modelResource, ex.Purchase)) {&lt;br /&gt;
   Resource purchase = modelResource;&lt;br /&gt;
   m.boughtAt = g.getRelatedValue(purchase, ex.BoughtAt);&lt;br /&gt;
   m.boughtBy = g.getRelatedValue(purchase, ex.BoughtBy);&lt;br /&gt;
&lt;br /&gt;
   List&amp;lt;Item&amp;gt; items = new ArrayList&amp;lt;Item&amp;gt;();&lt;br /&gt;
   for (Resource productPurchase : g.getObjects(purchase, g.getBuiltins().ConsistsOf)) {&lt;br /&gt;
     	Resource product = g.getSingleObject(productPurchase, b.ConsistsOf);&lt;br /&gt;
      Item i = new Item();&lt;br /&gt;
      i.name = g.getRelatedValue(product, b.HasName);&lt;br /&gt;
      i.costs = g.getRelatedValue(product, ex.Costs);&lt;br /&gt;
      i.amount = g.getRelatedValue(productPurchase, ex.ProductCount);&lt;br /&gt;
      items.add(i);&lt;br /&gt;
   }&lt;br /&gt;
   m.items = items.toArray(new Item[items.size()]);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then update AddProductContributionItem inside AsyncPurchaseEditor.java to match the previous edit.&lt;br /&gt;
&lt;br /&gt;
To show the product count we have to add new column to the table. First, create a member for the column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private final TableViewerColumn amountColumn;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then initialize the column in the AsyncPurchaseEditor’s constructor:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
amountColumn = new TableViewerColumn(productViewer, SWT.LEFT);&lt;br /&gt;
amountColumn.getColumn().setWidth(100);&lt;br /&gt;
amountColumn.getColumn().setText(&amp;quot;Amount&amp;quot;);&lt;br /&gt;
amountColumn.setLabelProvider(new CellLabelProvider() {&lt;br /&gt;
    @Override&lt;br /&gt;
    public void update(ViewerCell cell) {&lt;br /&gt;
        Item i = (Item) cell.getElement();&lt;br /&gt;
        cell.setText(String.valueOf(i.amount));&lt;br /&gt;
    }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And last, change updateUI() method to calculate total costs correctly and update the table’s layout:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private void updateUI(Model m) {&lt;br /&gt;
   // Update the UI based on the contents of the specified model.&lt;br /&gt;
   double total = 0;&lt;br /&gt;
   for (Item i : m.items) {&lt;br /&gt;
      total += i.costs * i.amount;&lt;br /&gt;
   }&lt;br /&gt;
   totalCost.setText(String.valueOf(total));&lt;br /&gt;
&lt;br /&gt;
   customer.setText(m.boughtBy);&lt;br /&gt;
   date.setText(m.boughtAt);&lt;br /&gt;
        &lt;br /&gt;
   productViewer.setInput(m);&lt;br /&gt;
&lt;br /&gt;
   nameColumn.getColumn().pack();&lt;br /&gt;
   costColumn.getColumn().pack();&lt;br /&gt;
   amountColumn.getColumn().pack();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After these modifications, your application should look like in Figure 4.&lt;br /&gt;
&lt;br /&gt;
[[File:simantics_db_tutorial_amount.png|thumb|center|700px|Figure 4: Amount column has been added into the table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Completed code is in org.simantics.example.phases.AsyncPurchaseEditorFinal.java and completed ontology in example.pgraph.end&lt;br /&gt;
&lt;br /&gt;
[[Category: Database Development]]&lt;br /&gt;
[[Category: Tutorials]]&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=FAQ&amp;diff=3119</id>
		<title>FAQ</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=FAQ&amp;diff=3119"/>
		<updated>2013-12-05T16:44:17Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with the IDE ==&lt;br /&gt;
&lt;br /&gt;
# Q: Product does not launch from IDE&lt;br /&gt;
#: INFO: org.eclipse.core.runtime.CoreException: Plug-in org.simantics.workbench was unable to load class org.simantics.workbench.internal.SimanticsWorkbenchApplication&lt;br /&gt;
#:  java.lang.UnsupportedClassVersionError: org/simantics/workbench/internal/SimanticsWorkbenchApplication : Unsupported major.minor version 51.0&lt;br /&gt;
#: A:  Product has been compiled with a different version of Java VM than the one being launched with&lt;br /&gt;
#: Resolutions: Check Windows-&amp;gt;Preferences-&amp;gt;Java-&amp;gt;Compiler-&amp;gt;Compiler compliance level&lt;br /&gt;
#: Resolutions: Check Windows-&amp;gt;Preferences-&amp;gt;Java-&amp;gt;Installed JREs&lt;br /&gt;
&lt;br /&gt;
== Graph debugger ==&lt;br /&gt;
# Q:Relation is not shown in Graph debugger&lt;br /&gt;
#: Resolutions: Check that the relation is inherited  by using &amp;lt;R&lt;br /&gt;
#: Resolutions: Check that inverse relation has also been defined by L0.InverseOf. If the inverse relation is not defined the Graph debugger can not know how to navigate from object resource to subject resource.&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
	<entry>
		<id>https://dev.simantics.org/index.php?title=Subgraph_operations&amp;diff=3118</id>
		<title>Subgraph operations</title>
		<link rel="alternate" type="text/html" href="https://dev.simantics.org/index.php?title=Subgraph_operations&amp;diff=3118"/>
		<updated>2013-11-22T14:57:51Z</updated>

		<summary type="html">&lt;p&gt;Teemu Mätäsniemi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page discusses three common operations that handle some subgraph of the whole Simantics database.&lt;br /&gt;
They all have very similar issues:&lt;br /&gt;
* Export/import&lt;br /&gt;
** What is exported?&lt;br /&gt;
** How are references from the exported part to the unexported part handled?&lt;br /&gt;
* Copy/paste&lt;br /&gt;
** What is copied?&lt;br /&gt;
** How are references from the copied part to the uncopied part handled?&lt;br /&gt;
* Removal&lt;br /&gt;
** What is removed?&lt;br /&gt;
** How are references between the removed and the unremoved resources handled?&lt;br /&gt;
Moreover in many cases copy/paste should behave similarly to export/import&lt;br /&gt;
and immediate removal of an imported object should usually restore the database to the &lt;br /&gt;
state before import.&lt;br /&gt;
&lt;br /&gt;
== Baseline behavior ==&lt;br /&gt;
&lt;br /&gt;
First, it should be made clear, that in some cases there are more than one reasonable behaviour &lt;br /&gt;
for the operations. For example, consider an applications where graphical and semantic objects are&lt;br /&gt;
separated and the same semantic object can be represented by multiple graphical objects.&lt;br /&gt;
When the user removes a graphical object, it is possible to remove also the corresponding semantic object,&lt;br /&gt;
but it is also sensible to remove only the graphical object. Sometimes the desired behaviour can &lt;br /&gt;
be asked from the user.&lt;br /&gt;
&lt;br /&gt;
This means that the &amp;quot;correct&amp;quot; behaviour of each operation cannot be based purely on the shape of the&lt;br /&gt;
data but it should be customizable in each case separately. However, the customization cannot be &lt;br /&gt;
based solely on the type of the resource selected when the operation is requested. For example, a removal&lt;br /&gt;
of a library has a very simple behavior: its children should also be removed. However the children&lt;br /&gt;
of the library may each require different removal customization.&lt;br /&gt;
&lt;br /&gt;
In order to collect all requirements for the customizable export/import, copy/paste and removal operations,&lt;br /&gt;
we first define the &#039;&#039;baseline behaviour&#039;&#039; for the operations. The idea is that we can then collect all current cases where&lt;br /&gt;
the operations should behave differently from the baseline and this helps for choosing the right customization&lt;br /&gt;
hooks.&lt;br /&gt;
&lt;br /&gt;
Every operation targets some resource C. In some cases there can be more than one target,&lt;br /&gt;
but definitions should be easily generalizable for that case.&lt;br /&gt;
&lt;br /&gt;
A resource is &#039;&#039;external to C&#039;&#039; if&lt;br /&gt;
there is a PartOf-path leading from the resource to the root library such&lt;br /&gt;
that the path does not include C. In other words, the set of resources external&lt;br /&gt;
to C are the resources that are reachable by ConsistsOf from root library without&lt;br /&gt;
going through C. &lt;br /&gt;
&lt;br /&gt;
A resource is &#039;&#039;in the context of C&#039;&#039; if it reachable from C by statements&lt;br /&gt;
without going through any external resources.&lt;br /&gt;
&lt;br /&gt;
[[Image:Extent.png]]&lt;br /&gt;
&lt;br /&gt;
Now, we can define baseline behaviors:&lt;br /&gt;
* Export writes all resources in the context of C as internal resources to the transferable graph, together with all their statements excluding PartOf-statements from C. Resources external to C are referred by URI. C is marked the root of TG.&lt;br /&gt;
* Import creates all internal resources in TG file as new resources and adds all the statements in TG. The references to external resources are resolved by URI and if the resource does not exist a dummy resource is created. The root of the TG is attached by ConsistsOf to the target of the import operation.&lt;br /&gt;
* Copy/paste behaves just like export/import.&lt;br /&gt;
* Removal unlinks all the resource in the context of C from the external resources.&lt;br /&gt;
&lt;br /&gt;
== Exceptions to baseline behavior ==&lt;br /&gt;
&lt;br /&gt;
=== Export/import ===&lt;br /&gt;
&lt;br /&gt;
Requirements&lt;br /&gt;
* Developing import contributors a deveploper wants to list URIs of externals and possible change some of them while importing. This features enables e.g. moving of data of diagrams although different type declarations are used. Also, other kind of usage is possible. This requirement relates to a resolving of URIs feature.&lt;br /&gt;
* Developing export contributors a developer wants to know all external URIs. Thus, the developer can be aware of data which is not included into exported data.&lt;br /&gt;
&lt;br /&gt;
Design guidelines (derived from baseline behaviour and aids in export/import operations)&lt;br /&gt;
* Define a symbol of a component type in the context of the component type&lt;br /&gt;
* Define a diagram of a composite in the context of the composite&lt;br /&gt;
&lt;br /&gt;
=== Copy/paste ===&lt;br /&gt;
&lt;br /&gt;
* All diagram elements&lt;br /&gt;
** Template-diagram templatization tags must be removed (MOD.IsTemplatized)&lt;br /&gt;
** Generate fresh names for all copied elements within the target diagram&#039;s context&lt;br /&gt;
** Include element in the target diagram&#039;s ordered set&lt;br /&gt;
** Add database metadata comment for element copy&lt;br /&gt;
&lt;br /&gt;
In addition, follow these rules for specific element types:&lt;br /&gt;
* Diagram reference elements&lt;br /&gt;
** Assertion: Copying must ensure that MOD.HasParentComponent correctly refers to the copied parent component&lt;br /&gt;
** Offset all copied element positions based on the paste specification&lt;br /&gt;
* Diagram connections&lt;br /&gt;
** Move connection to front of the target diagram&#039;s ordered set to push it behind all other elements&lt;br /&gt;
** Offset each route line in the connection by the offset specified in the paste specification based on the route line direction (horizontal/vertical)&lt;br /&gt;
* Diagram flags&lt;br /&gt;
** Offset all copied element positions based on the paste specification&lt;br /&gt;
** If flag is disconnected after copy, remove its L0.HasLabel.&lt;br /&gt;
** If flag and its counterpart were both copied and the flag pair is diagam-local, FlagLabelingScheme must be used to set the same L0.HasLabel for both flags.&lt;br /&gt;
* Diagram monitors&lt;br /&gt;
** If the component the monitors refers to (DIA.HasMonitorComponent) a component that was not included in the copy, the monitor element position must be recalculated to be:&lt;br /&gt;
*** original monitored element world position + offset from paste specification&lt;br /&gt;
* Other diagram elements&lt;br /&gt;
** Offset all copied element positions based on the paste specification&lt;br /&gt;
&lt;br /&gt;
=== Removal ===&lt;br /&gt;
&lt;br /&gt;
* Component types (and other types)&lt;br /&gt;
** If the type has instances the operation must be cancelled or all the instances must be removed&lt;br /&gt;
* Connection points, properties (and other relations)&lt;br /&gt;
** If the relation is used somewhere the operation must be cancelled or the corresponding statement must be removed.&lt;br /&gt;
* Components&lt;br /&gt;
** If component is created by mapping from a diagram the corresponding diagram elements should also be removed&lt;/div&gt;</summary>
		<author><name>Teemu Mätäsniemi</name></author>
	</entry>
</feed>