Skip to main content

Semantic types

Unlike Excel, table columns in Datagrok are strongly-typed, meaning all cells are of one of the predefined data types (string, int, bigint, qnum, double, datetime, bool). In addition to that, a column might also have semantic type associated with it. Semantic type identifies the meaning of the data. For instance, a column could be of the data type "string", but the semantic type would be "country".

Semantic types are used in several ways:

  • Rendering. It is possible to define a custom renderer defined for the semantic type. For instance, in the #{x.Demo:Smiles} project strings with the semantic type "molecule" get rendered as chemical structures.
  • Viewers. Some viewers, such as Map, use semantic type to determine whether a viewer can be visualized against specific datasets, as well as for the initial choice of columns to visualize.
  • Functions. Function parameters could be annotated with the semantic type. This is used for automatic suggestions of applicable functions.
  • Predictive models. Just like functions, semantic type annotations are used to determine whether or not a model is applicable to the dataset.

A column can have only one semantic type. It is stored in the column tags and can be either detected automatically by semantic type detectors or set manually.

Manually setting semantic types

Open the Context Panel and go to the Details tab to set the 'Semantic type' field. Alternatively, open column properties (click a column and press F2, or right-click the column and select Column Properties...) and set the quality and cell.renderer tags.

Column Properties

Automatic semantic type detection

Out of the box, the following semantic types are automatically detected based on the content:

Semantic typeValueRequired plugins
Cheminformatics types
MoleculeMoleculeChem
SubstructureSubstructureChem
Chemical mixture (Mixfile format)ChemicalMixtureChem
Bioinformatics types
MacromoleculeMacromoleculeBio
HELMHELMBio
Phylogenetic treesNewickBio
Molecule 3DMolecule3DBiostructure Viewer
PDB identifiersPDB_IDBiostructure Viewer
General types
TextText-
DurationDuration-
GenderGender-
MoneyMoney-
ImageImage-
FileFile-
URLURL-
IP addressIP Address-
Contact information
EmailEmail Address-
Phone numberPhone Number-
Geographic data
CityCity-
CountryCountry-
StateState-
CountyCounty-
Place namePlace Name-
Zip codeZip Code-
Area codeArea Code-
Street addressStreet Address-
LatitudeLatitude-
LongitudeLongitude-
Specialized types
Curve datafitCurves
PNG imagesrawPngCurves

Custom semantic types

Datagrok has been designed to be as extensible as possible, so naturally it is possible to define your own custom semantic types, along with the type auto-detection functions, renderers, comparers, and so on. To do that, check out this article .

Custom Semantic Type Magnitude

See also: