Skip to main content
These reads tell you what the graph can hold: the types, the shapes that structure them, and the relationships between them. You author this structure in the Shapes Workbench; here you read it at run time.

pb.ontology

Read the active ontology as a document.
const ontology = await pb.ontology({ format: "markdown" });
console.log(ontology.markdown || ontology.content);
format
string
default:"markdown"
Output format, for example markdown.
projectId
string
Required when your key spans more than one project.

pb.types

Read and manage entity types.
MethodDescription
pb.types.list()All types in scope.
pb.types.get(name)A single type.
pb.types.create(input)Define a new type.
pb.types.update(name, input)Update a type.
pb.types.delete(name, { force })Remove a type.
const types = await pb.types.list();
const account = await pb.types.get("Account");

pb.shapes

Read shapes and their derived artifacts.
MethodDescription
pb.shapes.list()All shapes in scope.
pb.shapes.get(id)A single shape.
pb.shapes.schema(id)The shape’s schema.
pb.shapes.binding(id)The shape’s binding.
pb.shapes.interface(id, spec?)The shape’s interface.
pb.shapes.extractionBundle(id)The bundle used for extraction.
pb.shapes.relationships(id)Relationships defined on the shape.
pb.shapes.projections(id)Pre-reasoned retrieval projections.
pb.shapes.materialize(input)Materialize a shape.
const shapes = await pb.shapes.list();
const schema = await pb.shapes.schema("shp_deal_notes");
pb.shapes.list() returns the shapes in your project. System shapes (like the memory shape) may not appear there but are still usable: read their type with pb.types.get("memory") and extract through them by name with pb.extract({ shape: "memory" }).