Skip to content


A ShapeType is an interface that contains information required by LDO to create a Linked Data Object. ShapeTypes are generated by the @ldo/cli build command, and it contains the following data:

  • ShEx Schema
  • Generated Typescript Typings
  • Generated Context


The following is the ShapeType generated for the example FoafProfile.shex file.

import { ShapeType } from "ldo";
import { foafProfileSchema } from "./foafProfile.schema";
import { foafProfileContext } from "./foafProfile.context";
import { FoafProfile } from "./foafProfile.typings";

 * FoafProfile ShapeType
export const FoafProfileShapeType: ShapeType<FoafProfile> = {
  schema: foafProfileSchema,
  shape: "",
  context: foafProfileContext,

This can be imported and used to create a Linked Data Object.

import { FoafProfileShapeType } from "./.ldo/foafProfile.shapeTypes";
import { FoafProfile } from "./.ldo/foafProfile.typings";

const profile: FoafProfile = ldoDataset


type ShapeType<Type extends LdoBase> = {
  schema: Schema;
  shape: string;
  context: ContextDefinition;
  exampleData?: Type;


  • schema: The ShEx Schema
  • shape: The key of the shape within the schema to which this ShapeType refers
  • context: A JSON-LD context generated for this Schema
  • exampleData (Optional): This field is optional and the @ldo/cli build command will not provide this field. The exampleData field's primary purpose is to force the TypeScript parser to recognize the provided Type so it can be auto-inferenced in the LdoDataset.usingType method.