pub struct KnowledgeGraph {
pub triples: Vec<Triple>,
pub shapes: Vec<ShaclShape>,
}Fields§
§triples: Vec<Triple>§shapes: Vec<ShaclShape>Implementations§
Source§impl KnowledgeGraph
impl KnowledgeGraph
pub fn new() -> Self
pub fn from_graph(graph: &Graph) -> Result<Self, KgError>
pub fn to_turtle(&self) -> String
Sourcepub fn from_turtle(turtle: &str) -> Result<Self, KgError>
pub fn from_turtle(turtle: &str) -> Result<Self, KgError>
Parse a simple Turtle snippet into a KnowledgeGraph. This is a best-effort parser
expecting the exact triple format generated by to_turtle() in this crate.
Sourcepub fn to_graph(&self) -> Result<Graph, KgError>
pub fn to_graph(&self) -> Result<Graph, KgError>
Convert the knowledge graph back into a Graph by interpreting triples exported by to_turtle.
Known gap: this reconstructs Entity/Resource/Flow/Relation but
not the sea:EntityInstance or sea:Policy triples to_turtle
emits — round-tripping a graph that has instances or policies through
to_turtle/from_turtle/to_graph silently drops them rather than
erroring. Closing this requires reversing xsd_datatype dispatch per
declared field type and re-deriving a Policy’s Expression from
its normalized-text triple, which is real reconstruction work, not a
quick addition; tracked in .agents/next_steps.md. Do not rely on
this method for instance/policy round-tripping — use the Canonical
Semantic Envelope instead (.sea/interaction/README.md “Known
Toolchain Boundaries”).