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
| Section | Description |
|---|---|
| Setup | Create a ledger with sample data |
| Querying | Select statements, filters, graph traversals, aggregates |
| Transacting | Insert, update, delete, upsert operations |
| Schema | Define types, properties, and constraints |
| JSON-LD Utilities | Context handling, IRI expansion |
| Time Travel | Historical queries, version comparison |
| Policy | Access control examples |
Running the Examples
All cookbook examples assume you have a Fluree server running at http://localhost:8090.
Using 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.
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
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
Schema
Define your data model:
- Types — Define entity classes
- Properties — Specify property characteristics
- SHACL shapes — Add validation constraints
JSON-LD Utilities
Work with JSON-LD features:
- Context — Define and use namespaces
- IRI handling — Expand and compact IRIs
- Framing — Shape query output
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
Policy
Implement access control:
- View policies — Control read access
- Modify policies — Control write access
- Property-level policies — Fine-grained access control