Wire KGNode → the domain node (kind/label/summary/source/metadata), the shape the local JSON serializes.
(node: &pb::KgNode)
| 145 | /// Wire KGNode → the domain node (kind/label/summary/source/metadata), |
| 146 | /// the shape the local JSON serializes. |
| 147 | fn kg_node_domain(node: &pb::KgNode) -> atomic_core::pristine::vault::KgNode { |
| 148 | atomic_core::pristine::vault::KgNode { |
| 149 | id: node.id.clone(), |
| 150 | types: node.types.clone(), |
| 151 | label: node.name.clone().unwrap_or_default(), |
| 152 | summary: node |
| 153 | .data |
| 154 | .as_ref() |
| 155 | .map(|data| String::from_utf8_lossy(data).into_owned()), |
| 156 | source: node.source.clone().unwrap_or_default(), |
| 157 | metadata: node |
| 158 | .metadata |
| 159 | .as_ref() |
| 160 | .and_then(|metadata| serde_json::from_slice(metadata).ok()), |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | /// Wire KGEdge → the domain edge. |
| 165 | fn kg_edge_domain(edge: &pb::KgEdge) -> CliResult<atomic_core::pristine::vault::KgEdge> { |