Namespace metamodel

xeokit Legacy MetaModel Utilities


Utilities for importing and migrating semantic data from xeokit's legacy MetaModel format.


This module helps you move from xeokit's older MetaModel format to the newer DataModel, which represents semantic information as an entity–relationship graph with property sets.

You can either:

  • Load legacy MetaModel data directly into a DataModel, or
  • Convert MetaModel data into DataModelParams first, then load it explicitly


xeokit's legacy MetaModel format represents a simple hierarchy of entities with attached property sets. While still supported for compatibility, it has been superseded by the DataModel, which offers a richer and more flexible semantic representation.

This module provides utilities to bridge the two formats.

  • convertMetaModel Converts a MetaModelParams object into a DataModelParams object.
  • MetaModelLoader Loads a MetaModelParams object directly into an existing DataModel.
  • DataModel The modern semantic data model used by xeokit, based on entity–relationship graphs.
  • DataModelParams The JSON format used to populate a DataModel.
  • MetaModelParams The legacy JSON format describing a hierarchy of entities with property sets.

Install the xeokit SDK using npm:

npm install @xeokit/sdk

The following examples show two common migration workflows.


Use MetaModelLoader when you want to load legacy MetaModel data straight into a DataModel without creating intermediate parameters.

import { Data } from "@xeokit/sdk/data";
import { MetaModelLoader } from "@xeokit/sdk/formats/metamodel";

const data = new Data();

const dataModelResult = data.createModel({
id: "myModel"
});

const dataModel = dataModelResult.value;
const metaModelLoader = new MetaModelLoader();

fetch("myMetaModel.json").then(response => {
response.json().then(metaModelParams => {
// Load MetaModelParams directly into the DataModel
metaModelLoader.load({
fileData: metaModelParams,
dataModel
});
});
});

Use convertMetaModel when you want access to DataModelParams—for example, to inspect, modify, or store the converted data before loading it.

import { Data } from "@xeokit/sdk/data";
import { convertMetaModel } from "@xeokit/sdk/metamodel";

const data = new Data();

const dataModelResult = data.createModel({
id: "myModel"
});

const dataModel = dataModelResult.value;
fetch("myMetaModel.json").then(response => {
response.json().then(metaModelParams => {
// Convert MetaModelParams -> DataModelParams
const dataModelParams = convertMetaModel(metaModelParams);

// Load DataModelParams into the DataModel
dataModel.fromParams(dataModelParams);
});
});

Classes

MetaModelLoader

Interfaces

MetaModelParams
MetaObjectParams
MetaPropertyParams
MetaPropertySetParams

Functions

convertMetaModel