Namespace metamodel

xeokit Legacy MetaModel Utilities


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

This module provides functions for converting and loading legacy MetaModel data into xeokit's newer semantic data model, the DataModel, which is based on an entity-relationship graph with property sets.




Overview

This module includes functions that help you migrate from xeokit's legacy MetaModel format to the newer DataModel format.

Key functions:

  • convertMetaModel: Converts a MetaModelParams object into a DataModelParams object.
  • loadMetaModel: Loads a MetaModelParams object directly into a DataModel instance.
  • DataModel: The newer, semantic data model in xeokit based on entity-relationship graphs and property sets.
  • DataModelParams: The JSON data format that can be loaded into a DataModel.
  • MetaModelParams: The older JSON data format representing a simple entity hierarchy with property sets.

Installation

To install the xeokit SDK, run the following npm command:

npm install @xeokit/sdk

Usage

The following example shows how to use loadMetaModel to load a MetaModelParams file directly into a DataModel instance:

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

const data = new Data();
const dataModel = data.createModel({
id: "myModel"
});

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

This example demonstrates how to use convertMetaModel to convert a MetaModelParams file into a DataModelParams object, and then load that into a DataModel.

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

const data = new Data();
const dataModel = data.createModel({
id: "myModel"
});

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

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

Interfaces

MetaModelParams
MetaObjectParams
MetaPropertyParams
MetaPropertySetParams

Functions

convertMetaModel
loadMetaModel