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 10)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 println!("Connecting to Synapse gRPC server...");
10 let mut client = SemanticEngineClient::connect("http://[::1]:50051").await?;
11
12 println!("✅ Connected!");
13
14 // 1. Ingest Data
15 let triple = Triple {
16 subject: "http://example.org/Socrates".to_string(),
17 predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type".to_string(),
18 object: "http://example.org/Human".to_string(),
19 provenance: Some(Provenance {
20 source: "client_test".to_string(),
21 timestamp: "now".to_string(),
22 method: "grpc".to_string(),
23 }),
24 embedding: vec![],
25 };
26
27 let triple2 = Triple {
28 subject: "http://example.org/Human".to_string(),
29 predicate: "http://www.w3.org/2000/01/rdf-schema#subClassOf".to_string(),
30 object: "http://example.org/Mortal".to_string(),
31 provenance: Some(Provenance {
32 source: "client_test".to_string(),
33 timestamp: "now".to_string(),
34 method: "grpc".to_string(),
35 }),
36 embedding: vec![],
37 };
38
39 println!("Sending IngestRequest...");
40 let response = client
41 .ingest_triples(IngestRequest {
42 triples: vec![triple, triple2],
43 namespace: "test_verification".to_string(),
44 })
45 .await?;
46 println!("Response: {:?}", response.into_inner());
47
48 // 2. Apply Reasoning (RDFS Transitivity)
49 println!("\nApplying RDFS Reasoning (Internal)...");
50 let reasoning_response = client
51 .apply_reasoning(ReasoningRequest {
52 namespace: "test_verification".to_string(),
53 strategy: ReasoningStrategy::Rdfs as i32,
54 materialize: false,
55 })
56 .await?;
57 println!("Reasoning Result: {:?}", reasoning_response.into_inner());
58
59 // 3. Hybrid Search
60 println!("\nPerforming Hybrid Search for 'Socrates'...");
61 let search_response = client
62 .hybrid_search(HybridSearchRequest {
63 query: "Socrates".to_string(),
64 namespace: "test_verification".to_string(),
65 vector_k: 5,
66 graph_depth: 1,
67 mode: SearchMode::Hybrid as i32,
68 limit: 10,
69 })
70 .await?;
71
72 println!("Search Results:");
73 for result in search_response.into_inner().results {
74 println!(
75 " - [Score: {:.4}] {} ({})",
76 result.score, result.content, result.uri
77 );
78 }
79
80 Ok(())
81}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 41-44)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 println!("Connecting to Synapse gRPC server...");
10 let mut client = SemanticEngineClient::connect("http://[::1]:50051").await?;
11
12 println!("✅ Connected!");
13
14 // 1. Ingest Data
15 let triple = Triple {
16 subject: "http://example.org/Socrates".to_string(),
17 predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type".to_string(),
18 object: "http://example.org/Human".to_string(),
19 provenance: Some(Provenance {
20 source: "client_test".to_string(),
21 timestamp: "now".to_string(),
22 method: "grpc".to_string(),
23 }),
24 embedding: vec![],
25 };
26
27 let triple2 = Triple {
28 subject: "http://example.org/Human".to_string(),
29 predicate: "http://www.w3.org/2000/01/rdf-schema#subClassOf".to_string(),
30 object: "http://example.org/Mortal".to_string(),
31 provenance: Some(Provenance {
32 source: "client_test".to_string(),
33 timestamp: "now".to_string(),
34 method: "grpc".to_string(),
35 }),
36 embedding: vec![],
37 };
38
39 println!("Sending IngestRequest...");
40 let response = client
41 .ingest_triples(IngestRequest {
42 triples: vec![triple, triple2],
43 namespace: "test_verification".to_string(),
44 })
45 .await?;
46 println!("Response: {:?}", response.into_inner());
47
48 // 2. Apply Reasoning (RDFS Transitivity)
49 println!("\nApplying RDFS Reasoning (Internal)...");
50 let reasoning_response = client
51 .apply_reasoning(ReasoningRequest {
52 namespace: "test_verification".to_string(),
53 strategy: ReasoningStrategy::Rdfs as i32,
54 materialize: false,
55 })
56 .await?;
57 println!("Reasoning Result: {:?}", reasoning_response.into_inner());
58
59 // 3. Hybrid Search
60 println!("\nPerforming Hybrid Search for 'Socrates'...");
61 let search_response = client
62 .hybrid_search(HybridSearchRequest {
63 query: "Socrates".to_string(),
64 namespace: "test_verification".to_string(),
65 vector_k: 5,
66 graph_depth: 1,
67 mode: SearchMode::Hybrid as i32,
68 limit: 10,
69 })
70 .await?;
71
72 println!("Search Results:");
73 for result in search_response.into_inner().results {
74 println!(
75 " - [Score: {:.4}] {} ({})",
76 result.score, result.content, result.uri
77 );
78 }
79
80 Ok(())
81}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 62-69)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 println!("Connecting to Synapse gRPC server...");
10 let mut client = SemanticEngineClient::connect("http://[::1]:50051").await?;
11
12 println!("✅ Connected!");
13
14 // 1. Ingest Data
15 let triple = Triple {
16 subject: "http://example.org/Socrates".to_string(),
17 predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type".to_string(),
18 object: "http://example.org/Human".to_string(),
19 provenance: Some(Provenance {
20 source: "client_test".to_string(),
21 timestamp: "now".to_string(),
22 method: "grpc".to_string(),
23 }),
24 embedding: vec![],
25 };
26
27 let triple2 = Triple {
28 subject: "http://example.org/Human".to_string(),
29 predicate: "http://www.w3.org/2000/01/rdf-schema#subClassOf".to_string(),
30 object: "http://example.org/Mortal".to_string(),
31 provenance: Some(Provenance {
32 source: "client_test".to_string(),
33 timestamp: "now".to_string(),
34 method: "grpc".to_string(),
35 }),
36 embedding: vec![],
37 };
38
39 println!("Sending IngestRequest...");
40 let response = client
41 .ingest_triples(IngestRequest {
42 triples: vec![triple, triple2],
43 namespace: "test_verification".to_string(),
44 })
45 .await?;
46 println!("Response: {:?}", response.into_inner());
47
48 // 2. Apply Reasoning (RDFS Transitivity)
49 println!("\nApplying RDFS Reasoning (Internal)...");
50 let reasoning_response = client
51 .apply_reasoning(ReasoningRequest {
52 namespace: "test_verification".to_string(),
53 strategy: ReasoningStrategy::Rdfs as i32,
54 materialize: false,
55 })
56 .await?;
57 println!("Reasoning Result: {:?}", reasoning_response.into_inner());
58
59 // 3. Hybrid Search
60 println!("\nPerforming Hybrid Search for 'Socrates'...");
61 let search_response = client
62 .hybrid_search(HybridSearchRequest {
63 query: "Socrates".to_string(),
64 namespace: "test_verification".to_string(),
65 vector_k: 5,
66 graph_depth: 1,
67 mode: SearchMode::Hybrid as i32,
68 limit: 10,
69 })
70 .await?;
71
72 println!("Search Results:");
73 for result in search_response.into_inner().results {
74 println!(
75 " - [Score: {:.4}] {} ({})",
76 result.score, result.content, result.uri
77 );
78 }
79
80 Ok(())
81}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 51-55)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 println!("Connecting to Synapse gRPC server...");
10 let mut client = SemanticEngineClient::connect("http://[::1]:50051").await?;
11
12 println!("✅ Connected!");
13
14 // 1. Ingest Data
15 let triple = Triple {
16 subject: "http://example.org/Socrates".to_string(),
17 predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type".to_string(),
18 object: "http://example.org/Human".to_string(),
19 provenance: Some(Provenance {
20 source: "client_test".to_string(),
21 timestamp: "now".to_string(),
22 method: "grpc".to_string(),
23 }),
24 embedding: vec![],
25 };
26
27 let triple2 = Triple {
28 subject: "http://example.org/Human".to_string(),
29 predicate: "http://www.w3.org/2000/01/rdf-schema#subClassOf".to_string(),
30 object: "http://example.org/Mortal".to_string(),
31 provenance: Some(Provenance {
32 source: "client_test".to_string(),
33 timestamp: "now".to_string(),
34 method: "grpc".to_string(),
35 }),
36 embedding: vec![],
37 };
38
39 println!("Sending IngestRequest...");
40 let response = client
41 .ingest_triples(IngestRequest {
42 triples: vec![triple, triple2],
43 namespace: "test_verification".to_string(),
44 })
45 .await?;
46 println!("Response: {:?}", response.into_inner());
47
48 // 2. Apply Reasoning (RDFS Transitivity)
49 println!("\nApplying RDFS Reasoning (Internal)...");
50 let reasoning_response = client
51 .apply_reasoning(ReasoningRequest {
52 namespace: "test_verification".to_string(),
53 strategy: ReasoningStrategy::Rdfs as i32,
54 materialize: false,
55 })
56 .await?;
57 println!("Reasoning Result: {:?}", reasoning_response.into_inner());
58
59 // 3. Hybrid Search
60 println!("\nPerforming Hybrid Search for 'Socrates'...");
61 let search_response = client
62 .hybrid_search(HybridSearchRequest {
63 query: "Socrates".to_string(),
64 namespace: "test_verification".to_string(),
65 vector_k: 5,
66 graph_depth: 1,
67 mode: SearchMode::Hybrid as i32,
68 limit: 10,
69 })
70 .await?;
71
72 println!("Search Results:");
73 for result in search_response.into_inner().results {
74 println!(
75 " - [Score: {:.4}] {} ({})",
76 result.score, result.content, result.uri
77 );
78 }
79
80 Ok(())
81}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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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