Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
851c09e
Add recommendation engine design doc
robfrank Feb 25, 2026
fc152ab
Add recommendation engine implementation plan
robfrank Feb 25, 2026
1982d9d
chore: scaffold recommendation-engine directory structure
robfrank Feb 25, 2026
93aa460
feat(recommendation-engine): add docker-compose for ArcadeDB 26.2.1
robfrank Feb 25, 2026
1840511
feat(recommendation-engine): add graph schema SQL
robfrank Feb 25, 2026
ab397e4
feat(recommendation-engine): add sample data SQL
robfrank Feb 25, 2026
306a081
feat(recommendation-engine): add database setup script
robfrank Feb 25, 2026
59b57fc
fix(recommendation-engine): fix shebang in setup.sh
robfrank Feb 25, 2026
b185ab4
feat(recommendation-engine): add curl query demonstrations
robfrank Feb 25, 2026
b8f6323
feat(recommendation-engine): add Maven project for Java demo
robfrank Feb 25, 2026
bef1d90
feat(recommendation-engine): add Java RecommendationEngine main class
robfrank Feb 25, 2026
4b532a9
fix(recommendation-engine): fix escaped \!= operators in Java Query 4…
robfrank Feb 25, 2026
ea48b6a
fix(recommendation-engine): add vector indexes and idempotent CREATE …
robfrank Feb 25, 2026
de9c93b
fix(recommendation-engine): replace vectorDistance with vectorNeighbo…
robfrank Feb 25, 2026
f4dcb6a
fix(recommendation-engine): replace vectorDistance with vectorNeighbo…
robfrank Feb 25, 2026
fffa5b7
fix(recommendation-engine): use JAVA_OPTS to set ArcadeDB root password
robfrank Feb 25, 2026
e7ecbe6
fix(recommendation-engine): use full index name 'Type[property]' in v…
robfrank Feb 25, 2026
a4a7766
fix(recommendation-engine): fix query syntax for ArcadeDB 26.2.1 comp…
robfrank Feb 25, 2026
4bf9917
docs(recommendation-engine): add README with quickstart guide
robfrank Feb 25, 2026
c2957c2
docs: update root README with use cases table
robfrank Feb 25, 2026
397786a
chore: ignore Maven log/ directories
robfrank Feb 25, 2026
8f2cd50
fix(recommendation-engine): address code review feedback
robfrank Feb 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ buildNumber.properties
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

# Maven log output
log/
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# arcadedb-examples
A collection of small projects to show how to use ArcadeDB
# ArcadeDB Use Cases

