Semantic Graph API
Capture and query the Knowledge Graph - a semantic network of relationships and engineering decisions between components, machines, facilities, and other entities. This is Nelo's brain for understanding your organization's asset relationships.
Overview
Entity Types
- • component: Individual parts/devices
- • machine: Equipment/controllers
- • facility: Physical locations
- • unit: Facility subdivisions
- • tag: Sensor measurements
- • user: Engineers/operators
Relationship Types
- • PART_OF: Hierarchy relationships
- • MOUNTED_ON: Component placement
- • LOCATED_IN: Physical location
- • CONNECTED_TO: Signal/data flow
- • COMPATIBLE_WITH: Compatibility
- • REPLACES: Substitution
Graph Overview
Get statistics and recent activity from the Knowledge Graph.
/v1/semantic-graph/overviewAuth RequiredResponse
{
"total_relationships": 1250,
"total_decisions": 340,
"entity_type_counts": [
{"entity_type": "component", "count": 456},
{"entity_type": "machine", "count": 89},
{"entity_type": "tag", "count": 234},
{"entity_type": "facility", "count": 12}
],
"relationship_type_counts": [
{"relationship_type": "MOUNTED_ON", "count": 456},
{"relationship_type": "CONNECTED_TO", "count": 312},
{"relationship_type": "PART_OF", "count": 89}
],
"recent_relationships": [
{
"id": "rel_123",
"source_type": "component",
"source_id": "comp_456",
"target_type": "machine",
"target_id": "mach_789",
"relationship_type": "MOUNTED_ON",
"semantic_meaning": "Temperature sensor mounted on production line controller",
"created_at": "2024-08-26T15:30:00Z"
}
]
}Try it out
curl -X GET "https://sapienstream.com/api/v1/semantic-graph/overview" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"/v1/semantic-graph/knowledge-graphAuth RequiredResponse
{
"nodes": [
{
"id": "dec_001",
"type": "decision",
"category": "component_selection",
"summary": "Selected Rosemount 3144P for temperature monitoring",
"reasoning": "Best accuracy and HART support for Zone 1 area",
"created_at": "2024-08-26T10:00:00Z"
}
],
"edges": [
{
"id": "edge_001",
"source": "dec_001",
"target": "dec_002",
"relationship": "influenced_by",
"strength": 0.85
}
],
"stats": {
"total_decisions": 45,
"decision_categories": {"component_selection": 20, "configuration_change": 15}
}
}Try it out
curl -X GET "https://sapienstream.com/api/v1/semantic-graph/knowledge-graph" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Relationships
Create and manage semantic relationships between entities. Each relationship captures the decision reasoning and engineering context.
/v1/semantic-graph/relationshipsAuth RequiredRequest Body
{
"source_type": "component",
"source_id": "550e8400-e29b-41d4-a716-446655440000",
"target_type": "machine",
"target_id": "660e8400-e29b-41d4-a716-446655440001",
"relationship_type": "MOUNTED_ON",
"decision_reasoning": "Selected for its HART protocol support and Zone 1 certification",
"alternatives_considered": [
{
"id": "alt_001",
"name": "Siemens SITRANS",
"why_not_chosen": "Higher cost, longer lead time"
}
],
"selection_criteria": {
"cost": "medium",
"performance": "high",
"availability": "immediate"
},
"engineering_context": {
"installation_date": "2024-08-26",
"technician": "John Smith"
}
}Response
{
"id": "rel_abc123",
"source_type": "component",
"source_id": "550e8400-e29b-41d4-a716-446655440000",
"target_type": "machine",
"target_id": "660e8400-e29b-41d4-a716-446655440001",
"relationship_type": "MOUNTED_ON",
"semantic_meaning": "Temperature transmitter mounted on production line controller",
"decision_reasoning": "Selected for its HART protocol support and Zone 1 certification",
"confidence_score": 0.95,
"created_by": "user_123",
"created_at": "2024-08-26T15:30:00Z"
}Try it out
curl -X POST "https://sapienstream.com/api/v1/semantic-graph/relationships" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"/v1/semantic-graph/relationships/traces/{entity_type}/{entity_id}Auth RequiredParameters
entity_typestringRequiredEntity type (component, machine, etc.)
entity_idstringRequiredEntity UUID
Response
{
"entity_type": "component",
"entity_id": "550e8400-e29b-41d4-a716-446655440000",
"incoming": [
{
"id": "rel_001",
"source_type": "tag",
"source_id": "tag_123",
"relationship_type": "MEASURES",
"semantic_meaning": "Tag TE01_PV measures this sensor output"
}
],
"outgoing": [
{
"id": "rel_002",
"target_type": "machine",
"target_id": "mach_456",
"relationship_type": "MOUNTED_ON",
"semantic_meaning": "Sensor mounted on production controller"
}
],
"total_connections": 5
}Try it out
curl -X GET "https://sapienstream.com/api/v1/semantic-graph/relationships/traces/{entity_type}/{entity_id}" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"/v1/semantic-graph/relationships/{relationship_id}Auth RequiredParameters
relationship_idstringRequiredRelationship UUID
Response
{
"id": "rel_abc123",
"source_type": "component",
"source_id": "550e8400-e29b-41d4-a716-446655440000",
"target_type": "machine",
"target_id": "660e8400-e29b-41d4-a716-446655440001",
"relationship_type": "MOUNTED_ON",
"semantic_meaning": "Temperature transmitter mounted on production line controller",
"decision_reasoning": "Selected for its HART protocol support",
"alternatives_considered": [...],
"selection_criteria": {...},
"engineering_context": {...},
"confidence_score": 0.95,
"created_by": "user_123",
"created_at": "2024-08-26T15:30:00Z"
}Try it out
curl -X GET "https://sapienstream.com/api/v1/semantic-graph/relationships/{relationship_id}" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"/v1/semantic-graph/relationships/{relationship_id}Auth RequiredParameters
relationship_idstringRequiredRelationship UUID
Response
204 No ContentTry it out
curl -X DELETE "https://sapienstream.com/api/v1/semantic-graph/relationships/{relationship_id}" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Engineering Decisions
Record and query engineering decisions - the "why" behind your asset configurations.
/v1/semantic-graph/decisionsAuth RequiredRequest Body
{
"entity_type": "component",
"entity_id": "550e8400-e29b-41d4-a716-446655440000",
"decision_type": "component_selection",
"summary": "Selected Rosemount 3144P for temperature monitoring",
"reasoning": "Required HART protocol for diagnostics, Zone 1 certification for hazardous area",
"alternatives_considered": [
{"name": "Siemens SITRANS", "reason_not_chosen": "Higher cost"}
],
"context": {
"project": "Line 2 Upgrade",
"budget_constraint": "$5000 per sensor"
}
}Response
{
"id": "dec_abc123",
"entity_type": "component",
"entity_id": "550e8400-e29b-41d4-a716-446655440000",
"decision_type": "component_selection",
"summary": "Selected Rosemount 3144P for temperature monitoring",
"reasoning": "Required HART protocol for diagnostics...",
"created_by": "user_123",
"created_at": "2024-08-26T15:30:00Z"
}Try it out
curl -X POST "https://sapienstream.com/api/v1/semantic-graph/decisions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"/v1/semantic-graph/decisions/{entity_type}/{entity_id}Auth RequiredParameters
entity_typestringRequiredEntity type
entity_idstringRequiredEntity UUID
Response
[
{
"id": "dec_001",
"decision_type": "component_selection",
"summary": "Selected Rosemount 3144P",
"reasoning": "Best fit for hazardous area requirements",
"created_at": "2024-08-26T10:00:00Z"
},
{
"id": "dec_002",
"decision_type": "configuration_change",
"summary": "Changed sensor range to 0-200°C",
"reasoning": "Process temperature exceeded original 150°C limit",
"created_at": "2024-08-27T14:30:00Z"
}
]Try it out
curl -X GET "https://sapienstream.com/api/v1/semantic-graph/decisions/{entity_type}/{entity_id}" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Orphan Management
Identify and clean up relationships that reference non-existent entities.
/v1/semantic-graph/orphansAuth RequiredResponse
{
"orphaned_relationships": [
{
"id": "rel_old001",
"source_type": "component",
"source_id": "deleted_comp_123",
"target_type": "machine",
"target_id": "mach_456",
"issue": "source_missing"
}
],
"total_orphans": 3
}Try it out
curl -X GET "https://sapienstream.com/api/v1/semantic-graph/orphans" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"/v1/semantic-graph/orphansAuth RequiredResponse
{
"deleted_count": 3,
"message": "Successfully cleaned up 3 orphaned relationships"
}Try it out
curl -X DELETE "https://sapienstream.com/api/v1/semantic-graph/orphans" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Use Cases
Decision Archaeology
Trace back why specific components were chosen months or years later. Invaluable for troubleshooting and future similar projects.
Impact Analysis
Before replacing a component, understand all relationships and dependencies to avoid unintended consequences.
Knowledge Transfer
New engineers can understand the reasoning behind existing configurations without hunting down the original decision makers.