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

VertexInfo is a class to describe the vertex information, including the vertex label, chunk size, property groups, and prefix. More...

#include <graph_info.h>

Classes

class  Impl
 

Public Member Functions

 VertexInfo (const std::string &label, IdType chunk_size, const PropertyGroupVector &property_groups, const std::string &prefix="", std::shared_ptr< const InfoVersion > version=nullptr)
 
Result< std::shared_ptr< VertexInfo > > AddPropertyGroup (std::shared_ptr< PropertyGroup > property_group) const
 
const std::string & GetLabel () const
 
IdType GetChunkSize () const
 
const std::string & GetPrefix () const
 
const std::shared_ptr< const InfoVersion > & version () const
 
int PropertyGroupNum () const
 
const PropertyGroupVector & GetPropertyGroups () const
 
std::shared_ptr< PropertyGroupGetPropertyGroup (const std::string &property_name) const
 
std::shared_ptr< PropertyGroupGetPropertyGroupByIndex (int index) const
 
Result< std::shared_ptr< DataType > > GetPropertyType (const std::string &property_name) const
 
bool HasProperty (const std::string &property_name) const
 
Status Save (const std::string &file_name) const
 
Result< std::string > Dump () const noexcept
 
bool IsPrimaryKey (const std::string &property_name) const
 
bool IsNullableKey (const std::string &property_name) const
 
bool HasPropertyGroup (const std::shared_ptr< PropertyGroup > &property_group) const
 
Result< std::string > GetFilePath (std::shared_ptr< PropertyGroup > property_group, IdType chunk_index) const
 
Result< std::string > GetPathPrefix (std::shared_ptr< PropertyGroup > property_group) const
 
Result< std::string > GetVerticesNumFilePath () const
 
bool IsValidated () const
 

Static Public Member Functions

static Result< std::shared_ptr< VertexInfo > > Load (std::shared_ptr< Yaml > yaml)
 
static Result< std::shared_ptr< VertexInfo > > Load (const std::string &input)
 

Detailed Description

VertexInfo is a class to describe the vertex information, including the vertex label, chunk size, property groups, and prefix.

Definition at line 174 of file graph_info.h.

Constructor & Destructor Documentation

◆ VertexInfo()

graphar::VertexInfo::VertexInfo ( const std::string &  label,
IdType  chunk_size,
const PropertyGroupVector &  property_groups,
const std::string &  prefix = "",
std::shared_ptr< const InfoVersion version = nullptr 
)
explicit

Construct a VertexInfo object with the given information and property group.

Parameters
labelThe label of the vertex.
chunk_sizeThe number of vertices in each vertex chunk.
property_groupsThe property group vector of the vertex.
prefixThe prefix of the vertex info. If left empty, the default prefix will be set to the label of the vertex.
versionThe format version of the vertex info.

Definition at line 253 of file graph_info.cc.

Member Function Documentation

◆ AddPropertyGroup()

Result< std::shared_ptr< VertexInfo > > graphar::VertexInfo::AddPropertyGroup ( std::shared_ptr< PropertyGroup property_group) const

Adds a property group to the vertex info and returns a new VertexInfo

Parameters
property_groupThe PropertyGroup object to add.

Definition at line 357 of file graph_info.cc.

◆ Dump()

Result< std::string > graphar::VertexInfo::Dump ( ) const
noexcept

Returns the vertex info as a YAML formatted string.

Returns
A Result object containing the YAML string, or a Status object indicating an error.

Definition at line 442 of file graph_info.cc.

◆ GetChunkSize()

IdType graphar::VertexInfo::GetChunkSize ( ) const

Get the chunk size of the vertex.

Returns
The chunk size of the vertex.

Definition at line 263 of file graph_info.cc.

◆ GetFilePath()

Result< std::string > graphar::VertexInfo::GetFilePath ( std::shared_ptr< PropertyGroup property_group,
IdType  chunk_index 
) const

Get the file path for the specified property group and chunk index.

Parameters
property_groupThe PropertyGroup object to get the file path for.
chunk_indexThe chunk index.
Returns
A Result object containing the file path, or a KeyError Status object if the property group is not found in the vertex info.

Definition at line 271 of file graph_info.cc.

◆ GetLabel()

const std::string & graphar::VertexInfo::GetLabel ( ) const

Get the label of the vertex.

Returns
The label of the vertex.

Definition at line 261 of file graph_info.cc.

◆ GetPathPrefix()

Result< std::string > graphar::VertexInfo::GetPathPrefix ( std::shared_ptr< PropertyGroup property_group) const

Get the path prefix for the specified property group.

Parameters
property_groupThe PropertyGroup object to get the path prefix for.
Returns
A Result object containing the path prefix, or a KeyError Status object if the property group is not found in the vertex info.

