Expand description
The Semantic Infrastructure for Intelligent Applications
Enabling enterprises to build secure, scalable, and intelligent distributed systems
Solutions • Capabilities • Get Started • Website
§AIngle Cortex
This crate provides the Cortex API gateway for the AIngle framework, offering a unified interface for interacting with the AIngle network via REST, GraphQL, and SPARQL.
§AIngle Córtex - External API Layer
High-level API server for querying and interacting with AIngle semantic graphs.
§Features
- REST API: CRUD operations for triples, pattern queries, proof validation
- GraphQL API: Full schema with queries, mutations, and subscriptions
- SPARQL Endpoint: W3C-compliant SPARQL 1.1 query engine
- Authentication: JWT-based auth with role-based access control (RBAC)
- Real-time Updates: WebSocket subscriptions for graph changes
- Proof Validation: Verify zero-knowledge proofs and signatures
§Security
All endpoints support:
- Bearer token authentication
- Rate limiting (configurable)
- CORS with allowed origins
- Request size limits
§Architecture
┌─────────────────────────────────────────────────────────────┐
│ Córtex API Server │
├─────────────────────────────────────────────────────────────┤
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ REST API │ │ GraphQL API │ │
│ │ /api/v1/* │ │ /graphql │ │
│ └────────┬─────────┘ └────────┬─────────┘ │
│ │ │ │
│ ┌────────┴─────────────────────┴─────────┐ │
│ │ Query Router │ │
│ └────────┬─────────────────────┬─────────┘ │
│ │ │ │
│ ┌────────▼─────────┐ ┌───────▼──────────┐ │
│ │ SPARQL Engine │ │ Proof Validator │ │
│ └────────┬─────────┘ └───────┬──────────┘ │
│ │ │ │
│ ┌────────▼─────────────────────▼─────────┐ │
│ │ aingle_graph + aingle_logic │ │
│ └─────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘§Quick Start
§Basic Server
ⓘ
use aingle_cortex::{CortexServer, CortexConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Start server on localhost:19090
let config = CortexConfig::default();
let server = CortexServer::new(config)?;
server.run().await?;
Ok(())
}§Custom Configuration
ⓘ
use aingle_cortex::CortexConfig;
let config = CortexConfig::default()
.with_port(3000)
.with_host("0.0.0.0");§REST API Examples
§Add a Triple
curl -X POST http://localhost:19090/api/v1/triples \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"subject": "alice",
"predicate": "knows",
"object": "bob"
}'§Query Triples
curl "http://localhost:19090/api/v1/triples?subject=alice"§Validate Proof
curl -X POST http://localhost:19090/api/v1/proofs/validate \
-H "Content-Type: application/json" \
-d '{
"proof_type": "schnorr",
"proof_data": "...",
"public_key": "..."
}'§GraphQL Examples
Access the GraphQL playground at http://localhost:19090/graphql.
§Query
query {
triples(filter: { subject: "alice" }) {
subject
predicate
object
timestamp
}
}§Mutation
mutation {
addTriple(input: {
subject: "alice"
predicate: "likes"
object: "pizza"
}) {
success
hash
}
}§Subscription
subscription {
tripleAdded {
subject
predicate
object
}
}§SPARQL Examples
SELECT ?person ?friend
WHERE {
?person <knows> ?friend .
}Re-exports§
pub use client::CortexClientConfig;pub use client::CortexInternalClient;pub use error::Error;pub use error::Result;pub use server::CortexConfig;pub use server::CortexServer;pub use state::AppState;
Modules§
- auth
- Authentication and authorization for Córtex API
- client
- Internal Rust client for AIngle Cortex.
- cluster_
init - Cluster initialization — public API for setting up Raft consensus.
- error
- Error types for the Córtex API server.
- middleware
- Middleware for Córtex API
- p2p
- P2P networking for Cortex triple synchronization.
- prelude
- Re-export commonly used types
- proofs
- Cryptographic proof storage and verification
- rest
- REST API endpoints for Córtex
- server
- The main Córtex API server.
- sparql
- SPARQL query engine for Córtex
- state
- The shared application state for the Córtex API server.
- wasm_
types - WASM boundary types for semantic graph and memory operations.