Skip to main content

Views

This section is about Timbr SQL Data Definition Language (DDL) queries to create and edit views in an ontology.


Create an ontology view

Create an ontology view which can be based on the ontology or the underlying datasources.

Required information for create an ontology view (the curly brackets {} should not be an input, they are used only as a variable substitution):

  • {view_name} - The name of the ontology view you want to create
  • {sql_for_view} - The SQL statement for the view you want to create
CREATE ONTOLOGY VIEW `{view_name}` AS {sql_for_view};
Creating a view with tags

You can also specify creating a view with tags by default in the create statement.

  • {tag_name} - The name of the tag to be associated with the view
  • {tag_value} - The value for the tag associated with the view
CREATE ONTOLOGY VIEW `{view_name}` WITH TAGS (`{tag_name}` = `{tag_value}`) AS {sql_for_view};
Create or replace ontology view with or without previous tags

Instead of running CREATE ONTOLOGY VIEW... command, some users prefer running CREATE OR REPLACE ONTOLOGY VIEW overwriting the previous ontology view. In those cases, a user may choose to maintain the previousely set tags of the ontology view or remove them

  • If you run a CREATE OR REPLACE command omitting the WITH TAGS (...) parts, then the previously set tags will be maintained
  • If you wish to remove the tags as well, then you can add to the CREATE OR REPLACE STATEMENT the part of WITH TAGS() and then the previousely set tags will also be removed.

Show SQL create ontology view statement

Required information for show create concept (the curly brackets {} should not be an input, they are used only as a variable substitution):

  • {view_name} - The name of the ontology view you want to show a create statement for.
SHOW CREATE ONTOLOGY VIEW `{view_name}` 

Change ontology view description

Changes the description of an ontology view

Required information for changing the description of an ontology view (the curly brackets {} should not be an input, they are used only as a variable substitution):

  • {view_name} - The name of the ontology view you want to associate the description with
  • {view_description} - A string representing the description associated with the ontology view
ALTER ONTOLOGY VIEW `{view_name}` SET DESCRIPTION='{view_description}'

Create or update a tag of an ontology view

Create or update a tag of an ontology view

Required information for create or update a tag of an ontology view (the curly brackets {} should not be an input, they are used only as a variable substitution):

  • {ontology_view_name} - The name of the ontology view you want to add the tag to
  • {tag_name} - The tag key (name) to be added or updated to the ontology view
  • {tag_value} - The tag value to be associated with the tag key of the ontology view
ALTER ONTOLOGY VIEW `{ontology_view_name}` UPDATE TAG `{tag_name}`='{tag_value}';

Remove a tag from an ontology view

Remove a tag of an ontology view

Required information for removing a tag of an ontology view (the curly brackets {} should not be an input, they are used only as a variable substitution):

  • {ontology_view_name} - The name of the ontology view you want to remove the tag from
  • {tag_name} - The tag key (name) to be removed from the ontology view
ALTER ONTOLOGY VIEW `{ontology_view_name}` DROP TAG `{tag_name}`;

Remove an ontology view

Removes an ontology view from an ontology

Required information for removing an ontology view from the ontology (the curly brackets {} should not be an input, they are used only as a variable substitution):

  • {view_name} - The name of the mapping you want to remove
DROP ONTOLOGY VIEW  `{view_name}`;