-
Notifications
You must be signed in to change notification settings - Fork 1
Syntax
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.
An .ontol file is composed of several blocks that define different aspects of the ontology:
Defines the types or classes within the ontology. Each type has a name, label, and description.
types:
typeName: 'Label', 'Description'
Describes functions or operations, specifying input and output types.
functions:
functionName: 'Label' (inputType: 'Argument1', inputType: 'Argument2') -> outputType: 'OutputLabel'
Specifies hierarchical relationships between types.
hierarchy:
ParentType relationshipType ChildType, {direction: 'relationshipDirection'}
Defines visual representations of parts of the ontology.
figure 'FigureName':
TypeName
FunctionName
RelationshipName
- 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 provide additional metadata for types, functions, and relationships. They are defined within curly braces {} following the main definition.
- Label: A human-readable name for the element.
- Description: A detailed description of the element.
- Type: Specifies the relationship type for functions.
- Direction: Indicates the direction of the relationship.
Comments can be added using the # symbol. They are ignored by the parser.
# This is a comment
types:
# Type definition
TypeName: 'Label', 'Description'
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.