> For the complete documentation index, see [llms.txt](https://sweet-tooth.gitbook.io/specmonstah/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sweet-tooth.gitbook.io/specmonstah/tutorial/05-progressive-construction.md).

# 05: progressive construction

At the beginning of this tutorial, I told you that `add-ents` takes an ent db as an argument:

```
(sm/add-ents {:schema schema} {:post [[1]]})
```

You may have wondered why the empty ent db `{:schema schema}` is used, rather than just directly passing in `schema`; why don't we just write this?

```
(sm/add-ents schema {:post [[1]]})
```

The reason the first argument to `add-ents` is an ent db is so you can take the return value of `add-ents` and pass it in as the first argument to further calls to `add-ents`:

```scheme
(ns reifyhealth.specmonstah-tutorial.05
  (:require [reifyhealth.specmonstah.core :as sm]))

(def schema
  {:user  {:prefix :u}
   :topic {:prefix    :t
           :relations {:owner-id [:user :id]}}})

(defn ex-01
  []
  (let [ent-db-1 (sm/add-ents {:schema schema} {:topic [[1]]})
        ent-db-2 (sm/add-ents ent-db-1 {:topic [[1]
                                                [1 {:refs {:owner-id :hamburglar}}]]})]
    (sm/view ent-db-1)
    (sm/view ent-db-2)))

(ex-01)

```

Additional calls to `add-ents` are additive; they will never alter existing ents, and will only add new ents. The first call, `(sm/add-ents {:schema schema} {:topic [[1]]})`, produces a `:topic` named `:t0` referencing a `:user` named `:u0`:

![](/files/-LowVqSUbB0Bn9mSXCVv)

That ent db is passed to the next call:

```scheme
(sm/add-ents ent-db-1 {:topic [[1]
                               [1 {:refs {:owner-id :hamburglar}}]]})
```

This creates two more topics:

![](/files/-LowVtEuqjPJ14HeBptp)

The default naming system picks up where it left off, giving the topic the names `:t1` and `:t2`. `:t1` references the existing user, `:u0`, and `:t2` references a new user from the `:refs`, `:hamburglar`. When progressively generating an ent-db, you can expect Specmonstah to behave as if all queries were passed as a single query to a single call of `add-ents`.

Everything you've learned up to this point has focused on generating an ent db: you've learned a bit about how to use schemas and queries together to concisely specify what ents to create. You've also learned how to customize the relationships with the `:refs` query option.

In the next couple sections, you'll learn about how Specmonstah uses *visitation* to generate and insert business data.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sweet-tooth.gitbook.io/specmonstah/tutorial/05-progressive-construction.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
