sm/add-ents
to perform a fundamental Specmonstah operation: adding an ent graph to an ent db. The function takes two arguments: an ent db and a query to generate ents. (Queries are covered in section 03 of the tutorial).{:schema schema}
is a valid ent db. It's an ent db with no ents added. sm/add-ents
generates the ent graph, and returns a new ent db::schema
and :data
keys. The rest are mostly used internally and can be ignored. I'm only showing them so that you'll have a clearer picture of what an ent db is: a Clojure map of a particular shape.:data
key of the ent db. The graph stores ent nodes, their relationships, and their ent attributes (as opposed to business attributes). In this ent db there are three users, :u0
, :u1
, and :u2
. There aren't any ent relationships because our schema didn't specify any, but each ent does have attributes: :type
, :index
, :ent-type
, and :query-term
. I know I've said it multiple times already, but these are ent attributes, which are distinct from business attributes. The latter are the attributes related to whatever domain you're modeling; for users, these might include name, username, email address, and so forth. As you go through the tutorial, you'll see how a lot of Specmonstah functions involve reading and updating ents' attributes.:schema
key of the ent db. In this case, the schema is {:user {:prefix :u}}
, which is as simple a schema as possible. In later sections, you'll learn more about schemas and how they're used to define relationships and constraints among ents.