OWL and Coins sample

Uit COINS2
Ga naar: navigatie, zoeken

On this page the use of OWL according to Coins 2.0 is more clarified using a step-by-step approach.

OWL editor

When you want to study the OWL and Coins principles we recommend to install an OWL editor, see Tools.

Preparations

We will use TopBraid Composer (TBC), because it has a free version.

It can be downloaded from TopBraidComposer download.

  • choose Free edition at the Product selection
  • choose your Operating System (OS), like Windows
  • choose bits, in general 64-bits

Now you can download the software.

  • Unzip the download in a folder you choose
  • select in this folder the file "TopBraid Composer.exe"
  • double click on it to start the application

Next, you need these Coins files, download these and put them into a folder of your choice.

Start a new project

We have to tell TBC that we want to use the Coins ontology. Therefore, we need to import these in our project. Besides, you have to import these in the files also.

First we need to place the COINS files in a project before we can import them in our own ontologies. It is also possible to use the urls for importing the Coins ontologies.

TBC Create new project
  • Within TBC start the "New Project" wizard by using the pulldown menu File and activate New\Project
  • Click on the Next button
TBC Add project name
  • Give your project a name and set the location
  • Click on the Finish button
TBC Import into Project
  • Select your project
  • Use your Right Mouse Button
  • and select Import...
TBC Import Wizard
  • Select File System
  • Press on the Next button
TBC Select Coins files
  • Select the folder where the Coins files are stored
  • Select the files
    • Cbim-2.0.rdf
    • units-2.0.rdf
  • Press the Finish button

Create your own files and import Coins

Now, you are ready to create your own files. In this case, we will make 2 files:

  • myLibrary; file that contains the definitions of objects (like a bridge, pile, etc.)
  • mySample; file that contains the instance data (like bridge 35, pile 6534, etc.)

First we will create myLibrary and import the 2 Coins files into that. Next, mySample will be created. We will import the 2 Coins files and the myLibrary file. Because, this library will be used by the instances in mySample.

TBC Create myLibrary
  • set the name for your Base URI, eg. http://coins.strukton.com/myLibrary
  • set the filename, eg myLibrary
  • set filetype to RDF/XML
  • select nothing for intial imports
  • select "Set a default namespace in the new file"
  • press the Finish button
TBC Import Coins into myLibrary
  • Be sure that myLibrary.rdf is active now. An arrow pointing to right will show that this file is active.
  • Press now on the button "Import local file..." on the Imports tab
TBC Select Coins files for import into myLibrary
  • first, select your project (workspace)
  • next, select the 2 Coins files (cbim-2.0 and units-2.0)
  • press the OK button
TBC Import Coins and myLibrary into mySample
  • repeat this for mySample
  • however, select the myLibrary file also. In this way, you are able to use objects in your library as well.
  • press the OK button

Now, you are ready for creating Coins objects...

Creating a Bench object

This sample is used to show how easy it is to create a simple instance of an object.

TBC Create my first Coins object
  • be sure that mySample is the active document
  • in the Classes panel open the tree structure and look for cbim-2.0:Object
  • select this and use the right mouse button
  • activate the command "Create instance"
TBC Set Name of the new resource
  • set the Name of the new resource, eg. myBench1. In general, the software will use a GUID for this. However, for explaining it is better to use a logic name
  • press the OK button
TBC MyBench1 created
  • notice that in the Resource form the Name is set and there is set 1 between brackets after the cbim-2.0:object in the Classes panel. This indicates that there is one instance of an object defined.
TBC Set Name
  • in the Resource Form select cbim-2.0:name and press the arrow pointing down
  • activate "Add empty row"
TBC Set Name
  • fill in the name of your object, eg. Couch
  • notice that an icon appears showing an S, this tells that TBC recognices this as a string. For floats, datetime and other datatypes there are other icons.

Results of our first Coins object

Now, our first object can be exchanged in several ways (different serialisations). Because, we use OWL it is possible to exchange the data via a number of formats like:

  • RDF/XML
  • JSON
  • Turtle
  • N-triple
TBC Different serialisations
  • with TBC you can switch to Source code and use the radio buttons to try the different formats available

This Source code is a quick preview of this object, only. When you want to see the total file itself execute the following steps:

  • first, be sure to save your changes into mySample.rdf. Already, we told TBC that the filetype for mySample must be RDF/XML
  • now, open this mySample.rdf file in eg. Notepad
<?xml version="1.0"?>
<rdf:RDF
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:owl="http://www.w3.org/2002/07/owl#"
   xmlns="http://coins.strukton.com/mySample#"
   xmlns:myLibrary="http://coins.strukton.com/myLibrary#"
   xmlns:cbim-2.0="http://www.coinsweb.nl/cbim-2.0.rdf#"
   xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
 xml:base="http://coins.strukton.com/mySample">
 <owl:Ontology rdf:about="">
   <owl:imports rdf:resource="http://www.coinsweb.nl/units-2.0.rdf"/>
   <owl:imports rdf:resource="http://coins.strukton.com/myLibrary"/>
   <owl:imports rdf:resource="http://www.coinsweb.nl/cbim-2.0.rdf"/>
 </owl:Ontology>
 <cbim-2.0:Object rdf:ID="myBench1">
   <cbim-2.0:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
   >Couch</cbim-2.0:name>
 </cbim-2.0:Object>
</rdf:RDF>

See also

Create objecttype library within Coins