pub struct VisualRDFGraph { /* private fields */ }Expand description
A visual representation of an RDF graph that can be converted to PlantUML diagrams.
This struct maintains mappings between RDF terms and visual nodes, tracks usage counts for different roles (subject, predicate, object), and manages the edges between nodes for visualization purposes.
Implementations§
Source§impl VisualRDFGraph
impl VisualRDFGraph
Sourcepub fn new(config: RDFVisualizationConfig) -> Self
pub fn new(config: RDFVisualizationConfig) -> Self
Sourcepub fn from_rdf<R: NeighsRDF>(
rdf: &R,
config: RDFVisualizationConfig,
) -> Result<Self, RDFError>
pub fn from_rdf<R: NeighsRDF>( rdf: &R, config: RDFVisualizationConfig, ) -> Result<Self, RDFError>
Creates a visual RDF graph from an RDF data source.
This method iterates through all triples in the RDF source and creates corresponding visual nodes and edges.
§Arguments
rdf- The RDF data source implementingNeighsRDFconfig- Configuration for visualization
§Returns
Result<Self, RDFError>- The constructed graph or an error
Sourcepub fn create_triple<R: NeighsRDF>(
&mut self,
rdf: &R,
subject: R::Subject,
predicate: R::IRI,
object: R::Term,
) -> Result<VisualRDFNode, RDFError>
pub fn create_triple<R: NeighsRDF>( &mut self, rdf: &R, subject: R::Subject, predicate: R::IRI, object: R::Term, ) -> Result<VisualRDFNode, RDFError>
Creates a visual representation of an RDF triple in the graph.
This method converts RDF subject, predicate, and object into visual nodes, creates edges between them, and updates usage counts.
§Arguments
rdf- The RDF data sourcesubject- The subject of the triplepredicate- The predicate of the tripleobject- The object of the triple
§Returns
Result<VisualRDFNode, RDFError>- The created triple node or an error
Sourcepub fn create_triple_term<R: NeighsRDF>(
&mut self,
rdf: &R,
subject: R::Subject,
predicate: R::IRI,
object: R::Term,
) -> Result<VisualRDFNode, RDFError>
pub fn create_triple_term<R: NeighsRDF>( &mut self, rdf: &R, subject: R::Subject, predicate: R::IRI, object: R::Term, ) -> Result<VisualRDFNode, RDFError>
Creates a visual representation of an RDF triple as a term (for RDF-star).
Similar to create_triple but handles triple terms differently,
without creating edges in the visual graph.
§Arguments
rdf- The RDF data sourcesubject- The subject of the triplepredicate- The predicate of the tripleobject- The object of the triple
§Returns
Result<VisualRDFNode, RDFError>- The created triple term node or an error
Sourcepub fn increment_usage_count_as_subject(&mut self, node: &VisualRDFNode)
pub fn increment_usage_count_as_subject(&mut self, node: &VisualRDFNode)
Increments the usage count for a node when used as a subject.
§Arguments
node- The node to increment the count for
Sourcepub fn increment_usage_count_as_subject_in_triple(
&mut self,
node: &VisualRDFNode,
)
pub fn increment_usage_count_as_subject_in_triple( &mut self, node: &VisualRDFNode, )
Increments the usage count for a node when used as a subject in a triple term.
§Arguments
node- The node to increment the count for
Sourcepub fn increment_usage_count_as_predicate(&mut self, node: &VisualRDFNode)
pub fn increment_usage_count_as_predicate(&mut self, node: &VisualRDFNode)
Increments the usage count for a node when used as a predicate.
§Arguments
node- The node to increment the count for
Sourcepub fn increment_usage_count_as_predicate_in_triple(
&mut self,
node: &VisualRDFNode,
)
pub fn increment_usage_count_as_predicate_in_triple( &mut self, node: &VisualRDFNode, )
Increments the usage count for a node when used as a predicate in a triple term.
§Arguments
node- The node to increment the count for
Sourcepub fn increment_usage_count_as_object(&mut self, node: &VisualRDFNode)
pub fn increment_usage_count_as_object(&mut self, node: &VisualRDFNode)
Increments the usage count for a node when used as an object.
§Arguments
node- The node to increment the count for
Sourcepub fn increment_usage_count_as_object_in_triple(
&mut self,
node: &VisualRDFNode,
)
pub fn increment_usage_count_as_object_in_triple( &mut self, node: &VisualRDFNode, )
Increments the usage count for a node when used as an object in a triple term.
§Arguments
node- The node to increment the count for
Sourcepub fn get_or_create_node(&mut self, node: VisualRDFNode) -> NodeId
pub fn get_or_create_node(&mut self, node: VisualRDFNode) -> NodeId
Sourcepub fn get_node_id(
&self,
node: &VisualRDFNode,
) -> Result<NodeId, RdfVisualizerError>
pub fn get_node_id( &self, node: &VisualRDFNode, ) -> Result<NodeId, RdfVisualizerError>
Sourcepub fn as_plantuml<W: Write>(
&self,
writer: &mut W,
_mode: &UmlGenerationMode,
) -> Result<(), RdfVisualizerError>
pub fn as_plantuml<W: Write>( &self, writer: &mut W, _mode: &UmlGenerationMode, ) -> Result<(), RdfVisualizerError>
Trait Implementations§
Source§impl Display for VisualRDFGraph
impl Display for VisualRDFGraph
Source§impl UmlConverter for VisualRDFGraph
impl UmlConverter for VisualRDFGraph
Source§fn as_plantuml<W: Write>(
&self,
writer: &mut W,
mode: &UmlGenerationMode,
) -> Result<(), UmlConverterError>
fn as_plantuml<W: Write>( &self, writer: &mut W, mode: &UmlGenerationMode, ) -> Result<(), UmlConverterError>
Converts the visual graph to PlantUML format.
This implementation delegates to the struct’s own as_plantuml method.
Source§fn as_image<W: Write, P: AsRef<Path>>(
&self,
writer: &mut W,
image_format: ImageFormat,
mode: &UmlGenerationMode,
plantuml_path: P,
) -> Result<(), UmlConverterError>
fn as_image<W: Write, P: AsRef<Path>>( &self, writer: &mut W, image_format: ImageFormat, mode: &UmlGenerationMode, plantuml_path: P, ) -> Result<(), UmlConverterError>
Source§fn save_uml_to_tempfile(
&self,
tempfile_path: &Path,
tempfile_name: &str,
mode: &UmlGenerationMode,
) -> Result<(), UmlConverterError>
fn save_uml_to_tempfile( &self, tempfile_path: &Path, tempfile_name: &str, mode: &UmlGenerationMode, ) -> Result<(), UmlConverterError>
Auto Trait Implementations§
impl Freeze for VisualRDFGraph
impl RefUnwindSafe for VisualRDFGraph
impl Send for VisualRDFGraph
impl Sync for VisualRDFGraph
impl Unpin for VisualRDFGraph
impl UnsafeUnpin for VisualRDFGraph
impl UnwindSafe for VisualRDFGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.