Skip to content
0x65 edited this page Mar 20, 2023 · 3 revisions

Welcome to the OML Alexandria wiki! OML Alexandria is a Visual Studio Code extension that provides language support for Ontological Modeling Language (OML), a language for defining systems engineering vocabularies and using them to describe systems. It is the first extension to support OML in popular browser-based editors like Github Codespaces, gitpod.io, and Coder by running the language server entirely in the extension.

Getting Started

To install the extension, search the Visual Studio Code Extension Marketplace for "OML Alexandria", or download the pre-built latest release and select "Install from VSIX" in the VSCode Extensions tab.

If you'd like to contribute to development, please follow the instructions in the README to build the latest development version.

Features

Syntax Highlighting

Syntax highlighting is performed automatically for .oml files when the extension is installed. For best results, keep your files well-formatted (e.g. declarations on a single line, facets and properties on their own lines).

Syntax highlighting example

Validation

Basic syntactic and semantic validation is performed automatically for .oml files when the extension is installed. For example, trying to specialize a Concept with an Aspect results in an error, as does redefining an element:

[https://i.imgur.com/ivKk0DF.png](Validation error example)

The extension will also show warnings for possible semantic mistakes. For example, a Term specializing itself or specializing the same Term twice. This also includes a user-defined FacetedScalar which does not specialize one of the standard scalars.

Validation warning example

Language Server Support

The extension provides most language server features that you may be familiar with from programming languages:

  1. Go To Definition
  2. Find All References
  3. Rename Symbol
  4. Autocompletion for keywords and symbols

If you have custom keyboard shortcuts bound to these actions in your editor, they should work with OML Alexandria as well.

You can hover over any defined element to see useful information, including its type, the namespace of its owning ontology, any specializations, and any annotation properties defined on it (e.g. rdfs:comment). Note that this only works for properties defined on the original definition, and not on references.

Hover text

Diagram Visualization

You can visualize your OML files as a diagram by selecting the "Open in Diagram" command. This command can be accessed in a variety of ways:

  • through the context menu by right-clicking inside an active file
  • at the top right of the navigation bar (when the active file is an OML file)
  • through the context menu by right-clicking on an OML file in the Explorer window
  • through the Command Palette, when an OML file is active

You can also bind a custom keyboard shortcut to the oml.diagram.open command.

The "Open in Diagram" command will open a new split window with a visualization of your OML file:

  • Types (Aspects, Concepts, Scalars) are represented as boxes
  • Specializations are represented as closed arrows between boxes
  • Semantic Properties (Scalar and Structured Properties) are represented as properties on their respective Types
  • Property Restriction Axioms are represented using mathematical notation as properties on their respective Types
  • Relations are represented as open arrows between boxes, annotated with the name of the relation
  • Relation Restriction Axioms are represented using mathematical notation on relation arrows between their respective Types

[https://i.imgur.com/tkjAt2U.png](Sprotty webview example)

PlantUML Generation

You can generate PlantUML diagrams from an OML file by selecting the "Generate UML" command. This will open a read-only document containing a PlantUML diagram source in a new editor tab. If you have extensions installed to visualize PlantUML diagrams, they should be able to operate on this file. When you install OML Alexandria, it will prompt you to install Jebbs' PlantUML extension (jebbs.plantuml), which is one popular extension for visualizing PlantUML diagrams. You are free to choose your preferred PlantUML extension; OML Alexandria just generates the PlantUML source.

UML example

The "Generate UML" command is available in all the same places as the "Open in Diagram" command. You can also bind a custom keyboard shortcut to the oml.generate.uml command.

Please note that this feature is experimental, and there may be cases where the generated PlantUML source does not correctly represent your OML ontology. It is always recommended that you inspect the generated PlantUML source thoroughly to ensure it corresponds to your expectations. If you wish to edit the generated PlantUML, you must first save the output as a file, which you can do through the Visual Studio Code editors.

Support for vscode.dev

OML Alexandria is not a web extension, and is not compatible with vscode.dev (which includes github.dev and any other VS Code for the Web instance).