pub struct Schema {
pub protocol: String,
pub vertices: HashMap<String, Vertex>,
pub edges: HashMap<Edge, String>,
pub hyper_edges: HashMap<String, HyperEdge>,
pub constraints: HashMap<String, Vec<Constraint>>,
pub required: HashMap<String, Vec<Edge>>,
pub nsids: HashMap<String, String>,
pub outgoing: HashMap<String, SmallVec<Edge, 4>>,
pub incoming: HashMap<String, SmallVec<Edge, 4>>,
pub between: HashMap<(String, String), SmallVec<Edge, 2>>,
}Expand description
A schema: a model of the protocol’s schema theory.
Contains both the raw data (vertices, edges, constraints, etc.) and precomputed adjacency indices for efficient graph traversal.
Fields§
§protocol: StringThe protocol this schema belongs to.
vertices: HashMap<String, Vertex>Vertices keyed by their ID.
edges: HashMap<Edge, String>Edges keyed by the edge itself, value is the edge kind.
hyper_edges: HashMap<String, HyperEdge>Hyper-edges keyed by their ID.
constraints: HashMap<String, Vec<Constraint>>Constraints per vertex ID.
required: HashMap<String, Vec<Edge>>Required edges per vertex ID.
nsids: HashMap<String, String>NSID mapping: vertex ID to NSID string.
outgoing: HashMap<String, SmallVec<Edge, 4>>Outgoing edges per vertex ID.
incoming: HashMap<String, SmallVec<Edge, 4>>Incoming edges per vertex ID.
between: HashMap<(String, String), SmallVec<Edge, 2>>Edges between a specific (src, tgt) pair.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn outgoing_edges(&self, vertex_id: &str) -> &[Edge]
pub fn outgoing_edges(&self, vertex_id: &str) -> &[Edge]
Return all outgoing edges from the given vertex.
Sourcepub fn incoming_edges(&self, vertex_id: &str) -> &[Edge]
pub fn incoming_edges(&self, vertex_id: &str) -> &[Edge]
Return all incoming edges to the given vertex.
Sourcepub fn edges_between(&self, src: &str, tgt: &str) -> &[Edge]
pub fn edges_between(&self, src: &str, tgt: &str) -> &[Edge]
Return edges between a specific (src, tgt) pair.
Sourcepub fn has_vertex(&self, id: &str) -> bool
pub fn has_vertex(&self, id: &str) -> bool
Returns true if the given vertex ID exists in this schema.
Sourcepub fn vertex_count(&self) -> usize
pub fn vertex_count(&self) -> usize
Returns the number of vertices in the schema.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Returns the number of edges in the schema.