Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/_mgp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ inline bool vertex_has_label_named(mgp_vertex *v, const char *label_name) {

inline void vertex_add_label(mgp_vertex *vertex, mgp_label label) { MgInvokeVoid(mgp_vertex_add_label, vertex, label); }

inline void vertex_remove_label(mgp_vertex *vertex, mgp_label label) {
MgInvokeVoid(mgp_vertex_remove_label, vertex, label);
}

inline mgp_value *vertex_get_property(mgp_vertex *v, const char *property_name, mgp_memory *memory) {
return MgInvoke<mgp_value *>(mgp_vertex_get_property, v, property_name, memory);
}
Expand Down
11 changes: 11 additions & 0 deletions include/mgp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ class Node {

/// @brief Creates a Node from the copy of the given @ref mgp_vertex.
explicit Node(mgp_vertex *ptr);

/// @brief Creates a Node from the copy of the given @ref mgp_vertex.
explicit Node(const mgp_vertex *const_ptr);

Expand Down Expand Up @@ -641,15 +642,21 @@ class Node {

/// @brief Returns an iterable structure of the node’s inbound relationships.
Relationships InRelationships() const;

/// @brief Returns an iterable structure of the node’s outbound relationships.
Relationships OutRelationships() const;

/// @brief Adds a label to the node.
void AddLabel(const std::string_view label);

/// @brief Removes a label from the node.
void RemoveLabel(const std::string_view label);

bool operator<(const Node &other) const;

/// @exception std::runtime_error Node properties contain value(s) of unknown type.
bool operator==(const Node &other) const;

/// @exception std::runtime_error Node properties contain value(s) of unknown type.
bool operator!=(const Node &other) const;

Expand Down Expand Up @@ -2546,6 +2553,10 @@ inline void Node::AddLabel(const std::string_view label) {
mgp::vertex_add_label(this->ptr_, mgp_label{.name = label.data()});
}

inline void Node::RemoveLabel(const std::string_view label) {
mgp::vertex_remove_label(this->ptr_, mgp_label{.name = label.data()});
}

inline std::map<std::string, Value> Node::Properties() const {
mgp_properties_iterator *properties_iterator = mgp::vertex_iter_properties(ptr_, memory);
std::map<std::string, Value> property_map;
Expand Down