AIngle Córtex API
Complete REST/GraphQL/SPARQL API for querying and interacting with AIngle semantic graphs.
Features (100%)
Core APIs
- ✅ REST API - Full CRUD operations for RDF triples
- ✅ GraphQL API - Schema with queries, mutations, and subscriptions
- ✅ SPARQL Engine - Full SPARQL 1.1 query support with FILTER expressions
Security & Performance
- ✅ Authentication - JWT-based auth with Argon2id password hashing
- ✅ Rate Limiting - Token bucket algorithm (100 req/min default)
- ✅ CORS - Configurable cross-origin resource sharing
- ✅ Request Tracing - Comprehensive logging and metrics
Advanced Features
- ✅ Proof System - Zero-knowledge proof storage and verification
- ✅ Real-time Subscriptions - WebSocket-based GraphQL subscriptions
- ✅ Pattern Queries - Flexible triple pattern matching
- ✅ API Versioning - All endpoints use
/api/v1/prefix - ✅ Error Handling - Structured errors with codes and details
- ✅ OpenAPI Spec - Complete OpenAPI 3.1 documentation
Quick Start
Installation
Add to your Cargo.toml:
[]
= { = "0.1", = ["full"] }
Basic Server
use ;
async
Architecture
┌─────────────────────────────────────────────────────────────┐
│ Córtex API Server │
├─────────────────────────────────────────────────────────────┤
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ REST API │ │ GraphQL API │ │
│ │ /api/v1/* │ │ /graphql │ │
│ └────────┬─────────┘ └────────┬─────────┘ │
│ │ │ │
│ ┌────────┴─────────────────────┴─────────┐ │
│ │ Query Router │ │
│ └────────┬─────────────────────┬─────────┘ │
│ │ │ │
│ ┌────────▼─────────┐ ┌───────▼──────────┐ │
│ │ SPARQL Engine │ │ Proof Validator │ │
│ └────────┬─────────┘ └───────┬──────────┘ │
│ │ │ │
│ ┌────────▼─────────────────────▼─────────┐ │
│ │ aingle_graph + aingle_logic │ │
│ └─────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
REST API
Base URL: http://localhost:8080/api/v1
Triples
# Create triple
# List triples
SPARQL
Proofs
# Submit proof
# Verify proof
GraphQL API
Endpoint: http://localhost:8080/graphql
Subscriptions
subscription {
tripleAdded(filter: { predicate: "foaf:knows" }) {
hash
subject
predicate
timestamp
}
}
subscription {
validationEvent(validOnly: true) {
hash
valid
proofHash
}
}
subscription {
agentActivity(agentId: "did:key:...") {
action
tripleHash
timestamp
}
}
Rate Limiting
All endpoints: 100 requests per minute per IP (configurable)
Response headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 87
429 Response:
Error Handling
Structured error responses:
Error codes: NOT_FOUND, INVALID_INPUT, VALIDATION_ERROR, AUTH_ERROR, FORBIDDEN, RATE_LIMIT_EXCEEDED, QUERY_ERROR, SPARQL_PARSE_ERROR, PROOF_NOT_FOUND, TIMEOUT, CONFLICT, INTERNAL_ERROR
Testing
# All tests
# Specific suites
Documentation
- OpenAPI: See
openapi.yamlfor complete REST API specification - API Docs: https://docs.rs/aingle_cortex
- GraphQL Schema: Available at
/graphqlwith GraphQL Playground
License
Copyright 2019-2025 Apilium Technologies
Licensed under the Apache License, Version 2.0.