Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 796 Bytes

File metadata and controls

25 lines (19 loc) · 796 Bytes
description
How to add a document using WOQL

Add a Document

{% hint style="info" %} To use this How-To, first clone the Star Wars demo into your team on TerminusCMS. You will then have full access to the data needed for this tutorial {% endhint %}

You can add a document in WOQL using the insert_document keyword.

let v = Vars("id");
insert_document(doc({'@type' : 'Planet', label: 'Planet-X'}), v.id)

We can also add documents by using a variable. For instance, we can create a new planet for each individual in the star wars universe as follows:

let v = Vars("person", "name");
and(isa(v.person, "People"),
    triple(v.person,"label",v.name),
    insert_document(doc({'@type' : 'Planet', label: v.name})))