Definition at line 280 of file graph_info.cc.

◆ GetPrefix()

const std::string & graphar::VertexInfo::GetPrefix ( ) const

Get the path prefix of the vertex.

Returns
The path prefix of the vertex.

Definition at line 265 of file graph_info.cc.

◆ GetPropertyGroup()

std::shared_ptr< PropertyGroup > graphar::VertexInfo::GetPropertyGroup ( const std::string &  property_name) const

Get the property group that contains the specified property.

Parameters
property_nameThe name of the property.
Returns
property group may be nullptr if the property is not found.

Definition at line 296 of file graph_info.cc.

◆ GetPropertyGroupByIndex()

std::shared_ptr< PropertyGroup > graphar::VertexInfo::GetPropertyGroupByIndex ( int  index) const

Get the property group at the specified index.

Parameters
indexThe index of the property group.
Returns
property group may be nullptr if the index is out of range.

Definition at line 302 of file graph_info.cc.

◆ GetPropertyGroups()

const PropertyGroupVector & graphar::VertexInfo::GetPropertyGroups ( ) const

Get the property groups of the vertex.

Definition at line 310 of file graph_info.cc.

◆ GetPropertyType()

Result< std::shared_ptr< DataType > > graphar::VertexInfo::GetPropertyType ( const std::string &  property_name) const

Get the data type of the specified property.

Parameters
property_nameThe name of the property.
Returns
A Result object containing the data type of the property, or a KeyError Status object if the property is not found.

Definition at line 348 of file graph_info.cc.

◆ GetVerticesNumFilePath()

Result< std::string > graphar::VertexInfo::GetVerticesNumFilePath ( ) const

Get the file path for the number of vertices.

Returns
The file path for the number of vertices.

Definition at line 288 of file graph_info.cc.

◆ HasProperty()

bool graphar::VertexInfo::HasProperty ( const std::string &  property_name) const

Get whether the vertex info contains the specified property.

Parameters
property_nameThe name of the property.
Returns
True if the property exists in the vertex info, False otherwise.

Definition at line 330 of file graph_info.cc.

◆ HasPropertyGroup()

bool graphar::VertexInfo::HasPropertyGroup ( const std::shared_ptr< PropertyGroup > &  property_group) const

Returns whether the vertex info contains the specified property group.

Parameters
property_groupThe PropertyGroup object to check for.
Returns
True if the property group exists in the vertex info, False otherwise.

Definition at line 335 of file graph_info.cc.

◆ IsNullableKey()

bool graphar::VertexInfo::IsNullableKey ( const std::string &  property_name) const

Returns whether the specified property is a nullable key.

Parameters
property_nameThe name of the property.
Returns
True if the property is a nullable key, False otherwise.

Definition at line 322 of file graph_info.cc.

◆ IsPrimaryKey()

bool graphar::VertexInfo::IsPrimaryKey ( const std::string &  property_name) const

Returns whether the specified property is a primary key.

Parameters
property_nameThe name of the property.
Returns
True if the property is a primary key, False otherwise.

Definition at line 314 of file graph_info.cc.

◆ IsValidated()

bool graphar::VertexInfo::IsValidated ( ) const

Returns whether the vertex info is validated.

Returns
True if the vertex info is valid, False otherwise.

Definition at line 374 of file graph_info.cc.

◆ Load() [1/2]

Result< std::shared_ptr< VertexInfo > > graphar::VertexInfo::Load ( const std::string &  input)
static

Loads vertex info from a YAML string.

Parameters
inputThe YAML content string.
Returns
A Result object containing the VertexInfo object, or a Status.

Definition at line 437 of file graph_info.cc.

◆ Load() [2/2]

Result< std::shared_ptr< VertexInfo > > graphar::VertexInfo::Load ( std::shared_ptr< Yaml yaml)
static

Loads vertex info from a YAML object.

Parameters
yamlA shared pointer to a Yaml object containing the YAML string.
Returns
A Result object containing the VertexInfo object, or a Status object indicating an error.

Definition at line 387 of file graph_info.cc.

◆ PropertyGroupNum()

int graphar::VertexInfo::PropertyGroupNum ( ) const

Get the number of property groups of the vertex.

Returns
The number of property groups of the vertex.

Definition at line 292 of file graph_info.cc.

◆ Save()

Status graphar::VertexInfo::Save ( const std::string &  file_name) const

Saves the vertex info to a YAML file.

Parameters
file_nameThe name of the file to save to.
Returns
A Status object indicating success or failure.

Definition at line 480 of file graph_info.cc.

◆ version()

const std::shared_ptr< const InfoVersion > & graphar::VertexInfo::version ( ) const

Get the version info of the vertex.

Returns
The version info of the vertex.

Definition at line 267 of file graph_info.cc.


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