### Quick Start: Full Setup and Jaeger UI Source: https://github.com/fluree/db/blob/main/otel/README.md Execute the full setup process including starting Jaeger, building binaries, initializing configuration, starting the server, and running smoke tests. Then, open the Jaeger UI to inspect traces. ```bash cd otel/ # Full setup: start Jaeger, build binaries, init config, start server, run smoke tests make all # Open Jaeger UI to inspect traces make ui ``` -------------------------------- ### Local Setup and Server Start Source: https://github.com/fluree/db/blob/main/docs/troubleshooting/performance-tracing.md Starts Jaeger, builds Fluree with OpenTelemetry features, and runs the server with smoke tests. Use 'make ui' to open the Jaeger UI. ```bash cd otel/ make all # starts Jaeger, builds with --features otel, starts server, runs smoke tests make ui # opens Jaeger UI in browser ``` -------------------------------- ### Fluree CLI Quick Start Commands Source: https://github.com/fluree/db/blob/main/docs/cli/README.md Initialize a project, create a ledger, insert data, and run a query using the Fluree CLI. These commands provide a basic workflow for getting started with Fluree. ```bash # Initialize a project directory fluree init # Create a ledger fluree create myledger # Insert data fluree insert '@prefix ex: . ex:alice a ex:Person ; ex:name "Alice" .' # Query fluree query 'SELECT ?name WHERE { ?s ?name }' ``` -------------------------------- ### Complete Unique Constraint Setup Example Source: https://github.com/fluree/db/blob/main/docs/ledger-config/unique-constraints.md This example shows the complete process of setting up unique constraints. It involves defining unique annotations for a property and then enabling enforcement in the configuration graph. ```trig @prefix f: . @prefix ex: . # 1. Define unique annotations in the default graph ex:email f:enforceUnique true . # 2. Enable enforcement in the config graph GRAPH { a f:LedgerConfig ; f:transactDefaults [ f:uniqueEnabled true ] . } ``` -------------------------------- ### Example: Interactive Memory Initialization Source: https://github.com/fluree/db/blob/main/docs/memory/cli/init.md This example shows the interactive process of initializing the memory store. It prompts for confirmation to install MCP configurations for detected AI coding tools. ```bash $ fluree memory init Memory store initialized at /path/to/project/.fluree-memory Repo memories are stored in .fluree-memory/repo.ttl (git-tracked). Commit this directory to share project knowledge with your team. Detected AI coding tools: - Claude Code (already configured) - Cursor - VS Code (Copilot) (already configured) Install MCP config for Cursor? [Y/n] Y Installed: .cursor/mcp.json Installed: .cursor/rules/fluree_rules.md Configured 1 tool. ``` -------------------------------- ### Example Usage of Completions Source: https://github.com/fluree/db/blob/main/docs/cli/completions.md Demonstrates how to use tab-completion for Fluree commands, arguments, and options after installation. ```bash # Generate bash completions fluree completions bash # Generate zsh completions and save fluree completions zsh > ~/.zfunc/_fluree ``` ```bash fluree # Shows all commands fluree que # Completes to "query" fluree query -- # Shows available options ``` -------------------------------- ### Rust: Fluree Quick Setup Source: https://github.com/fluree/db/blob/main/docs/operations/running-fluree.md Concise examples for quickly setting up Fluree connections using typed builders for memory, file, and S3. ```rust use fluree_db_api::FlureeBuilder; let fluree = FlureeBuilder::memory().build_memory(); // In-memory let fluree = FlureeBuilder::file("./data").build()?; let fluree = FlureeBuilder::s3("bucket", "endpoint").build_client().await?; ``` -------------------------------- ### Cursor MCP Configuration Example Source: https://github.com/fluree/db/blob/main/docs/cli/memory.md Provides an example of a portable, repo-scoped MCP configuration for Cursor, including stdio server setup and environment variable configuration. ```json { "mcpServers": { "fluree-memory": { "type": "stdio", "command": "fluree", "args": ["mcp", "serve", "--transport", "stdio"], "env": { "FLUREE_HOME": "${workspaceFolder}/.fluree" } } } } ``` -------------------------------- ### Example: Non-interactive Initialization with --yes Source: https://github.com/fluree/db/blob/main/docs/memory/cli/init.md Use the `--yes` option to automatically confirm all MCP installations without prompting. This is useful for non-interactive shells. ```bash fluree memory init --yes ``` -------------------------------- ### Error: Nonexistent configuration key Source: https://github.com/fluree/db/blob/main/docs/cli/config.md This example shows the error message returned when attempting to get a configuration key that has not been set. ```bash error: configuration key 'nonexistent' is not set ``` -------------------------------- ### Example Test Source: https://github.com/fluree/db/blob/main/docs/contributing/tests.md A basic example demonstrating dataset creation, transaction, and querying within an example file. ```rust // examples/basic_query.rs fn main() -> Result<()> { let dataset = Dataset::new_memory(); dataset.transact(sample_data())?; let results = dataset.query(sample_query())?; println!("Results: {:?}", results); Ok(()) } ``` -------------------------------- ### Server Configuration for Size Limits Source: https://github.com/fluree/db/blob/main/docs/api/headers.md Example of how to configure custom request and response size limits when starting the Fluree DB server using command-line arguments. ```bash ./fluree-db-server \ --max-transaction-size 20971520 \ --max-query-size 2097152 \ --max-response-size 104857600 # 100 MB ``` -------------------------------- ### Start Fluree Server Source: https://github.com/fluree/db/blob/main/docs/operations/README.md Starts the Fluree server service using systemctl. ```bash systemctl start fluree ``` -------------------------------- ### Run Rust Examples Source: https://github.com/fluree/db/blob/main/docs/getting-started/rust-api.md Command to compile and run the example benchmarks for Fluree DB Rust API. ```bash cargo run --example benchmark_aj_query_1 --release ``` -------------------------------- ### Install Rust and Verify Source: https://github.com/fluree/db/blob/main/docs/contributing/dev-setup.md Installs Rust using rustup and verifies the installation. Ensure Rust version is 1.75.0 or later. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustc --version # Should be 1.75.0 or later cargo --version ``` -------------------------------- ### SPARQL Query Example Source: https://github.com/fluree/db/blob/main/docs/cli/query.md Example of executing a SPARQL query directly in the command line. ```bash fluree query 'SELECT ?name WHERE { ?s ?name }' ``` -------------------------------- ### Rust Code Documentation Example Source: https://github.com/fluree/db/blob/main/docs/contributing/dev-setup.md Illustrates how to document Rust functions using Rustdoc, including arguments, return values, errors, and examples. The example shows a query function. ```rust /// Executes a query against a dataset. /// /// This function parses the query, generates an execution plan, /// and runs the plan against the dataset's indexes. /// /// # Arguments /// /// * `dataset` - The dataset to query /// * `query` - The query to execute /// /// # Returns /// /// A vector of solutions (variable bindings) /// /// # Errors /// /// Returns error if query is invalid or execution fails /// /// # Examples /// /// ``` /// use fluree_db_api::query; /// /// let results = query(&dataset, &query)?; /// assert_eq!(results.len(), 10); /// ``` pub fn query(dataset: &Dataset, query: &Query) -> Result> { // Implementation } ``` -------------------------------- ### Install Linux Tools Source: https://github.com/fluree/db/blob/main/docs/contributing/dev-setup.md Installs necessary common and generic Linux tools required for development. ```bash sudo apt install linux-tools-common linux-tools-generic ``` -------------------------------- ### Run Dedicated Indexing Server Source: https://github.com/fluree/db/blob/main/docs/transactions/indexing-side-effects.md For high-load deployments, run a dedicated indexer server. This example shows how to start the main server with indexing disabled and a separate indexer for specific ledgers. ```bash # Main server (transact only; background indexing disabled) fluree-server --indexing-enabled=false # Indexing server ./fluree-db-indexer --ledgers mydb:main,mydb:dev ``` -------------------------------- ### Initialize and Start IPFS Daemon Source: https://github.com/fluree/db/blob/main/docs/operations/ipfs-storage.md Initialize the IPFS repository if it's the first time, then start the IPFS daemon to run the node. ```bash # Initialize IPFS (first time only) ipfs init # Start the daemon ipfs daemon ``` -------------------------------- ### Start Fluree Server (Debug Logging) Source: https://github.com/fluree/db/blob/main/docs/getting-started/quickstart-server.md Starts the Fluree server with debug logging enabled for more detailed output. ```bash fluree server run --log-level debug ``` -------------------------------- ### Install MCP Server for IDE Source: https://github.com/fluree/db/blob/main/docs/cli/mcp.md Installs the MCP server for a specific IDE, simplifying IDE configuration. ```bash fluree memory mcp-install --ide cursor ``` -------------------------------- ### Start Fluree Server (File Storage) Source: https://github.com/fluree/db/blob/main/docs/getting-started/quickstart-server.md Starts the Fluree server with persistent file storage. Specify a directory for storing data. ```bash fluree server run --storage-path /var/lib/fluree ``` -------------------------------- ### Complete Turtle Example Source: https://github.com/fluree/db/blob/main/docs/transactions/turtle.md A comprehensive example demonstrating the Turtle syntax for defining organizations and people with their properties and relationships. ```turtle @prefix ex: . @prefix schema: . @prefix xsd: # Company ex:company-a a schema:Organization ; schema:name "Acme Corp" ; schema:url ; schema:foundingDate "2000-01-15"^^xsd:date . # People ex:alice a schema:Person ; schema:name "Alice" ; schema:email "alice@example.org" , "alice@work.com" ; schema:age 30 ; schema:worksFor ex:company-a ; schema:address [ a schema:PostalAddress ; schema:streetAddress "123 Main St" ; schema:addressLocality "Springfield" ; schema:postalCode "12345" ] . ex:bob a schema:Person ; schema:name "Bob" ; schema:email "bob@example.org" ; schema:age 25 ; schema:worksFor ex:company-a ; schema:knows ex:alice . ex:carol a schema:Person ; schema:name "Carol" ; schema:email "carol@example.org" ; schema:knows ex:alice , ex:bob . ``` -------------------------------- ### Install MCP Configuration Source: https://github.com/fluree/db/blob/main/docs/memory/cli/mcp-install.md Use this command to install the MCP configuration for your IDE. The IDE can be auto-detected if omitted. ```bash fluree memory mcp-install [--ide ] ``` -------------------------------- ### Batching Setup and Measurement in Criterion Source: https://github.com/fluree/db/blob/main/docs/contributing/benches.md Use `iter_batched` to separate setup costs from the measured operation, especially when setup is significant. This example demonstrates batching with `BatchSize::SmallInput`. ```rust b.iter_batched( || setup_one_input(), |inputs| inputs.into_iter().map(|x| measured_op(x)).collect::>(), criterion::BatchSize::SmallInput, ); ``` -------------------------------- ### Fluree Server Status Example Output Source: https://github.com/fluree/db/blob/main/docs/cli/server.md Example output from the `fluree server status` command when using local file storage. ```text ok: Server is running pid: 12345 listen_addr: 0.0.0.0:8090 storage_path: /path/to/.fluree/storage started_at: 2026-02-16T10:30:00Z uptime: 2h 15m 30s health: ok log: /path/to/.fluree/server.log ``` -------------------------------- ### Start Fluree Server (Custom Port) Source: https://github.com/fluree/db/blob/main/docs/getting-started/quickstart-server.md Starts the Fluree server and configures it to listen on a custom network address and port. ```bash fluree server run --listen-addr 0.0.0.0:9090 ``` -------------------------------- ### Fluree CLI: Initialize Project and Configuration Source: https://github.com/fluree/db/blob/main/otel/README.md Initialize the project directory and apply OTEL-specific server settings using the fluree CLI. ```bash # Initialize project (one-time, idempotent) make init # View current config fluree config list # Change settings fluree config set server.listen_addr "0.0.0.0:9090" fluree config set server.indexing.reindex_max_bytes 1000000000 # The server reads .fluree/config.toml automatically make server ``` -------------------------------- ### Start Fluree Server with Overrides Source: https://github.com/fluree/db/blob/main/docs/cli/server.md Starts the Fluree server in the background with specified overrides for the listen address and log level. ```bash fluree server start --listen-addr 0.0.0.0:8090 --log-level debug ``` -------------------------------- ### GET /commits/*ledger URL Example Source: https://github.com/fluree/db/blob/main/docs/api/endpoints.md Example URL for fetching commits from a ledger. The `limit` parameter controls the number of commits per page, and `cursor_id` is used for pagination. ```http GET /commits/?limit=100&cursor_id= ``` -------------------------------- ### HTTP Server - Starting the Server Source: https://github.com/fluree/db/blob/main/docs/operations/running-fluree.md Instructions on how to build and run the Fluree DB HTTP server with different configurations for storage and logging. ```APIDOC ## Starting the Server ```bash # Build from source car go build --release -p fluree-db-server # Run with defaults (memory storage, port 8090) ./target/release/fluree-server # Run with file-based persistence fluree-server --storage-path /var/lib/fluree # Run with debug logging fluree-server --log-level debug ``` ``` -------------------------------- ### Iceberg Table Partitioning Best Practice Source: https://github.com/fluree/db/blob/main/docs/graph-sources/iceberg.md SQL example demonstrating how to partition an Iceberg table by date components for better performance. ```sql -- Partition Iceberg table by date PARTITIONED BY (YEAR(order_date), MONTH(order_date)) ``` -------------------------------- ### Commit Log GET Request Source: https://github.com/fluree/db/blob/main/docs/cli/server-integration.md This is an example of a GET request to retrieve commit summaries from the Fluree log. The 'ledger' parameter specifies the target ledger, and 'limit' controls the number of summaries returned. ```http GET {api_base_url}/log/{ledger}?limit={n} ``` -------------------------------- ### Version Control Example Source: https://github.com/fluree/db/blob/main/docs/concepts/time-travel.md Retrieve configuration settings from a specific historical point in time, treating data like code with version control. ```json { "@context": { "ex": "http://example.org/ns/" }, "from": "app:production@t:1000", "select": ["?config"], "where": [ { "@id": "?setting", "ex:value": "?config" } ] } ``` -------------------------------- ### Variable Pattern Example Source: https://github.com/fluree/db/blob/main/docs/query/jsonld-query.md Uses variables (starting with ?) to match unknown values for subject, predicate, or object. ```json { "@id": "?person", "ex:name": "?name" } ``` -------------------------------- ### CLI Tool - Installation Source: https://github.com/fluree/db/blob/main/docs/operations/running-fluree.md Instructions for building the Fluree DB CLI tool from source. ```APIDOC ## Installation ```bash car go build --release -p fluree-db-cli # Binary: ./target/release/fluree ``` ``` -------------------------------- ### Get Ledger Info Source: https://github.com/fluree/db/blob/main/docs/api/endpoints.md Fetches ledger metadata using curl. Includes an example with an Authorization header. ```bash # Get ledger info curl "http://localhost:8090/v1/fluree/info/mydb:main" # With auth token curl "http://localhost:8090/v1/fluree/info/mydb:main" \ -H "Authorization: Bearer eyJ..." ``` -------------------------------- ### Environment Variable Configuration Example Source: https://github.com/fluree/db/blob/main/docs/getting-started/rust-api.md Demonstrates how to specify configuration values directly or via a `ConfigurationValue` object, allowing for environment variable indirection and default values. ```json { "s3Bucket": { "envVar": "FLUREE_S3_BUCKET", "defaultVal": "my-bucket" }, "cacheMaxMb": { "envVar": "FLUREE_CACHE_MAX_MB", "defaultVal": "1024" } } ``` -------------------------------- ### GET /show/*ledger Response Body Example Source: https://github.com/fluree/db/blob/main/docs/api/endpoints.md This JSON structure represents the successful response for the GET /show/*ledger endpoint, detailing a single commit's assertions, retractions, and flakes with resolved IRIs. ```json { "id": "bagaybqabciq...", "t": 5, "time": "2026-03-12T16:58:18.395474217+00:00", "size": 327, "previous": "bagaybqabciq...", "asserts": 1, "retracts": 1, "@context": { "xsd": "http://www.w3.org/2001/XMLSchema#", "schema": "http://schema.org/" }, "flakes": [ ["urn:fsys:dataset:zoho3", "schema:dateModified", "2026-03-12T14:15:30Z", "xsd:string", false], ["urn:fsys:dataset:zoho3", "schema:dateModified", "2026-03-12T16:58:16Z", "xsd:string", true] ] } ``` -------------------------------- ### Initialize Fluree Project or Global Config Source: https://github.com/fluree/db/blob/main/docs/operations/running-fluree.md Set up the necessary `.fluree/` directory for a project or create a global configuration file for Fluree. ```bash fluree init # Initialize .fluree/ directory in current project fluree init --global # Create global config (~/.config/fluree/) ``` -------------------------------- ### GET /log/*ledger Response Body Example Source: https://github.com/fluree/db/blob/main/docs/api/endpoints.md This JSON structure shows a successful response for the GET /log/*ledger endpoint, providing a paginated list of commit summaries including transaction time, commit ID, and message. ```json { "ledger_id": "mydb:main", "commits": [ { "t": 12, "commit_id": "bafy...", "time": "2026-04-25T12:00:00Z", "asserts": 3, "retracts": 0, "flake_count": 3, "message": null } ], "count": 12, "truncated": false } ``` -------------------------------- ### Get Commit History Source: https://github.com/fluree/db/blob/main/docs/transactions/commit-receipts.md Walks the commit chain from a starting transaction time down to a specified end time, collecting each commit. ```javascript async function getCommitHistory(ledger, fromT, toT) { const history = []; let currentT = fromT; while (currentT >= toT) { const commit = await getCommit(ledger, currentT); history.push(commit); currentT = commit.previous_t; } return history; } ``` -------------------------------- ### Example JSON Configuration File Source: https://github.com/fluree/db/blob/main/docs/operations/configuration.md Demonstrates a Fluree server configuration using JSON format. ```json { "server": { "listen_addr": "0.0.0.0:8090", "storage_path": "/var/lib/fluree", "indexing": { "enabled": true } } } ``` -------------------------------- ### Onboarding a New Teammate Source: https://github.com/fluree/db/blob/main/docs/memory/guides/team-workflows.md New teammates can quickly get up to speed by cloning the repository, initializing Fluree memory, and then recalling existing memories. ```bash git clone git@github.com:team/project cd project fluree memory init ``` ```bash fluree memory recall "testing" -n 10 ``` -------------------------------- ### Configuration file example Source: https://github.com/fluree/db/blob/main/docs/cli/config.md This TOML snippet shows the structure of the `.fluree/config.toml` file, including nested storage settings. ```toml [storage] path = "/custom/storage/path" encryption = "aes256" ``` -------------------------------- ### Configure Prometheus Scraper Source: https://github.com/fluree/db/blob/main/docs/operations/telemetry.md Example Prometheus configuration to scrape metrics from the Fluree server. This setup targets the default metrics endpoint and scrape interval. ```yaml # prometheus.yml scrape_configs: - job_name: 'fluree' static_configs: - targets: ['localhost:8090'] metrics_path: '/metrics' scrape_interval: 15s ``` -------------------------------- ### CLI Tool - Project Setup Source: https://github.com/fluree/db/blob/main/docs/operations/running-fluree.md Commands to initialize Fluree DB configuration for a project or globally. ```APIDOC ## Project Setup ```bash fluree init # Initialize .fluree/ directory in current project fluree init --global # Create global config (~/.config/fluree/) ``` ``` -------------------------------- ### Basic Fluree Setup in Rust (Memory Backend) Source: https://github.com/fluree/db/blob/main/docs/getting-started/rust-api.md Initialize Fluree in memory and create a new ledger. This is suitable for testing or applications where data persistence is not required. ```rust use fluree_db_api::{FlureeBuilder, Result}; #[tokio::main] async fn main() -> Result<()> { // Create a memory-backed Fluree instance let fluree = FlureeBuilder::memory().build_memory(); // Create a new ledger let ledger = fluree.create_ledger("mydb").await?; println!("Ledger created at t={}", ledger.t()); Ok(()) } ``` -------------------------------- ### Inferred Fact Example Source: https://github.com/fluree/db/blob/main/docs/concepts/reasoning.md Illustrates how Fluree infers a fact based on asserted data and schema definitions. No specific setup is required beyond defining the data and schema. ```text Alice rdf:type Student (asserted) Student rdfs:subClassOf Person (schema) ──────────────────────────────────────────── Alice rdf:type Person (inferred) ``` -------------------------------- ### Makefile Targets: Project Initialization Source: https://github.com/fluree/db/blob/main/otel/README.md Commands for initializing the project directory and applying OTEL-specific server configuration. ```bash make init make config make stress-config ``` -------------------------------- ### Fluree Server Configuration (Production Single Server) Source: https://github.com/fluree/db/blob/main/docs/getting-started/quickstart-server.md Starts the Fluree server with persistent storage, enabled indexing, and required event authentication for a production single-server setup. ```bash fluree server run \ --storage-path /var/lib/fluree \ --indexing-enabled \ --events-auth-mode required \ --events-auth-trusted-issuers did:key:z6Mk... ``` -------------------------------- ### Set Expiration Time Example Source: https://github.com/fluree/db/blob/main/docs/transactions/signed-transactions.md Example of setting an expiration time for a signed transaction in JavaScript. This example sets the expiration to 15 minutes from the time of signing. ```javascript .setExpirationTime('15m') // 15 minutes ``` -------------------------------- ### Install Fluree CLI via Installer Script (macOS/Linux) Source: https://github.com/fluree/db/blob/main/docs/memory/getting-started/install.md Use this command to download and execute the Fluree CLI installer script on macOS and Linux systems. ```bash curl --proto '=https' --tlsv1.2 -LsSf \ https://github.com/fluree/db/releases/latest/download/fluree-db-cli-installer.sh | sh ``` -------------------------------- ### Initialize Fluree Project Locally Source: https://github.com/fluree/db/blob/main/docs/cli/init.md Use this command to create a local `.fluree/` directory for your Fluree project. This directory will contain configuration files and storage for your ledgers. ```bash fluree init ``` -------------------------------- ### Install MCP for VS Code Source: https://github.com/fluree/db/blob/main/docs/memory/getting-started/vscode.md If prompted, accept the VS Code prompt for installation. Alternatively, run this command to manually install the MCP integration for VS Code. ```bash fluree memory mcp-install --ide vscode ``` -------------------------------- ### Initialize Fluree, Create Ledger, Insert Data, and Query Source: https://github.com/fluree/db/blob/main/README.md A sequence of commands to initialize Fluree, create a new ledger named 'movies', insert RDF data, and then query it using SPARQL. ```bash fluree init fluree create movies fluree insert ' @prefix schema: . @prefix ex: . ex:blade-runner a schema:Movie ; schema:name "Blade Runner" ; schema:dateCreated "1982-06-25"^^ ; schema:director ex:ridley-scott . ex:ridley-scott a schema:Person ; schema:name "Ridley Scott" . ex:alien a schema:Movie ; schema:name "Alien" ; schema:dateCreated "1979-05-25"^^ ; schema:director ex:ridley-scott . ' fluree query --format table 'SELECT ?title ?date WHERE { ?movie a ; ?title ; ?date . } ORDER BY ?date' ``` -------------------------------- ### Run Development Server (Custom Settings) Source: https://github.com/fluree/db/blob/main/docs/contributing/dev-setup.md Launches the Fluree DB server with custom configurations for storage, data directory, and log level. ```bash cargo run --bin fluree-db-server -- \ --storage file \ --data-dir ./dev-data \ --log-level debug ``` -------------------------------- ### Benchmark Setup with Batched Iterations Source: https://github.com/fluree/db/blob/main/docs/contributing/benches.md Demonstrates using `iter_batched` for benchmarks where setup is heavy and should not be measured. The setup closure runs once per batch, while the measured closure runs for each item in the batch. ```rust group.bench_with_input(BenchmarkId::new("commit", scale.as_str()), &n, |b, &n| { b.iter_batched( || rt.block_on(setup_fresh_ledger(n)), // setup, not measured |ledger| rt.block_on(commit_one_txn(ledger)), // measured criterion::BatchSize::SmallInput, ); }); ``` -------------------------------- ### Setup and Assertions for Test Datasets Source: https://github.com/fluree/db/blob/main/docs/contributing/tests.md Provides helper functions for setting up test datasets and asserting query results. Use `setup_test_dataset` to create an in-memory dataset with sample data, and `assert_query_results` to compare query outputs. ```rust // tests/helpers/mod.rs pub async fn setup_test_dataset() -> Dataset { let dataset = Dataset::new_memory().await.unwrap(); dataset.transact(sample_data()).await.unwrap(); dataset } pub fn assert_query_results(results: &[Solution], expected: &[(&str, &str)]) { assert_eq!(results.len(), expected.len()); for (result, (var, value)) in results.iter().zip(expected) { assert_eq!(result.get(var).unwrap().to_string(), *value); } } ``` -------------------------------- ### JSON-LD Query Example Source: https://github.com/fluree/db/blob/main/docs/cli/query.md Example of executing a JSON-LD query directly in the command line. ```bash fluree query '{"select": ["?name"], "where": {"http://example.org/name": "?name"}}' ``` -------------------------------- ### Initialize Fluree Memory for Windsurf Source: https://github.com/fluree/db/blob/main/docs/memory/getting-started/windsurf.md Run this command to initialize Fluree Memory. Accept the prompt or use the --ide flag for automatic installation. ```bash fluree memory init ``` ```bash fluree memory mcp-install --ide windsurf ``` -------------------------------- ### Identity-Based Policy Example Source: https://github.com/fluree/db/blob/main/docs/api/signed-requests.md Example Fluree policy that uses a specific DID subject for authorization. ```json { "@context": { "ex": "http://example.org/ns/", "f": "https://ns.flur.ee/db#" }, "@id": "ex:admin-policy", "f:policy": [ { "f:subject": "did:key:z6Mkh...", "f:action": ["query", "transact"], "f:allow": true } ] } ``` -------------------------------- ### Build and Run Fluree Server Source: https://github.com/fluree/db/blob/main/docs/operations/running-fluree.md Build the Fluree server from source and run it with default memory storage or file-based persistence. ```bash # Build from source cargo build --release -p fluree-db-server # Run with defaults (memory storage, port 8090) ./target/release/fluree-server # Run with file-based persistence fluree-server --storage-path /var/lib/fluree # Run with debug logging fluree-server --log-level debug ``` -------------------------------- ### Verify Git Installation Source: https://github.com/fluree/db/blob/main/docs/contributing/dev-setup.md Checks if Git is installed and meets the minimum version requirement. ```bash git --version # Should be 2.0 or later ``` -------------------------------- ### Role-Based Access Policy Example Source: https://github.com/fluree/db/blob/main/docs/api/signed-requests.md Example Fluree policy that checks for a specific role assigned to a DID. ```json { "@id": "did:key:z6Mkh...", "@type": "ex:User", "ex:role": "ex:Administrator" } Policy checks the role: { "f:policy": [ { "f:subject": { "ex:role": "ex:Administrator" }, "f:action": "*", "f:allow": true } ] } ``` -------------------------------- ### Documenting Namespaces in Turtle Source: https://github.com/fluree/db/blob/main/docs/transactions/turtle.md Example showing how to document prefixes with comments for clarity in Turtle files. ```turtle # Schema.org vocabulary for general entities @prefix schema: . # Application-specific namespace @prefix ex: . # Standard XSD datatypes @prefix xsd: . ``` -------------------------------- ### Running Tokio Runtime for File-Backed Fluree Setup Source: https://github.com/fluree/db/blob/main/docs/contributing/benches.md When setting up Fluree with file persistence in a benchmark, the setup closure must be wrapped in `rt.block_on` to ensure a Tokio reactor is running. This is necessary for operations like `FlureeBuilder::file(...).build()`. ```rust let rt = bench_runtime(); b.iter_batched( // setup — wrap in block_on so the reactor is alive while // FlureeBuilder::file(...).build() runs. || rt.block_on(async { let dir = tempfile::tempdir().unwrap(); let fluree = FlureeBuilder::file(dir.path().to_string_lossy().to_string()) .build() .unwrap(); (dir, fluree) }), |(_dir, fluree)| rt.block_on(async { // measured op }), criterion::BatchSize::PerIteration, ); ``` -------------------------------- ### Install IPFS with Homebrew on macOS Source: https://github.com/fluree/db/blob/main/docs/operations/ipfs-storage.md Use Homebrew to install the Kubo IPFS implementation on macOS. ```bash brew install ipfs ``` -------------------------------- ### Example TOML Configuration with Profiles Source: https://github.com/fluree/db/blob/main/docs/operations/configuration.md Defines server settings and environment-specific overrides using profiles in TOML format. ```toml [server] log_level = "info" [profiles.dev.server] log_level = "debug" [profiles.prod.server] log_level = "warn" [profiles.prod.server.indexing] enabled = true [profiles.prod.server.auth.data] mode = "required" ``` -------------------------------- ### Install MCP for Zed Source: https://github.com/fluree/db/blob/main/docs/memory/getting-started/zed.md Use this command to install the MCP server specifically for Zed integration. ```bash fluree memory mcp-install --ide zed ``` -------------------------------- ### Configure Fluree Server with CLI Flags Source: https://github.com/fluree/db/blob/main/docs/getting-started/quickstart-server.md Demonstrates setting server configurations like storage path and log level using command-line flags. ```bash # CLI flag fluree server run --storage-path /data --log-level debug ``` -------------------------------- ### Install coc-rust-analyzer for Vim Source: https://github.com/fluree/db/blob/main/docs/contributing/dev-setup.md Installs the rust-analyzer extension for the CoC (Conquer of Completion) plugin in Vim. ```vim " Install coc-rust-analyzer :CocInstall coc-rust-analyzer ``` -------------------------------- ### List all configuration values Source: https://github.com/fluree/db/blob/main/docs/cli/config.md Use this command to display all currently set configuration values. If no configuration is set, it will indicate that. ```bash fluree config list ``` -------------------------------- ### Turtle Syntax Error Example Source: https://github.com/fluree/db/blob/main/docs/transactions/turtle.md An example of a JSON response indicating a Turtle syntax parsing error. ```json { "error": "ParseError", "message": "Invalid Turtle syntax at line 5", "code": "TURTLE_PARSE_ERROR", "details": { "line": 5, "column": 12, "token": "unexpected EOF" } } ``` -------------------------------- ### PARSE_ERROR Response Example Source: https://github.com/fluree/db/blob/main/docs/troubleshooting/common-errors.md Example JSON response for a 'PARSE_ERROR', indicating an issue with JSON-LD or SPARQL syntax. ```json { "error": "ParseError", "message": "Invalid JSON-LD: unexpected token at line 5", "code": "PARSE_ERROR", "details": { "line": 5, "column": 12 } } ``` -------------------------------- ### Vector Search Query Example Source: https://github.com/fluree/db/blob/main/docs/reference/vocabulary.md Example of a SPARQL WHERE clause pattern for performing a vector similarity search. ```sparql SELECT ?result WHERE { GRAPH ?g { ?search f:graphSource "my-search:main" ; f:queryVector [0.1, 0.2, 0.3] ; f:searchResult ?result . } } ``` -------------------------------- ### Fluree Project Structure after init Source: https://github.com/fluree/db/blob/main/docs/cli/README.md Illustrates the directory structure created by the 'fluree init' command. This includes configuration files and storage for ledgers. ```bash .fluree/ ├── active # Currently active ledger name ├── config.toml # Configuration settings ├── prefixes.json # IRI prefix mappings └── storage/ # Ledger data storage ``` -------------------------------- ### BM25 Search Query Example Source: https://github.com/fluree/db/blob/main/docs/reference/vocabulary.md Example of a SPARQL WHERE clause pattern for performing a BM25 full-text search. ```sparql SELECT ?result WHERE { GRAPH ?g { ?search f:graphSource "my-search:main" ; f:searchText "Fluree" ; f:searchResult ?result . } } ``` -------------------------------- ### Running Fluree Server with Default Configuration Source: https://github.com/fluree/db/blob/main/docs/operations/configuration.md Starts the Fluree server using the default configuration file discovery mechanism. ```bash fluree-server ``` -------------------------------- ### Example Update Endpoint URL Source: https://github.com/fluree/db/blob/main/docs/api/overview.md This is a concrete example of a URL for submitting an update transaction to a specific ledger. ```text http://localhost:8090/v1/fluree/update?ledger=mydb:main ``` -------------------------------- ### Nameservice Record Lifecycle Example Source: https://github.com/fluree/db/blob/main/docs/concepts/ledgers-and-nameservice.md Illustrates the evolution of a nameservice record through initialization, transactions, and indexing stages. Shows how commit and index transaction times (t) are updated. ```text 1. Initialization - publish_ledger_init("mydb:main") - Creates record with commit_t=0, index_t=0 2. First Transaction - Transaction committed at t=1 - Commit head advanced via `RefPublisher` CAS to `(commit_cid_1, 1)` - Record: commit_t=1, index_t=0 3. Indexing Completes - Index created for t=1 - publish_index("mydb:main", index_cid_1, 1) - Record: commit_t=1, index_t=1 4. More Transactions - Transactions at t=2, t=3, t=4 - Commit head advanced via CAS for each - Record: commit_t=4, index_t=1 (novelty: t=2,3,4) 5. Next Index - Index created for t=4 - publish_index("mydb:main", index_cid_2, 4) - Record: commit_t=4, index_t=4 (no novelty) ``` -------------------------------- ### Time Travel Query Example Source: https://github.com/fluree/db/blob/main/docs/cli/query.md Example of performing a time travel query using the --at option. ```bash # Time travel query fluree query --at 3 'SELECT * WHERE { ?s ?p ?o }' ``` -------------------------------- ### Rust: Creating and Querying Ledgers Source: https://github.com/fluree/db/blob/main/docs/operations/running-fluree.md Examples of creating a ledger, inserting data, and querying using JSON-LD and SPARQL with the Rust API. ```rust // Create fluree.create_ledger("mydb").await?; // Insert data fluree.graph("mydb:main") .transact() .insert(&json!({"@id": "ex:alice", "schema:name": "Alice"})) .commit() .await?; // Query with JSON-LD let result = fluree.graph("mydb:main") .query() .jsonld(&json!({"select": ["?name"], "where": [{"@id": "?s", "schema:name": "?name"}]})) .execute() .await?; // Query with SPARQL let result = fluree.graph("mydb:main") .query() .sparql("SELECT ?name WHERE { ?s ?name }") .execute() .await?; ``` -------------------------------- ### Turtle Output Example Source: https://github.com/fluree/db/blob/main/docs/cli/export.md Example of the Turtle output format, showing prefixed IRIs and basic triples. ```turtle @prefix ex: . ex:alice a ex:Person ; ex:name "Alice" . ex:bob a ex:Person ; ex:name "Bob" . ``` -------------------------------- ### Typical Local Development and Publish Workflow Source: https://github.com/fluree/db/blob/main/docs/cli/publish.md Demonstrates a common workflow: creating a new ledger locally, inserting data, and then publishing it to the 'origin' remote. This sequence is typical for developing and deploying new ledgers. ```bash fluree create mydb fluree insert mydb -e '{"@id": "ex:test", "ex:name": "Test"}' fluree publish origin mydb ```