Apache GraphAr C++ Library
The C++ Library for Apache GraphAr
Public Member Functions | Static Public Member Functions | List of all members
graphar::builder::EdgesBuilder Class Reference

EdgeBuilder is designed for building and writing a collection of edges. More...

#include <edges_builder.h>

Public Member Functions

 EdgesBuilder (const std::shared_ptr< EdgeInfo > &edge_info, const std::string &prefix, AdjListType adj_list_type, IdType num_vertices, const ValidateLevel &validate_level=ValidateLevel::no_validate)
 Initialize the EdgesBuilder. More...
 
void SetValidateLevel (const ValidateLevel &validate_level)
 Set the validate level. More...
 
ValidateLevel GetValidateLevel () const
 Get the validate level. More...
 
void Clear ()
 Clear the edges in this EdgesBuilder.
 
Status AddEdge (const Edge &e, const ValidateLevel &validate_level=ValidateLevel::default_validate)
 Add an edge to the collection. More...
 
IdType GetNum () const
 Get the current number of edges in the collection. More...
 
Status Dump ()
 Dump the collection into files. More...
 

Static Public Member Functions

static Result< std::shared_ptr< EdgesBuilder > > Make (const std::shared_ptr< EdgeInfo > &edge_info, const std::string &prefix, AdjListType adj_list_type, IdType num_vertices, const ValidateLevel &validate_level=ValidateLevel::no_validate)
 Construct an EdgesBuilder from edge info. More...
 
static Result< std::shared_ptr< EdgesBuilder > > Make (const std::shared_ptr< GraphInfo > &graph_info, const std::string &src_label, const std::string &edge_label, const std::string &dst_label, const AdjListType &adj_list_type, IdType num_vertices, const ValidateLevel &validate_level=ValidateLevel::no_validate)
 Construct an EdgesBuilder from graph info. More...
 

Detailed Description

EdgeBuilder is designed for building and writing a collection of edges.

Definition at line 152 of file edges_builder.h.

Constructor & Destructor Documentation

◆ EdgesBuilder()

graphar::builder::EdgesBuilder::EdgesBuilder ( const std::shared_ptr< EdgeInfo > &  edge_info,
const std::string &  prefix,
AdjListType  adj_list_type,
IdType  num_vertices,
const ValidateLevel &  validate_level = ValidateLevel::no_validate 
)
inlineexplicit

Initialize the EdgesBuilder.

Parameters
edge_infoThe edge info that describes the vertex type.
prefixThe absolute prefix.
adj_list_typeThe adj list type of the edges.
num_verticesThe total number of vertices for source or destination.
validate_levelThe global validate level for the writer, with no validate by default. It could be ValidateLevel::no_validate, ValidateLevel::weak_validate or ValidateLevel::strong_validate, but could not be ValidateLevel::default_validate.

Definition at line 166 of file edges_builder.h.

Member Function Documentation

◆ AddEdge()

Status graphar::builder::EdgesBuilder::AddEdge ( const Edge e,
const ValidateLevel &  validate_level = ValidateLevel::default_validate 
)
inline

Add an edge to the collection.

The validate_level for this operation could be:

ValidateLevel::default_validate: to use the validate_level of the builder, which set through the constructor or the SetValidateLevel method;

ValidateLevel::no_validate: without validation;

ValidateLevel::weak_validate: to validate if the adj_list type is valid, and the data in builder is not saved;

ValidateLevel::strong_validate: besides weak_validate, also validate the schema of the edge is consistent with the info defined.

Parameters
eThe edge to add.
validate_levelThe validate level for this operation, which is the builder's validate level by default.
Returns
Status: ok or Status::Invalid error.

Definition at line 250 of file edges_builder.h.

◆ Dump()

Status graphar::builder::EdgesBuilder::Dump ( )

Dump the collection into files.

Returns
Status: ok or error.

Definition at line 29 of file edges_builder.cc.

◆ GetNum()

IdType graphar::builder::EdgesBuilder::GetNum ( ) const
inline

Get the current number of edges in the collection.

Returns
The current number of edges in the collection.

Definition at line 266 of file edges_builder.h.

◆ GetValidateLevel()

ValidateLevel graphar::builder::EdgesBuilder::GetValidateLevel ( ) const
inline

Get the validate level.

Returns
The validate level of this writer.

Definition at line 218 of file edges_builder.h.

◆ Make() [1/2]

static Result<std::shared_ptr<EdgesBuilder> > graphar::builder::EdgesBuilder::Make ( const std::shared_ptr< EdgeInfo > &  edge_info,
const std::string &  prefix,
AdjListType  adj_list_type,
IdType  num_vertices,
const ValidateLevel &  validate_level = ValidateLevel::no_validate 
)
inlinestatic

Construct an EdgesBuilder from edge info.

Parameters
edge_infoThe edge info that describes the edge type.
prefixThe absolute prefix.
adj_list_typeThe adj list type of the edges.
num_verticesThe total number of vertices for source or destination.
validate_levelThe global validate level for the builder, default is no_validate.

Definition at line 285 of file edges_builder.h.

◆ Make() [2/2]

static Result<std::shared_ptr<EdgesBuilder> > graphar::builder::EdgesBuilder::Make ( const std::shared_ptr< GraphInfo > &  graph_info,
const std::string &  src_label,
const std::string &  edge_label,
const std::string &  dst_label,
const AdjListType &  adj_list_type,
IdType  num_vertices,
const ValidateLevel &  validate_level = ValidateLevel::no_validate 
)
inlinestatic

Construct an EdgesBuilder from graph info.

Parameters
graph_infoThe graph info that describes the graph.
src_labelThe label of the source vertex type.
edge_labelThe label of the edge type.
dst_labelThe label of the destination vertex type.
adj_list_typeThe adj list type of the edges.
num_verticesThe total number of vertices for source or destination.
validate_levelThe global validate level for the builder, default is no_validate.

Definition at line 310 of file edges_builder.h.

◆ SetValidateLevel()

void graphar::builder::EdgesBuilder::SetValidateLevel ( const ValidateLevel &  validate_level)
inline

Set the validate level.

Parameters
validate_levelThe validate level to set.

Definition at line 206 of file edges_builder.h.


The documentation for this class was generated from the following files: