MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / resolve_graph_for_execution

Method resolve_graph_for_execution

graphlite/src/exec/executor.rs:242–272  ·  view source on GitHub ↗

Resolve graph for execution based on precedence rules

(
        &self,
        request: &ExecutionRequest,
    )

Source from the content-addressed store, hash-verified

240
241 /// Resolve graph for execution based on precedence rules
242 fn resolve_graph_for_execution(
243 &self,
244 request: &ExecutionRequest,
245 ) -> Result<Arc<GraphCache>, ExecutionError> {
246 // Priority 1: Explicit graph expression in query
247 if let Some(graph_expr) = &request.graph_expr {
248 return self.resolve_graph_expression(Some(graph_expr));
249 }
250
251 // Priority 2: Session's current graph
252 if let Some(session_lock) = &request.session {
253 if let Ok(session) = session_lock.read() {
254 if let Some(current_graph_path) = &session.current_graph {
255 match self.storage.get_graph(current_graph_path)? {
256 Some(graph) => return Ok(Arc::new(graph)),
257 None => {
258 return Err(ExecutionError::RuntimeError(format!(
259 "Session graph '{}' not found",
260 current_graph_path
261 )))
262 }
263 }
264 }
265 }
266 }
267
268 // No graph available
269 Err(ExecutionError::RuntimeError(
270 "No graph context available. Use SESSION SET GRAPH or specify FROM clause.".to_string(),
271 ))
272 }
273
274 /// Create execution context from user session
275 fn create_execution_context_from_session(

Callers 2

execute_queryMethod · 0.80
execute_statementMethod · 0.80

Calls 2

get_graphMethod · 0.45

Tested by

no test coverage detected