1use serde::{Deserialize, Serialize};
4use std::collections::HashMap;
5use crate::types::*;
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct Guard {
10 pub ref_: String, pub args: HashMap<String, Value>,
12}
13
14#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct GraphElement {
17 pub id: String, #[serde(skip_serializing_if = "Option::is_none")]
19 pub type_: Option<Label>,
20 #[serde(skip_serializing_if = "Option::is_none")]
21 pub props: Option<Properties>,
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
26pub struct EdgeDef {
27 pub id: String,
28 pub src: String,
29 pub dst: String,
30 #[serde(skip_serializing_if = "Option::is_none")]
31 pub type_: Option<Label>,
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36pub struct GraphPattern {
37 pub nodes: Vec<GraphElement>,
38 pub edges: Vec<EdgeDef>,
39}
40
41#[derive(Debug, Clone, Serialize, Deserialize)]
43pub struct RuleNac {
44 pub nodes: Vec<GraphElement>,
45 pub edges: Vec<EdgeDef>,
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50pub struct RuleIR {
51 pub name: String,
52 pub types: HashMap<String, Vec<Label>>, pub lhs: GraphPattern, pub context: GraphPattern, pub rhs: GraphPattern, pub nacs: Vec<RuleNac>, pub guards: Vec<Guard>, }
59
60#[derive(Debug, Clone)]
62pub struct Match {
63 pub mapping: HashMap<String, VertexId>, pub score: f64, }
66
67pub type Matches = Vec<Match>;