- Implemented `owl_to_mermaid.py` to convert OWL/Turtle files into Mermaid class diagrams. - Implemented `owl_to_plantuml.py` to convert OWL/Turtle files into PlantUML class diagrams. - Added two new PlantUML files for custodian multi-aspect diagrams.
165 lines
5.1 KiB
Markdown
165 lines
5.1 KiB
Markdown
# Step 1 Complete: Oxigraph Setup ✅
|
|
|
|
## Summary
|
|
|
|
Successfully set up Oxigraph triplestore in-memory mode with sample data and created SPARQL HTTP client.
|
|
|
|
## Completed Tasks
|
|
|
|
### 1.1 Oxigraph Installation ✅
|
|
- [x] Downloaded Oxigraph v0.5.2 binary
|
|
- [x] Installed to `~/.local/bin/oxigraph_server`
|
|
- [x] Created installation script: `scripts/install-oxigraph.sh`
|
|
|
|
### 1.2 Server Scripts ✅
|
|
- [x] `scripts/start-oxigraph-memory.sh` - Start in-memory server (no persistence)
|
|
- [x] `scripts/load-sample-data.sh` - Load N-Triples data into default graph
|
|
- [x] `scripts/load-and-start.sh` - Combined startup + data loading
|
|
|
|
**Key Learning**: Use **PUT to `/store?default`** to load data into default graph (not POST)
|
|
|
|
### 1.3 Sample RDF Data ✅
|
|
- [x] Created `data/sample-rdf/dutch-heritage-institutions.nt` (78 triples)
|
|
- [x] 6 Dutch heritage institutions:
|
|
- Amsterdam Museum
|
|
- Rijksmuseum
|
|
- Koninklijke Bibliotheek (National Library)
|
|
- Stadsarchief Amsterdam (City Archives)
|
|
- Van Gogh Museum
|
|
- Mauritshuis
|
|
- [x] Schema.org vocabulary
|
|
- [x] Multilingual labels (English + Dutch)
|
|
- [x] Wikidata links via `owl:sameAs`
|
|
|
|
### 1.4 SPARQL HTTP Client ✅
|
|
- [x] Created `src/lib/sparql/client.ts` (200 lines)
|
|
- `SparqlClient` class with methods:
|
|
- `executeSelect()` - SELECT queries
|
|
- `executeAsk()` - ASK queries
|
|
- `executeConstruct()` - CONSTRUCT/DESCRIBE queries
|
|
- `testConnection()` - Health check
|
|
- `getTripleCount()` - Database statistics
|
|
- `SparqlError` exception class
|
|
- Environment configuration via `VITE_SPARQL_ENDPOINT`
|
|
- Timeout support (default 30s)
|
|
- AbortController for cancellation
|
|
|
|
- [x] Created `tests/unit/sparql-client.test.ts` (20 tests passing, 1 skipped)
|
|
- Constructor tests (4)
|
|
- `executeSelect` tests (5)
|
|
- `executeAsk` tests (2)
|
|
- `executeConstruct` tests (1)
|
|
- `testConnection` tests (2)
|
|
- `getTripleCount` tests (2)
|
|
- Error handling tests (2)
|
|
- Configuration tests (2)
|
|
|
|
### 1.5 Environment Configuration ✅
|
|
- [x] Created `.env.local`:
|
|
```
|
|
VITE_SPARQL_ENDPOINT=http://localhost:7878/query
|
|
```
|
|
|
|
## Technical Notes
|
|
|
|
### Oxigraph ARM Issue (Documented)
|
|
- Persistent storage crashes on macOS ARM (RocksDB bug)
|
|
- **Solution**: Use in-memory mode for development
|
|
- Trade-off: Data reloads on restart (~1 second)
|
|
- Alternative: Docker container (Linux environment)
|
|
|
|
### Data Loading Method
|
|
```bash
|
|
# WRONG (creates named graph)
|
|
curl -X POST -H 'Content-Type: application/n-triples' \
|
|
--data-binary '@data.nt' http://localhost:7878/store
|
|
|
|
# CORRECT (loads into default graph)
|
|
curl -X PUT -H 'Content-Type: application/n-triples' \
|
|
--data-binary '@data.nt' http://localhost:7878/store?default
|
|
```
|
|
|
|
### SPARQL Endpoint URLs
|
|
- **Query endpoint**: `http://localhost:7878/query` (SELECT, ASK, CONSTRUCT, DESCRIBE)
|
|
- **Store endpoint**: `http://localhost:7878/store` (data loading)
|
|
- **Health check**: `http://localhost:7878/` (returns 200)
|
|
|
|
## Test Results
|
|
|
|
**Before**: 148 tests passing
|
|
**After**: 168 tests passing (+20)
|
|
**Status**: ✅ All passing (1 skipped)
|
|
|
|
## Files Created/Modified
|
|
|
|
```
|
|
frontend/
|
|
├── .env.local ✅ Created
|
|
├── scripts/
|
|
│ ├── install-oxigraph.sh ✅ Created
|
|
│ ├── start-oxigraph-memory.sh ✅ Created
|
|
│ ├── load-sample-data.sh ✅ Modified (PUT method)
|
|
│ └── load-and-start.sh ✅ Created
|
|
├── data/
|
|
│ └── sample-rdf/
|
|
│ └── dutch-heritage-institutions.nt ✅ Created (comments removed)
|
|
├── src/lib/sparql/
|
|
│ └── client.ts ✅ Created (200 lines)
|
|
├── tests/unit/
|
|
│ └── sparql-client.test.ts ✅ Created (21 tests)
|
|
├── OXIGRAPH_STATUS.md 📝 Reference doc
|
|
└── PHASE3_TASK7_PLAN.md 📝 Plan doc
|
|
```
|
|
|
|
## Verification
|
|
|
|
### Server Status
|
|
```bash
|
|
$ curl -s http://localhost:7878/ && echo "✅ Server running"
|
|
```
|
|
|
|
### Data Verification
|
|
```bash
|
|
$ curl -X POST \
|
|
-H 'Content-Type: application/sparql-query' \
|
|
-H 'Accept: application/sparql-results+json' \
|
|
--data 'SELECT (COUNT(*) as ?count) WHERE { ?s ?p ?o }' \
|
|
http://localhost:7878/query | jq '.results.bindings[0].count.value'
|
|
|
|
# Expected output: "78"
|
|
```
|
|
|
|
### Query Example
|
|
```bash
|
|
$ curl -X POST \
|
|
-H 'Content-Type: application/sparql-query' \
|
|
-H 'Accept: application/sparql-results+json' \
|
|
--data 'SELECT ?museum ?name WHERE {
|
|
?museum a <http://schema.org/Museum> ;
|
|
<http://schema.org/name> ?name
|
|
} LIMIT 5' \
|
|
http://localhost:7878/query | jq
|
|
```
|
|
|
|
## Next Steps
|
|
|
|
✅ **Step 1 Complete** - Oxigraph + SPARQL Client
|
|
⏳ **Step 2 Next** - Results Table Component (2.5 hours)
|
|
|
|
Continue with:
|
|
1. Create `src/components/query/ResultsTable.tsx`
|
|
2. Create `src/components/query/ResultsTable.css`
|
|
3. Features:
|
|
- Display SPARQL SELECT results in table
|
|
- Column sorting
|
|
- Pagination (100 rows/page)
|
|
- URI rendering (clickable links)
|
|
- Cell type styling (URI, literal, bnode)
|
|
4. Tests: `tests/unit/results-table.test.tsx` (~12-15 tests)
|
|
|
|
---
|
|
|
|
**Status**: ✅ **COMPLETE**
|
|
**Duration**: ~1.5 hours (as estimated)
|
|
**Test Coverage**: +20 tests (168 total)
|
|
**Lines of Code**: ~400 (client + tests)
|