Using TMCore Public Views And Functions

The TMCore engine installs a number of public views and user-defined functions into the SQL database. These views and functions are easily identified as they have names starting with the prefix "tm_". These views and functions are documented in the TMCore Query Reference Sheet.

Warning

You are strongly advised NOT to write queries which make use of the private tables and views as these may be subject to change either in structure or in content in future versions of the software and so an upgrade may cause your queries to function in unexpected ways.

You can use these views and functions in exactly the same way as you would use any normal SQL view or function. For example you can use the tm_displayName function to transform a topic id into a display name for the topic. For example the query:

select tm_displayName(r1p) from tm_assoc where association_id=123

would return the display name for each topic which plays a role in the association with the ID "123". Some of the functions defined by TMCore return table values which allows you to use them in a select or sub-select. For example you can use the tm_instanceOf function to return the classes and superclasses of a topic with a query such as:

select class_id from tm_instanceOf(tmtopic, NULL)

where tm and topic should be replaced with the ID value of the topic map and the instance topic respectively.

A full tutorial on the SQL query language is beyond the scope of this document. The TMCore Query Reference Sheet gives full documentation of each view and query provided by TMCore.