pub struct SemanticEngineClient<T> { /* private fields */ }Implementations§
Source§impl SemanticEngineClient<Channel>
impl SemanticEngineClient<Channel>
Sourcepub async fn connect<D>(dst: D) -> Result<Self, Error>
pub async fn connect<D>(dst: D) -> Result<Self, Error>
Attempt to create a new client by connecting to a given endpoint.
Examples found in repository?
examples/grpc_verify.rs (line 11)
9async fn main() -> Result<(), Box<dyn std::error::Error>> {
10 println!("Connecting to Synapse gRPC server...");
11 let mut client = SemanticEngineClient::connect("http://[::1]:50051").await?;
12
13 println!("✅ Connected!");
14
15 // 1. Ingest Data
16 let triple = Triple {
17 subject: "http://example.org/Socrates".to_string(),
18 predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type".to_string(),
19 object: "http://example.org/Human".to_string(),
20 provenance: Some(Provenance {
21 source: "client_test".to_string(),
22 timestamp: "now".to_string(),
23 method: "grpc".to_string(),
24 }),
25 embedding: vec![],
26 };
27
28 let triple2 = Triple {
29 subject: "http://example.org/Human".to_string(),
30 predicate: "http://www.w3.org/2000/01/rdf-schema#subClassOf".to_string(),
31 object: "http://example.org/Mortal".to_string(),
32 provenance: Some(Provenance {
33 source: "client_test".to_string(),
34 timestamp: "now".to_string(),
35 method: "grpc".to_string(),
36 }),
37 embedding: vec![],
38 };
39
40 println!("Sending IngestRequest...");
41 let response = client
42 .ingest_triples(IngestRequest {
43 triples: vec![triple, triple2],
44 namespace: "test_verification".to_string(),
45 })
46 .await?;
47 println!("Response: {:?}", response.into_inner());
48
49 // 2. Apply Reasoning (RDFS Transitivity)
50 println!("\nApplying RDFS Reasoning (Internal)...");
51 let reasoning_response = client
52 .apply_reasoning(ReasoningRequest {
53 namespace: "test_verification".to_string(),
54 strategy: ReasoningStrategy::Rdfs as i32,
55 materialize: false,
56 })
57 .await?;
58 println!("Reasoning Result: {:?}", reasoning_response.into_inner());
59
60 // 3. Hybrid Search
61 println!("\nPerforming Hybrid Search for 'Socrates'...");
62 let search_response = client
63 .hybrid_search(HybridSearchRequest {
64 query: "Socrates".to_string(),
65 namespace: "test_verification".to_string(),
66 vector_k: 5,
67 graph_depth: 1,
68 mode: SearchMode::Hybrid as i32,
69 limit: 10,
70 })
71 .await?;
72
73 println!("Search Results:");
74 for result in search_response.into_inner().results {
75 println!(
76 " - [Score: {:.4}] {} ({})",
77 result.score, result.content, result.uri
78 );
79 }
80
81 Ok(())
82}Source§impl<T> SemanticEngineClient<T>where
T: GrpcService<BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
impl<T> SemanticEngineClient<T>where
T: GrpcService<BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
pub fn new(inner: T) -> Self
pub fn with_origin(inner: T, origin: Uri) -> Self
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SemanticEngineClient<InterceptedService<T, F>>where
F: Interceptor,
T::ResponseBody: Default,
T: Service<Request<BoxBody>, Response = Response<<T as GrpcService<BoxBody>>::ResponseBody>>,
<T as Service<Request<BoxBody>>>::Error: Into<StdError> + Send + Sync,
Sourcepub fn send_compressed(self, encoding: CompressionEncoding) -> Self
pub fn send_compressed(self, encoding: CompressionEncoding) -> Self
Compress requests with the given encoding.
This requires the server to support it otherwise it might respond with an error.
Sourcepub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
pub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
Enable decompressing responses.
Sourcepub fn max_decoding_message_size(self, limit: usize) -> Self
pub fn max_decoding_message_size(self, limit: usize) -> Self
Limits the maximum size of a decoded message.
Default: 4MB
Sourcepub fn max_encoding_message_size(self, limit: usize) -> Self
pub fn max_encoding_message_size(self, limit: usize) -> Self
Limits the maximum size of an encoded message.
Default: usize::MAX
Sourcepub async fn ingest_triples(
&mut self,
request: impl IntoRequest<IngestRequest>,
) -> Result<Response<IngestResponse>, Status>
pub async fn ingest_triples( &mut self, request: impl IntoRequest<IngestRequest>, ) -> Result<Response<IngestResponse>, Status>
Ingests a batch of triples
Examples found in repository?
examples/grpc_verify.rs (lines 42-45)
9async fn main() -> Result<(), Box<dyn std::error::Error>> {
10 println!("Connecting to Synapse gRPC server...");
11 let mut client = SemanticEngineClient::connect("http://[::1]:50051").await?;
12
13 println!("✅ Connected!");
14
15 // 1. Ingest Data
16 let triple = Triple {
17 subject: "http://example.org/Socrates".to_string(),
18 predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type".to_string(),
19 object: "http://example.org/Human".to_string(),
20 provenance: Some(Provenance {
21 source: "client_test".to_string(),
22 timestamp: "now".to_string(),
23 method: "grpc".to_string(),
24 }),
25 embedding: vec![],
26 };
27
28 let triple2 = Triple {
29 subject: "http://example.org/Human".to_string(),
30 predicate: "http://www.w3.org/2000/01/rdf-schema#subClassOf".to_string(),
31 object: "http://example.org/Mortal".to_string(),
32 provenance: Some(Provenance {
33 source: "client_test".to_string(),
34 timestamp: "now".to_string(),
35 method: "grpc".to_string(),
36 }),
37 embedding: vec![],
38 };
39
40 println!("Sending IngestRequest...");
41 let response = client
42 .ingest_triples(IngestRequest {
43 triples: vec![triple, triple2],
44 namespace: "test_verification".to_string(),
45 })
46 .await?;
47 println!("Response: {:?}", response.into_inner());
48
49 // 2. Apply Reasoning (RDFS Transitivity)
50 println!("\nApplying RDFS Reasoning (Internal)...");
51 let reasoning_response = client
52 .apply_reasoning(ReasoningRequest {
53 namespace: "test_verification".to_string(),
54 strategy: ReasoningStrategy::Rdfs as i32,
55 materialize: false,
56 })
57 .await?;
58 println!("Reasoning Result: {:?}", reasoning_response.into_inner());
59
60 // 3. Hybrid Search
61 println!("\nPerforming Hybrid Search for 'Socrates'...");
62 let search_response = client
63 .hybrid_search(HybridSearchRequest {
64 query: "Socrates".to_string(),
65 namespace: "test_verification".to_string(),
66 vector_k: 5,
67 graph_depth: 1,
68 mode: SearchMode::Hybrid as i32,
69 limit: 10,
70 })
71 .await?;
72
73 println!("Search Results:");
74 for result in search_response.into_inner().results {
75 println!(
76 " - [Score: {:.4}] {} ({})",
77 result.score, result.content, result.uri
78 );
79 }
80
81 Ok(())
82}Sourcepub async fn ingest_file(
&mut self,
request: impl IntoRequest<IngestFileRequest>,
) -> Result<Response<IngestResponse>, Status>
pub async fn ingest_file( &mut self, request: impl IntoRequest<IngestFileRequest>, ) -> Result<Response<IngestResponse>, Status>
Ingests a file (CSV, Markdown)
Sourcepub async fn get_neighbors(
&mut self,
request: impl IntoRequest<NodeRequest>,
) -> Result<Response<NeighborResponse>, Status>
pub async fn get_neighbors( &mut self, request: impl IntoRequest<NodeRequest>, ) -> Result<Response<NeighborResponse>, Status>
Queries the graph (Basic traversal for now)
Sourcepub async fn search(
&mut self,
request: impl IntoRequest<SearchRequest>,
) -> Result<Response<SearchResponse>, Status>
pub async fn search( &mut self, request: impl IntoRequest<SearchRequest>, ) -> Result<Response<SearchResponse>, Status>
Vector Search (Placeholder for hybrid query)
Sourcepub async fn resolve_id(
&mut self,
request: impl IntoRequest<ResolveRequest>,
) -> Result<Response<ResolveResponse>, Status>
pub async fn resolve_id( &mut self, request: impl IntoRequest<ResolveRequest>, ) -> Result<Response<ResolveResponse>, Status>
Resolves a string URI to a Node ID
Sourcepub async fn get_all_triples(
&mut self,
request: impl IntoRequest<EmptyRequest>,
) -> Result<Response<TriplesResponse>, Status>
pub async fn get_all_triples( &mut self, request: impl IntoRequest<EmptyRequest>, ) -> Result<Response<TriplesResponse>, Status>
Get all stored triples (for graph visualization)
Sourcepub async fn query_sparql(
&mut self,
request: impl IntoRequest<SparqlRequest>,
) -> Result<Response<SparqlResponse>, Status>
pub async fn query_sparql( &mut self, request: impl IntoRequest<SparqlRequest>, ) -> Result<Response<SparqlResponse>, Status>
Executes a SPARQL query
Sourcepub async fn delete_namespace_data(
&mut self,
request: impl IntoRequest<EmptyRequest>,
) -> Result<Response<DeleteResponse>, Status>
pub async fn delete_namespace_data( &mut self, request: impl IntoRequest<EmptyRequest>, ) -> Result<Response<DeleteResponse>, Status>
Deletes all data associated with a namespace
Sourcepub async fn hybrid_search(
&mut self,
request: impl IntoRequest<HybridSearchRequest>,
) -> Result<Response<SearchResponse>, Status>
pub async fn hybrid_search( &mut self, request: impl IntoRequest<HybridSearchRequest>, ) -> Result<Response<SearchResponse>, Status>
Hybrid search combining vector similarity and graph traversal
Examples found in repository?
examples/grpc_verify.rs (lines 63-70)
9async fn main() -> Result<(), Box<dyn std::error::Error>> {
10 println!("Connecting to Synapse gRPC server...");
11 let mut client = SemanticEngineClient::connect("http://[::1]:50051").await?;
12
13 println!("✅ Connected!");
14
15 // 1. Ingest Data
16 let triple = Triple {
17 subject: "http://example.org/Socrates".to_string(),
18 predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type".to_string(),
19 object: "http://example.org/Human".to_string(),
20 provenance: Some(Provenance {
21 source: "client_test".to_string(),
22 timestamp: "now".to_string(),
23 method: "grpc".to_string(),
24 }),
25 embedding: vec![],
26 };
27
28 let triple2 = Triple {
29 subject: "http://example.org/Human".to_string(),
30 predicate: "http://www.w3.org/2000/01/rdf-schema#subClassOf".to_string(),
31 object: "http://example.org/Mortal".to_string(),
32 provenance: Some(Provenance {
33 source: "client_test".to_string(),
34 timestamp: "now".to_string(),
35 method: "grpc".to_string(),
36 }),
37 embedding: vec![],
38 };
39
40 println!("Sending IngestRequest...");
41 let response = client
42 .ingest_triples(IngestRequest {
43 triples: vec![triple, triple2],
44 namespace: "test_verification".to_string(),
45 })
46 .await?;
47 println!("Response: {:?}", response.into_inner());
48
49 // 2. Apply Reasoning (RDFS Transitivity)
50 println!("\nApplying RDFS Reasoning (Internal)...");
51 let reasoning_response = client
52 .apply_reasoning(ReasoningRequest {
53 namespace: "test_verification".to_string(),
54 strategy: ReasoningStrategy::Rdfs as i32,
55 materialize: false,
56 })
57 .await?;
58 println!("Reasoning Result: {:?}", reasoning_response.into_inner());
59
60 // 3. Hybrid Search
61 println!("\nPerforming Hybrid Search for 'Socrates'...");
62 let search_response = client
63 .hybrid_search(HybridSearchRequest {
64 query: "Socrates".to_string(),
65 namespace: "test_verification".to_string(),
66 vector_k: 5,
67 graph_depth: 1,
68 mode: SearchMode::Hybrid as i32,
69 limit: 10,
70 })
71 .await?;
72
73 println!("Search Results:");
74 for result in search_response.into_inner().results {
75 println!(
76 " - [Score: {:.4}] {} ({})",
77 result.score, result.content, result.uri
78 );
79 }
80
81 Ok(())
82}Sourcepub async fn apply_reasoning(
&mut self,
request: impl IntoRequest<ReasoningRequest>,
) -> Result<Response<ReasoningResponse>, Status>
pub async fn apply_reasoning( &mut self, request: impl IntoRequest<ReasoningRequest>, ) -> Result<Response<ReasoningResponse>, Status>
Applies automated reasoning to a namespace
Examples found in repository?
examples/grpc_verify.rs (lines 52-56)
9async fn main() -> Result<(), Box<dyn std::error::Error>> {
10 println!("Connecting to Synapse gRPC server...");
11 let mut client = SemanticEngineClient::connect("http://[::1]:50051").await?;
12
13 println!("✅ Connected!");
14
15 // 1. Ingest Data
16 let triple = Triple {
17 subject: "http://example.org/Socrates".to_string(),
18 predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type".to_string(),
19 object: "http://example.org/Human".to_string(),
20 provenance: Some(Provenance {
21 source: "client_test".to_string(),
22 timestamp: "now".to_string(),
23 method: "grpc".to_string(),
24 }),
25 embedding: vec![],
26 };
27
28 let triple2 = Triple {
29 subject: "http://example.org/Human".to_string(),
30 predicate: "http://www.w3.org/2000/01/rdf-schema#subClassOf".to_string(),
31 object: "http://example.org/Mortal".to_string(),
32 provenance: Some(Provenance {
33 source: "client_test".to_string(),
34 timestamp: "now".to_string(),
35 method: "grpc".to_string(),
36 }),
37 embedding: vec![],
38 };
39
40 println!("Sending IngestRequest...");
41 let response = client
42 .ingest_triples(IngestRequest {
43 triples: vec![triple, triple2],
44 namespace: "test_verification".to_string(),
45 })
46 .await?;
47 println!("Response: {:?}", response.into_inner());
48
49 // 2. Apply Reasoning (RDFS Transitivity)
50 println!("\nApplying RDFS Reasoning (Internal)...");
51 let reasoning_response = client
52 .apply_reasoning(ReasoningRequest {
53 namespace: "test_verification".to_string(),
54 strategy: ReasoningStrategy::Rdfs as i32,
55 materialize: false,
56 })
57 .await?;
58 println!("Reasoning Result: {:?}", reasoning_response.into_inner());
59
60 // 3. Hybrid Search
61 println!("\nPerforming Hybrid Search for 'Socrates'...");
62 let search_response = client
63 .hybrid_search(HybridSearchRequest {
64 query: "Socrates".to_string(),
65 namespace: "test_verification".to_string(),
66 vector_k: 5,
67 graph_depth: 1,
68 mode: SearchMode::Hybrid as i32,
69 limit: 10,
70 })
71 .await?;
72
73 println!("Search Results:");
74 for result in search_response.into_inner().results {
75 println!(
76 " - [Score: {:.4}] {} ({})",
77 result.score, result.content, result.uri
78 );
79 }
80
81 Ok(())
82}Trait Implementations§
Source§impl<T: Clone> Clone for SemanticEngineClient<T>
impl<T: Clone> Clone for SemanticEngineClient<T>
Source§fn clone(&self) -> SemanticEngineClient<T>
fn clone(&self) -> SemanticEngineClient<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> !Freeze for SemanticEngineClient<T>
impl<T> RefUnwindSafe for SemanticEngineClient<T>where
T: RefUnwindSafe,
impl<T> Send for SemanticEngineClient<T>where
T: Send,
impl<T> Sync for SemanticEngineClient<T>where
T: Sync,
impl<T> Unpin for SemanticEngineClient<T>where
T: Unpin,
impl<T> UnwindSafe for SemanticEngineClient<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request