Difference between revisions of "Check list: Model browser contributions"

From Developer Documents
Jump to navigation Jump to search
(Created page with "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...")
 
Line 2: Line 2:
  
 
== Step 1: Ontology Plug-in ==
 
== Step 1: Ontology Plug-in ==
Define a new library (www.mylib.fi) for ontology under Simantics root (''http://''):
+
Define a new ontology plugin (org.mylib.ontology)
MyLib = <''http://www.mylib.fi''> : L0.Library
+
 
''    @L0.new''
+
Include the following definitions into your ontology file (*.pgraph)
 +
<nowiki>L0 = <http://www.simantics.org/Layer0-1.1>
 +
VP = <http://www.simantics.org/Viewpoint-1.2>
 +
ACT = <http://www.simantics.org/Action-1.1></nowiki>
 +
 
 +
Define a new library (www.mylib.fi) for your ontology under Simantics root (''http://''):
 +
<nowiki>MY_LIB = <http://www.mylib.org> : L0.Library
 +
  @L0.new</nowiki>
 +
 
 +
Define your ontology  under the library and specify its ResourceClass
 +
<nowiki>MY_ONTOLOGY = <http://www.mylib.org/MyOntology-1.0> : L0.Ontology
 +
  @L0.new
 +
  L0.HasResourceClass "org.mylib.Resource" : L0.String</nowiki>
 +
 
 +
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.
 +
<nowiki>Name: http://www.mylib.org/MyOntology</nowiki>
 +
 
 +
Export the package (org.mylib) of ResourceClass in MANIFEST.MF/Runtime/Exported Packages.
 +
 
 +
Define a new context and include it into ModelingActionContext
 +
<nowiki>MY_AC = MY_ONTOLOGY.MyActionContext : VP.BrowseContext
 +
  VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext</nowiki>
 +
 
 +
Define a new ActionContribution for each action in this context
 +
<nowiki>MY_AC
 +
VP.BrowseContext.HasActionContribution _ : VP.ActionContribution
 +
  L0.HasLabel "My action..."       
 +
  VP.ActionContribution.HasAction MY_LIB.MyAction : ACT.Action
 +
  VP.ActionContribution.HasNodeType
 +
  L0.Entity

Revision as of 11:28, 3 July 2017

To avoid typical errors while defining ontology contributions to model browser follow the following check list:

Step 1: Ontology Plug-in

Define a new ontology plugin (org.mylib.ontology)

Include the following definitions into your ontology file (*.pgraph)

L0 = <http://www.simantics.org/Layer0-1.1>
VP = <http://www.simantics.org/Viewpoint-1.2>
ACT = <http://www.simantics.org/Action-1.1>

Define a new library (www.mylib.fi) for your ontology under Simantics root (http://):

MY_LIB = <http://www.mylib.org> : L0.Library
  @L0.new

Define your ontology under the library and specify its ResourceClass

MY_ONTOLOGY = <http://www.mylib.org/MyOntology-1.0> : L0.Ontology
  @L0.new
  L0.HasResourceClass "org.mylib.Resource" : L0.String

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.

Name: http://www.mylib.org/MyOntology

Export the package (org.mylib) of ResourceClass in MANIFEST.MF/Runtime/Exported Packages.

Define a new context and include it into ModelingActionContext

MY_AC = MY_ONTOLOGY.MyActionContext : VP.BrowseContext
  VP.BrowseContext.IsIncludedIn MOD.ModelingActionContext

Define a new ActionContribution for each action in this context

<nowiki>MY_AC
VP.BrowseContext.HasActionContribution _ : VP.ActionContribution
 L0.HasLabel "My action..."        
 VP.ActionContribution.HasAction MY_LIB.MyAction : ACT.Action
 VP.ActionContribution.HasNodeType
  L0.Entity