A collection of self-contained projects demonstrating how to use [ArcadeDB](https://arcadedb.com).

Each use case lives in its own directory with a Docker Compose file, SQL schema/data files,
and runnable demos via both `curl` and a Java program.

## Use Cases

| Directory | Description | ArcadeDB features |
|-----------|-------------|-------------------|
| [recommendation-engine](./recommendation-engine/) | Intelligent product and content recommendations | Graph traversal, Vector similarity, Time-series |

## Structure

Each use case directory contains:
- `docker-compose.yml` — ArcadeDB instance (pinned version)
- `setup.sh` — creates the database and loads schema + data
- `sql/01-schema.sql` — vertex/edge type definitions
- `sql/02-data.sql` — sample data
- `queries/queries.sh` — all queries via `curl`
- `java/` — standalone Maven project running the same queries via `arcadedb-network`
- `README.md` — quickstart guide
101 changes: 101 additions & 0 deletions docs/plans/2026-02-25-recommendation-engine-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Recommendation Engine Use Case — Design

**Date:** 2026-02-25
**Branch:** feat/recommendation-engine
**ArcadeDB version:** 26.2.1

## Overview

Implement the [ArcadeDB Recommendation Engine](https://arcadedb.com/recommendation-engine.html) use case as the first entry in the `arcadedb-usecases` repository. The use case demonstrates ArcadeDB's ability to unify three signal types — graph traversal, vector similarity, and time-series — in a single database.

## Repository Structure

Each use case lives in its own top-level directory and is fully self-contained (no shared parent POM or shared lib). This maximises portability: any single usecase directory can be copied out and used independently.

```
arcadedb-usecases/
├── README.md
└── recommendation-engine/
├── README.md
├── docker-compose.yml
├── sql/
│ ├── 01-schema.sql
│ └── 02-data.sql
├── queries/
│ └── queries.sh
└── java/
├── pom.xml
└── src/main/java/
└── RecommendationEngine.java
```

## Docker Compose

- Single service: `arcadedata/arcadedb:26.2.1`
- HTTP API port exposed: `2480`
- Root credentials passed as environment variables (`ARCADEDB_SERVER_ROOTPASSWORD`)
- No setup container — the README documents a one-time `curl` command to create the database and apply the SQL files

## Schema (`sql/01-schema.sql`)

Three vertex types and three edge types:

**Vertices:**
- `User` — `id` (STRING), `embedding` (LIST)
- `Product` — `name` (STRING), `category` (STRING), `price` (FLOAT), `inStock` (BOOLEAN), `embedding` (LIST)
- `Show` — `title` (STRING), `genre` (STRING), `embedding` (LIST)

**Edges:**
- `PURCHASED` — User → Product
- `WATCHED` — User → Show
- `INTERACTED` — User → Product

## Sample Data (`sql/02-data.sql`)

Approximately:
- 5 users with 4-dimensional embedding vectors
- 10 products across multiple categories with 4-dimensional embeddings
- 5 shows with 4-dimensional embeddings
- ~30 edges creating realistic overlap (so collaborative filtering returns neighbours, vector distances vary meaningfully)

Embeddings use small fixed-dimension float arrays (4 dimensions) — sufficient to demonstrate `vectorDistance()` without bloating the file.

## curl Queries (`queries/queries.sh`)

Five labeled sections, one per query pattern, each POSTing to `http://localhost:2480/api/v1/query/RecommendationEngine`:

1. **Collaborative Filtering** — Cypher `MATCH` traversal, finds products bought by users with overlapping purchase history
2. **Vector Similarity Search** — SQL `vectorDistance()`, finds semantically similar products
3. **Trending Detection** — SQL time-series `rate()`, identifies products with accelerating engagement
4. **Multi-Model Hybrid (Streaming)** — combines graph traversal + vector similarity + time-series for show recommendations
5. **E-Commerce Personalized Category Page** — blends session vector with trending score

All queries use hardcoded values matching `02-data.sql` (known user IDs, sample embedding vectors) so the script works out-of-the-box after setup.

## Java Program (`java/`)

- **Build tool:** Maven (standalone `pom.xml`, no parent)
- **Dependency:** `com.arcadedb:arcadedb-network:26.2.1`
- **Output:** executable fat JAR via `maven-jar-plugin` (`mvn package` → `java -jar target/recommendation-engine.jar`)
- **Entry point:** single `RecommendationEngine.java` with a `main` method that:
1. Opens a `RemoteDatabase` connection to `localhost:2480`
2. Runs all 5 queries sequentially
3. Prints a header and JSON results for each query to stdout
4. Closes the connection

## Query Language Mapping

| # | Pattern | Language |
|---|---------|----------|
| 1 | Collaborative Filtering | Cypher |
| 2 | Vector Similarity | SQL |
| 3 | Trending Detection | SQL |
| 4 | Streaming Hybrid | SQL (with LET) |
| 5 | E-Commerce Category Page | Cypher + SQL |

## Success Criteria

- `docker compose up` starts ArcadeDB successfully
- SQL files apply cleanly via `curl` with no errors
- `queries.sh` runs all 5 queries and returns non-empty result sets
- `mvn package && java -jar ...` runs all 5 queries and prints results to stdout
Loading