Skip to main content

Adding Sample Data: Part 2

In order to add predicates of type ref to our sample data, we can reference existing subjects using their _id or a unique two-tuple. We can also reference subjects that haven't been created yet by using their temporary ids.

Referencing Tempids

For example, if we want to create a person and artists at the same time, and list those artists in the person's favorite artists, we'll need to use tempids.

[
{
"_id": "person",
"handle": "artSnob",
"fullName": "Artemus Snoberson",
"favArtists": ["artist$basquiat", "artist$savage"]
},
{
"_id": "artist$basquiat",
"name": "Jean-Michel Basquiat"
},
{
"_id": "artist$savage",
"name": "August Savage"
}
]

Create 1 New Person and 1 New Artist

Write a transaction to create the 1 new person and 1 new artist

  • Person with the full name, Connie Seur, handle, cSeur, favorite numbers: 13, and favorite artists: Gustav Klimt