![]() | ![]() |
| Home Download Getting started Creating an application User interface Documentation Basic text analysis Pattern search Creating a corpus Advanced topics Custom properties Licence About ![]() | Custom propertiesIn this section a transportation ontology (called trans) is used to illustrate the mechanism to add custom properties. Two properties, beyond the standard ones in tOKo, are defined: hasNoWheels and canTransport. These properties allow statements such as "A bicycle has two wheels" and "A train can transport a bicycle" to be represented. Two steps are required to make custom properties available to the user of an application: (1) Defining the properties in RDFS; (2) Adding buttons for the properties to the user interface. Defining the propertiesEach application defines a set of meta-classes in the file trans_meta.rdfs (if the application is called trans). This file is automatically created with the application. The two properties required for the transportation ontology are given below: <rdf:Property rdf:about="&trans;hasNoWheels"
rdfs:comment="Number of wheels"
rdfs:label="hasNoWheels">
<rdfs:domain rdf:resource="&trans;TRANS_Class"/>
<rdfs:range rdf:resource="&rdfs;Literal"/>
<rdfs:subPropertyOf rdf:resource="&trans;property"/>
</rdf:Property>
<rdf:Property rdf:about="&trans;canTransport"
rdfs:comment="Subject can transport the object"
rdfs:label="canTransport">
<rdfs:domain rdf:resource="&trans;TRANS_Class"/>
<rdfs:range rdf:resource="&trans;TRANS_Class"/>
<rdfs:subPropertyOf rdf:resource="&trans;property"/>
</rdf:Property>Note that hasNoWheels has an rdfs:range that is a literal and canTransport a range that is any other trans concept. The line with subPropertyOf tells tOKo it should display the property value on the terminology tab. The custom property definitions are normally added to trans_meta.rdfs. Buttons for the propertiesThe default toolbar contains buttons to create sub-concepts, define synonyms and so forth. The buttons for custom properties are defined in the knowledge base for the application (trans_fill.xml). Examples of button definitions are: <button name="button for hasNoWheels">
<property name="trans:hasNoWheels"/>
<icon colour="green" shape="circle" tooltip="Number of wheels"/>
</button>
<button name="button for canTransport">
<property name="trans:canTransport"/>
<icon src="canTransport.xpm" tooltip="Add property: canTransport"/>
</button>The name given with property corresponds to the property as defined in the meta definition. The icon can either be a simple shape (circle or box) with a coloured interior or an image (16x16 pixels in either gif, jpeg or XPM format). Icons should be stored in the icons directory of the application. User interfaceThe user interface for defining custom properties is precisely the same as that for the built-in properties:
|