TrustGraph

Knowledge Cores (TrustGraph)

TrustGraph's modular, swappable Knowledge Graph instances, allowing different graph databases or configurations to be used interchangeably based on requirements.

TrustGraph Concepts

Knowledge Cores are TrustGraph's modular Knowledge Graph instances - separate, complete graph databases that can be swapped or combined based on your needs.

Architecture

┌─────────────────────────────────┐
│     TrustGraph Platform         │
├─────────────────────────────────┤
│  Core 1      Core 2      Core 3 │
│ (Neo4j)    (Cassandra) (Memgraph)│
│  Dev         Prod        Archive │
└─────────────────────────────────┘

Creating Knowledge Cores

// Create different cores for different purposes
await trustgraph.cores.create({
  name: "production",
  type: "cassandra",
  config: {
    cluster: ["node1:9042", "node2:9042", "node3:9042"],
    keyspace: "prod_graph",
    replicationFactor: 3
  },
  features: {
    distributed: true,
    scalable: true,
    querySpeed: "good"
  }
});

await trustgraph.cores.create({
  name: "development",
  type: "neo4j",
  config: {
    uri: "bolt://localhost:7687",
    database: "dev"
  },
  features: {
    distributed: false,
    scalable: false,
    querySpeed: "excellent"
  }
});

await trustgraph.cores.create({
  name: "archive",
  type: "memgraph",
  config: {
    host: "archive-db:7687"
  },
  features: {
    inmemory: true,
    querySpeed: "fastest"
  }
});

Switching Cores

// Use different cores for different queries
const devResults = await trustgraph.query({
  core: "development",
  query: "MATCH (n) RETURN n LIMIT 10"
});

const prodResults = await trustgraph.query({
  core: "production",
  query: "MATCH (n:Customer) RETURN count(n)"
});

// Default core
await trustgraph.config.set({
  defaultCore: "production"
});

Multi-Core Queries

// Federated query across cores
const federated = await trustgraph.query({
  cores: ["production", "archive"],
  query: `
    // Query both cores
    MATCH (current:Customer) WHERE current.core = 'production'
    MATCH (archived:Customer) WHERE archived.core = 'archive'
    MATCH (current)-[:SAME_AS]->(archived)
    RETURN current, archived
  `,
  federation: "union"  // or "intersect", "merge"
});

Use Cases

1. Environment Separation

// Different cores for environments
const cores = {
  development: "neo4j-local",
  staging: "neo4j-staging",
  production: "cassandra-cluster"
};

// Automatically use right core
const core = cores[process.env.NODE_ENV];
await trustgraph.query({ core, query: "..." });

2. Database Technology Selection

// Use best database for each use case
const coreStrategy = {
  // Cassandra for massive scale
  "customer-graph": {
    type: "cassandra",
    reason: "10TB+ data, distributed"
  },
  // Neo4j for complex queries
  "product-catalog": {
    type: "neo4j",
    reason: "Complex traversals, <1TB"
  },
  // Memgraph for real-time
  "fraud-detection": {
    type: "memgraph",
    reason: "Real-time, in-memory"
  }
};

3. Customer Isolation

// Separate core per customer (multi-tenancy)
await trustgraph.cores.create({
  name: `customer-${customerId}`,
  type: "neo4j",
  config: {
    database: `customer_${customerId}`
  },
  tenant: customerId
});

// Customer queries automatically routed
await trustgraph.query({
  tenantId: customerId,
  query: "MATCH (n) RETURN n"
  // Automatically uses customer's core
});

4. Hot/Warm/Cold Storage

// Active data
await trustgraph.cores.create({
  name: "hot-storage",
  type: "memgraph",
  retention: "30 days",
  performance: "fastest"
});

// Recent data
await trustgraph.cores.create({
  name: "warm-storage",
  type: "neo4j",
  retention: "1 year",
  performance: "fast"
});

// Archive data
await trustgraph.cores.create({
  name: "cold-storage",
  type: "cassandra",
  retention: "indefinite",
  performance: "good"
});

// Automatic tiering
await trustgraph.cores.configureLifecycle({
  rules: [
    {from: "hot-storage", to: "warm-storage", after: "30 days"},
    {from: "warm-storage", to: "cold-storage", after: "1 year"}
  ]
});

Core Management

// List cores
const cores = await trustgraph.cores.list();

// Get core stats
const stats = await trustgraph.cores.stats("production");
console.log(stats);
// {
//   nodes: 10000000,
//   relationships: 50000000,
//   size: "500 GB",
//   database: "cassandra",
//   cluster: ["node1", "node2", "node3"],
//   healthy: true
// }

// Backup core
await trustgraph.cores.backup("production", {
  destination: "s3://backups/prod-2024-12-20"
});

// Clone core
await trustgraph.cores.clone({
  source: "production",
  target: "production-backup",
  async: true
});

Benefits

  • Flexibility: Choose right database for each use case
  • Isolation: Complete data separation
  • Scalability: Scale different cores independently
  • Performance: Optimize each core for its workload
  • Risk Management: Isolate failures, easy rollback

See Also

Examples

Production core using Cassandra for scale, development core using Neo4j for queries
Customer-specific cores with completely isolated data

Related Terms

Learn More