Skip to main content

Cookbook

The Fluree Cookbook provides practical examples for common operations. All examples are tested and can be run directly against a Fluree server.

Quick Navigation

SectionDescription
SetupCreate a ledger with sample data
QueryingSelect statements, filters, graph traversals, aggregates
TransactingInsert, update, delete, upsert operations
SchemaDefine types, properties, and constraints
JSON-LD UtilitiesContext handling, IRI expansion
Time TravelHistorical queries, version comparison
PolicyAccess control examples

Running the Examples

All cookbook examples assume you have a Fluree server running at http://localhost:8090.

Using Postman

Run in Postman

Using curl

Most examples show the request body. To run with curl:


curl -X POST "http://localhost:8090/fluree/query" \
-H "Content-Type: application/json" \
-d '<request body from example>'

Complete Examples

See the Full Cookbook Examples page for all examples with detailed explanations and responses.


Section Summaries

Setup

Create the cookbook/base ledger used throughout these examples. This populates sample data with Yetis and People.

Go to Setup →

Querying

Learn to query data using FlureeQL:

  • Select statements — Wildcards, specific properties, graph crawls
  • Where clauses — Pattern matching, filters, optional patterns
  • Aggregates — Count, sum, average, group by
  • Subqueries — Nested queries for complex data retrieval

Go to Querying →

Transacting

Modify data in your ledger:

  • Insert — Add new entities and properties
  • Delete — Remove data
  • Update — Modify existing values using where/delete/insert
  • Upsert — Insert or update based on existence

Go to Transacting →

Schema

Define your data model:

  • Types — Define entity classes
  • Properties — Specify property characteristics
  • SHACL shapes — Add validation constraints

Go to Schema →

JSON-LD Utilities

Work with JSON-LD features:

  • Context — Define and use namespaces
  • IRI handling — Expand and compact IRIs
  • Framing — Shape query output

Go to JSON-LD Utilities →

Time Travel

Query historical data:

  • Point-in-time queries — Query at specific transaction
  • History queries — See how entities changed over time
  • Range queries — Query changes within time ranges

Go to Time Travel →

Policy

Implement access control:

  • View policies — Control read access
  • Modify policies — Control write access
  • Property-level policies — Fine-grained access control

Go to Policy →