|
1 | 1 | # Getting Started with Janus |
2 | 2 |
|
3 | | -This guide reflects the current state of the repository. |
4 | | - |
5 | | -Janus is primarily a backend Rust project. The most useful entry points today are: |
6 | | - |
7 | | -- `http_server` for the HTTP/WebSocket API |
8 | | -- `stream_bus_cli` for replaying RDF files into storage and MQTT |
9 | | -- the Rust test suite for validating the engine locally |
| 3 | +Janus is a Rust engine for querying historical and live RDF data through one |
| 4 | +Janus-QL model and one HTTP/WebSocket API. |
10 | 5 |
|
11 | 6 | ## Prerequisites |
12 | 7 |
|
13 | | -- Rust stable |
14 | | -- Cargo |
15 | | -- Git |
16 | | -- Docker, if you want to run the local MQTT broker |
17 | | - |
18 | | -## Clone and Build |
19 | | - |
20 | | -```bash |
21 | | -git clone https://github.com/SolidLabResearch/janus.git |
22 | | -cd janus |
23 | | - |
24 | | -cargo build |
25 | | -``` |
| 8 | +- Rust stable with Cargo |
| 9 | +- Docker and Docker Compose if you want the MQTT-backed replay flow |
26 | 10 |
|
27 | | -## Run the Backend |
| 11 | +## Fastest Working Path |
28 | 12 |
|
29 | | -### Option 1: Start the HTTP API |
| 13 | +### 1. Build and test |
30 | 14 |
|
31 | 15 | ```bash |
32 | | -cargo run --bin http_server |
| 16 | +make build |
| 17 | +make test |
33 | 18 | ``` |
34 | 19 |
|
35 | | -The server listens on `http://127.0.0.1:8080` by default. |
36 | | - |
37 | | -### Option 2: Inspect the replay CLI |
| 20 | +### 2. Start the HTTP server |
38 | 21 |
|
39 | 22 | ```bash |
40 | | -cargo run --bin stream_bus_cli -- --help |
| 23 | +cargo run --bin http_server -- --host 127.0.0.1 --port 8080 --storage-dir ./data/storage |
41 | 24 | ``` |
42 | 25 |
|
43 | | -Typical usage: |
| 26 | +Verify it is up: |
44 | 27 |
|
45 | 28 | ```bash |
46 | | -cargo run --bin stream_bus_cli -- \ |
47 | | - --input data/sensors.nq \ |
48 | | - --broker none \ |
49 | | - --rate 0 |
| 29 | +curl http://127.0.0.1:8080/health |
50 | 30 | ``` |
51 | 31 |
|
52 | | -## Run Tests |
53 | | - |
54 | | -```bash |
55 | | -cargo test --all-features |
56 | | -``` |
| 32 | +### 3. Exercise the API |
57 | 33 |
|
58 | | -## Run Lint Checks |
| 34 | +The quickest end-to-end client is the example binary: |
59 | 35 |
|
60 | 36 | ```bash |
61 | | -cargo clippy --all-targets --all-features -- -D warnings |
| 37 | +cargo run --example http_client_example |
62 | 38 | ``` |
63 | 39 |
|
64 | | -## Quick HTTP Flow |
| 40 | +That example covers query registration, start, stop, replay control, and |
| 41 | +WebSocket result consumption. |
65 | 42 |
|
66 | | -1. Start the server: |
| 43 | +## Optional Local Demo UI |
67 | 44 |
|
68 | | -```bash |
69 | | -cargo run --bin http_server |
70 | | -``` |
| 45 | +This repository keeps a small static demo at |
| 46 | +`examples/demo_dashboard.html` for manual browser testing. |
71 | 47 |
|
72 | | -2. Register a query: |
| 48 | +The maintained Svelte dashboard lives in the separate |
| 49 | +`SolidLabResearch/janus-dashboard` repository. |
73 | 50 |
|
74 | | -```bash |
75 | | -curl -X POST http://localhost:8080/api/queries \ |
76 | | - -H "Content-Type: application/json" \ |
77 | | - -d '{ |
78 | | - "query_id": "demo_query", |
79 | | - "janusql": "PREFIX ex: <http://example.org/> SELECT ?s ?p ?o FROM NAMED WINDOW ex:w ON STREAM ex:sensorStream [START 0 END 9999999999999] WHERE { WINDOW ex:w { ?s ?p ?o . } }" |
80 | | - }' |
81 | | -``` |
82 | | - |
83 | | -3. Start the query: |
84 | | - |
85 | | -```bash |
86 | | -curl -X POST http://localhost:8080/api/queries/demo_query/start |
87 | | -``` |
| 51 | +## Main Binaries |
88 | 52 |
|
89 | | -4. Subscribe to results: |
| 53 | +- `http_server`: REST and WebSocket API for query lifecycle and replay control |
| 54 | +- `stream_bus_cli`: replay and ingestion CLI for RDF event files |
90 | 55 |
|
91 | | -```text |
92 | | -ws://localhost:8080/api/queries/demo_query/results |
93 | | -``` |
94 | | - |
95 | | -5. Stop the query when done: |
| 56 | +## Common Commands |
96 | 57 |
|
97 | 58 | ```bash |
98 | | -curl -X POST http://localhost:8080/api/queries/demo_query/stop |
99 | | -``` |
100 | | - |
101 | | -## Project Layout |
102 | | - |
103 | | -```text |
104 | | -janus/ |
105 | | -├── src/ |
106 | | -│ ├── api/ # Janus API coordination layer |
107 | | -│ ├── core/ # RDF event types and encoding |
108 | | -│ ├── execution/ # Historical execution and result conversion |
109 | | -│ ├── http/ # HTTP and WebSocket server |
110 | | -│ ├── parsing/ # JanusQL parser |
111 | | -│ ├── querying/ # SPARQL execution adapters |
112 | | -│ ├── storage/ # Segmented storage and indexing |
113 | | -│ ├── stream/ # Live stream processing |
114 | | -│ └── stream_bus/ # Replay and broker integration |
115 | | -├── tests/ # Integration and module tests |
116 | | -├── examples/ # Example clients and benchmarks |
117 | | -├── docs/ # Documentation |
118 | | -└── janus-dashboard/ # Lightweight local demo dashboard |
| 59 | +make build |
| 60 | +make release |
| 61 | +make test |
| 62 | +make fmt |
| 63 | +make fmt-check |
| 64 | +make lint |
| 65 | +make check |
| 66 | +make ci-check |
119 | 67 | ``` |
120 | 68 |
|
121 | | -## Dashboard Boundary |
122 | | - |
123 | | -This repository includes a small demo dashboard under `janus-dashboard/`, but the maintained dashboard lives separately: |
124 | | - |
125 | | -- `https://github.com/SolidLabResearch/janus-dashboard` |
| 69 | +## Repository Layout |
126 | 70 |
|
127 | | -If you are working on frontend product features, use the separate dashboard repository. |
| 71 | +- `src/api`: query lifecycle orchestration |
| 72 | +- `src/http`: REST and WebSocket server |
| 73 | +- `src/parsing`: Janus-QL parsing |
| 74 | +- `src/execution`: historical execution |
| 75 | +- `src/stream`: live stream processing |
| 76 | +- `src/storage`: segmented RDF storage |
| 77 | +- `src/bin`: executable binaries |
| 78 | +- `examples`: runnable examples and a minimal static demo |
| 79 | +- `tests`: integration coverage |
| 80 | +- `docs`: current docs plus older design notes |
128 | 81 |
|
129 | | -## Recommended Next Reads |
| 82 | +## Where to Read Next |
130 | 83 |
|
131 | | -- [START_HERE.md](./START_HERE.md) |
132 | | -- [docs/README_HTTP_API.md](./docs/README_HTTP_API.md) |
133 | | -- [docs/STREAM_BUS_CLI.md](./docs/STREAM_BUS_CLI.md) |
134 | | -- [docs/README.md](./docs/README.md) |
| 84 | +- `README.md` |
| 85 | +- `START_HERE.md` |
| 86 | +- `docs/DOCUMENTATION_INDEX.md` |
0 commit comments