Skip to content
Vladimir Skvortsov edited this page Mar 25, 2025 · 1 revision

The Ontol DSL (Domain Specific Language) is designed to define and represent ontologies in a structured and intuitive manner. This page provides an overview of the syntax used in Ontol DSL, which you can use to create .ontol files for parsing.

Basic Structure

An .ontol file is composed of several blocks that define different aspects of the ontology:

Types Block

Defines the types or classes within the ontology. Each type has a name, label, and description.

types:
typeName: 'Label', 'Description'

Functions Block

Describes functions or operations, specifying input and output types.

functions:
functionName: 'Label' (inputType: 'Argument1', inputType: 'Argument2') -> outputType: 'OutputLabel'

Hierarchy Block

Specifies hierarchical relationships between types.

hierarchy:
ParentType relationshipType ChildType, {direction: 'relationshipDirection'}

Figure Block

Defines visual representations of parts of the ontology.

figure 'FigureName':
  TypeName
  FunctionName
  RelationshipName

Keywords

  • IMPORT: Used to include definitions from other files or URLs.
import {TypeName, FunctionName} from 'source.ontol'
  • FROM: Specifies the source of the import.
  • AS: Allows aliasing imported definitions.

Attributes

Attributes provide additional metadata for types, functions, and relationships. They are defined within curly braces {} following the main definition.

Common Attributes

  • Label: A human-readable name for the element.
  • Description: A detailed description of the element.

Function Attributes

  • Type: Specifies the relationship type for functions.

Relationship Attributes

  • Direction: Indicates the direction of the relationship.

Comments

Comments can be added using the # symbol. They are ignored by the parser.

# This is a comment
types:
  # Type definition
  TypeName: 'Label', 'Description'

Example

Here's a simple example of an .ontol file:

types:
  Person: 'Person', 'A human being', {attribute: 'value'}

functions:
  knows: 'Knows' (Person: 'Subject') -> Person: 'Object', {type: 'association'}

hierarchy:
  Person parentOf Person, {direction: 'forward'}

figure 'Social Network':
  Person
  knows

This example defines a basic ontology for a social network, including types, a function, and a hierarchical relationship.

Clone this wiki locally