Tutorial: Ontology Development: Difference between revisions

From Developer Documents
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 7: Line 7:
Our organization is Acme Software ltd and from there is our plug-in name derived, ''com.acme.movie.ontology''. Insert that as project name. In the following page you should know that this plugin does not contribute to UI, does not need activator or isn't a rich client application.
Our organization is Acme Software ltd and from there is our plug-in name derived, ''com.acme.movie.ontology''. Insert that as project name. In the following page you should know that this plugin does not contribute to UI, does not need activator or isn't a rich client application.


===Setup Graph Building Nature===
Next, add Graph builder into the project nature. You need to modify a file called '''workspace/com.acme.movie.ontology/.project''', and to do this Eclipse must be closed for changes to apply.  
Next, add Graph builder into the project nature. You need to modify a file called '''workspace/com.acme.movie.ontology/.project''', and to do this Eclipse must be closed for changes to apply.  


Line 59: Line 60:




Good, fire up the Eclipse again. If everything went well "Graph Builder" ought to be visibile in the properties of the project file.
Good, fire up the Eclipse again. If everything went well "Graph Builder" ought to be visibile in the properties of the project file. Like so:
 
Also create dictory called graphs, and there a file Movie.pgraph.
 
=== Configure MANIFEST.MF ===
Your ontology well depend on Layer0, so open META-INF/MANIFEST.MF in a editor and add org.simantics.layer0 to plug-in dependencies.
 
Also, you are going to
*Export package com.acme.movie.ontology
 
Your MANIFEST.MF should look like this.
<pre>
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ontology
Bundle-SymbolicName: com.acme.movie.ontology
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: ACME
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.simantics.layer0;bundle-version="1.0.0"
Export-Package: com.acme.movie.ontology
</pre>
 
=== Developing the ontology ===
Open Movie.pgraph and start editing.

Revision as of 10:47, 6 October 2010

Step 1: Ontology Plug-in

Ontologies are encapsulated in OSGi bundles. In eclipse we develop them as equinox plug-ins. It contains ontology sources (graph/*.pgraph), compiled graph file (graph.tg), and Java resource files (src and bin).

Open a New Plug-in Project wizard:

  • Select File >> New >> Plug-in Development >> Plug-in Project

Our organization is Acme Software ltd and from there is our plug-in name derived, com.acme.movie.ontology. Insert that as project name. In the following page you should know that this plugin does not contribute to UI, does not need activator or isn't a rich client application.

Setup Graph Building Nature

Next, add Graph builder into the project nature. You need to modify a file called workspace/com.acme.movie.ontology/.project, and to do this Eclipse must be closed for changes to apply.

The file look like this:

  <?xml version="1.0" encoding="UTF-8"?>
  <projectDescription>
	<name>com.acme.movie.ontology</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.pde.ManifestBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.pde.SchemaBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.pde.PluginNature</nature>
		<nature>org.eclipse.jdt.core.javanature</nature>
	</natures>
  </projectDescription>

Add the following insertions:

	<buildSpec>
		<buildCommand>
			<name>org.simantics.graph.builder</name>
			<arguments>
			</arguments>
		</buildCommand>
                ...

and

	<natures>
                <nature>org.simantics.graph.nature</nature>
                ...


Good, fire up the Eclipse again. If everything went well "Graph Builder" ought to be visibile in the properties of the project file. Like so:

Also create dictory called graphs, and there a file Movie.pgraph.

Configure MANIFEST.MF

Your ontology well depend on Layer0, so open META-INF/MANIFEST.MF in a editor and add org.simantics.layer0 to plug-in dependencies.

Also, you are going to

  • Export package com.acme.movie.ontology

Your MANIFEST.MF should look like this.

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ontology
Bundle-SymbolicName: com.acme.movie.ontology
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: ACME
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.simantics.layer0;bundle-version="1.0.0"
Export-Package: com.acme.movie.ontology

Developing the ontology

Open Movie.pgraph and start editing.