import type { OntologyEdge, OntologyGraph, OntologyNode } from "./graphModel"; export interface CompactTriplesResult { nodes: OntologyNode[]; edges: OntologyEdge[]; /** * Statements absorbed into a node because their object was folded away, * keyed by node id — e.g. `":createdAt" -> ["range: dateTime"]`. Rendered on * the node so nothing the document states disappears from view. */ foldedFacts: Map; removedNodeCount: number; removedEdgeCount: number; } /** * Folds leaf annotation nodes out of the triples graph so the remaining boxes * are the things the ontology is actually about. * * Measured on a 1182-triple schema-heavy ontology, the raw triples view drew * 741 nodes and 1182 edges. Two thirds of those boxes carried no structure: * * - **485 literal nodes (65% of all boxes).** Every `rdfs:label` and * `rdfs:comment` became its own box even though `buildGraphModel` already * copies those values onto the subject's `label`/`comment` fields — the * same fact drawn twice. * - **A handful of enormous vocabulary hubs.** `owl:ObjectProperty` reached * degree 105, `owl:DatatypeProperty` 95, `xsd:string` 56, `owl:Class` 49. * No force-directed layout can arrange a 105-way hub, and none of them says * anything as a node. * * Folding both takes that document to 246 nodes (-67%) and 349 edges (-70%). * * A node is folded when all three hold, which keeps the rule principled rather * than a hardcoded blocklist: * 1. it has no outgoing edges — it is purely something other nodes point at, * 2. it has at least one incoming edge, and * 3. it is a literal, or its IRI is in a standard vocabulary namespace * (rdf, rdfs, owl, xsd, skos, dcterms, foaf). * * Condition 1 is what protects real structure: a document that states * `xsd:string rdfs:comment "..."` has described that term, so it keeps its box. * * `rdfs:label` and `rdfs:comment` are folded *without* a fact line, because the * node already displays them — restating them would reintroduce the very * duplication being removed. Every other folded statement becomes a fact line. * * Note what this deliberately does **not** do: hide property nodes. On a * schema-heavy ontology the property node is the hinge connecting one class to * another (`Class <-domain- property -range-> Class`), so hiding those shatters * the graph. The transformation that removes properties *and* keeps the graph * connected is what the schema view already does, by rewiring domain/range * into a direct class-to-class edge. * * Pure, and never mutates its input: the `OntologyGraph` stays a faithful * representation of the parsed triples, and this compaction is a presentation * choice the viewer can turn off. */ export declare function compactTriples(graph: OntologyGraph): CompactTriplesResult; //# sourceMappingURL=compactTriples.d.ts.map