MATIH Platform is in active MVP development. Documentation reflects current implementation status.
14. Context Graph & Ontology
API Reference
Search Endpoints

Search Endpoints

The search API provides endpoints for unified search, semantic search, structural search, precedent search, discovery search, auto-complete suggestions, result explanations, and graph traversal operations.


Endpoints

MethodPathDescription
POST/api/v1/context-graph/searchUnified search across all modes
POST/api/v1/context-graph/search/semanticSemantic (embedding) search
POST/api/v1/context-graph/search/structuralGraph-based structural search
POST/api/v1/context-graph/search/precedentsDecision precedent search
POST/api/v1/context-graph/search/discoverDiscovery search from a seed entity
POST/api/v1/context-graph/search/by-exampleSearch by example entity
GET/api/v1/context-graph/suggestAuto-complete suggestions
POST/api/v1/context-graph/explainExplain search results
GET/api/v1/context-graph/search/analyticsSearch usage analytics
POST/api/v1/context-graph/traverseGraph traversal
POST/api/v1/context-graph/traverse/pathsPath finding between entities
POST/api/v1/context-graph/traverse/cyclesCycle detection
POST/api/v1/context-graph/patterns/detectPattern detection
GET/api/v1/context-graph/patterns/statisticsGraph pattern statistics

POST /search -- Unified Search

Request Body

FieldTypeRequiredDescription
querystringYesNatural language query or entity URN
tenant_idstringYesTenant identifier
modestringNosemantic, structural, hybrid, precedent, discovery (default: hybrid)
scopestringNoall, entities, decisions, relationships (default: all)
top_kintegerNoNumber of results (default: 10)
min_scorefloatNoMinimum relevance score (default: 0.0)
sortstringNorelevance, recency, name (default: relevance)
filters.entity_typeslistNoFilter by entity types
filters.relationship_typeslistNoFilter by relationship types
filters.max_hopsintegerNoMaximum traversal depth

Response

{
  "results": [
    {
      "entity_urn": "urn:matih:dataset:acme:sales_data",
      "entity_type": "dataset",
      "score": 0.87,
      "source": "hybrid",
      "entity_data": {},
      "graph_context": null,
      "explanation": "High semantic similarity to query terms"
    }
  ],
  "total_results": 15,
  "query_time_ms": 125.4
}

GET /suggest -- Auto-Complete

Query Parameters

ParameterTypeRequiredDescription
qstringYesPrefix to search (minimum 2 characters)
tenant_idstringYesTenant identifier
typesstringNoComma-separated suggestion types
limitintegerNoMaximum suggestions (default: 10)
context_urnstringNoContext entity for relevance boosting

Response

{
  "suggestions": [
    {
      "text": "customer_events",
      "type": "entity",
      "urn": "urn:matih:dataset:acme:customer_events",
      "score": 0.95
    }
  ],
  "query_time_ms": 2.1
}

POST /traverse -- Graph Traversal

Request Body

FieldTypeRequiredDescription
start_urnstringYesStarting entity URN
tenant_idstringYesTenant identifier
directionstringNoupstream, downstream, both (default: both)
strategystringNodfs, bfs, shortest_path (default: bfs)
max_depthintegerNoMaximum traversal depth (default: 10)
relationship_typeslistNoFilter by relationship types

POST /traverse/paths -- Path Finding

Request Body

FieldTypeRequiredDescription
source_urnstringYesSource entity URN
target_urnstringYesTarget entity URN
tenant_idstringYesTenant identifier
max_depthintegerNoMaximum path length (default: 10)