| Crates.io | aingle_cortex |
| lib.rs | aingle_cortex |
| version | 0.1.0 |
| created_at | 2025-12-18 06:17:07.663523+00 |
| updated_at | 2025-12-18 06:17:07.663523+00 |
| description | Córtex API - REST/GraphQL/SPARQL interface for AIngle semantic graphs |
| homepage | https://apilium.com |
| repository | https://github.com/ApiliumCode/aingle |
| max_upload_size | |
| id | 1991778 |
| size | 377,298 |
Complete REST/GraphQL/SPARQL API for querying and interacting with AIngle semantic graphs.
/api/v1/ prefixAdd to your Cargo.toml:
[dependencies]
aingle_cortex = { version = "0.1", features = ["full"] }
use aingle_cortex::{CortexServer, CortexConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = CortexConfig::default();
let server = CortexServer::new(config)?;
server.run().await?;
Ok(())
}
┌─────────────────────────────────────────────────────────────┐
│ Córtex API Server │
├─────────────────────────────────────────────────────────────┤
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ REST API │ │ GraphQL API │ │
│ │ /api/v1/* │ │ /graphql │ │
│ └────────┬─────────┘ └────────┬─────────┘ │
│ │ │ │
│ ┌────────┴─────────────────────┴─────────┐ │
│ │ Query Router │ │
│ └────────┬─────────────────────┬─────────┘ │
│ │ │ │
│ ┌────────▼─────────┐ ┌───────▼──────────┐ │
│ │ SPARQL Engine │ │ Proof Validator │ │
│ └────────┬─────────┘ └───────┬──────────┘ │
│ │ │ │
│ ┌────────▼─────────────────────▼─────────┐ │
│ │ aingle_graph + aingle_logic │ │
│ └─────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Base URL: http://localhost:8080/api/v1
# Create triple
curl -X POST http://localhost:8080/api/v1/triples \
-H "Content-Type: application/json" \
-d '{"subject": "ex:Alice", "predicate": "foaf:name", "object": {"string": "Alice"}}'
# List triples
curl "http://localhost:8080/api/v1/triples?predicate=foaf:knows"
curl -X POST http://localhost:8080/api/v1/sparql \
-H "Content-Type: application/sparql-query" \
-d 'SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10'
# Submit proof
curl -X POST http://localhost:8080/api/v1/proofs \
-d '{"proof_type": "plonk", "proof_data": "..."}'
# Verify proof
curl http://localhost:8080/api/v1/proofs/{id}/verify
Endpoint: http://localhost:8080/graphql
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
}
}
All endpoints: 100 requests per minute per IP (configurable)
Response headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 87
429 Response:
{
"error": "Rate limit exceeded. Retry after 30 seconds",
"code": "RATE_LIMIT_EXCEEDED",
"retry_after": 30
}
Structured error responses:
{
"error": "Triple not found",
"code": "NOT_FOUND",
"details": null
}
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
# All tests
cargo test --features full
# Specific suites
cargo test --test proof_system_test
cargo test --test graphql_subscriptions_test
cargo test --test rate_limiting_test
openapi.yaml for complete REST API specification/graphql with GraphQL PlaygroundCopyright 2019-2025 Apilium Technologies
Licensed under the Apache License, Version 2.0.