IBM SYSTEMG G RUNTIME & NATIVE STORE
0.5
IBM Native Graph Computing and Storage System based on IBM Parallel Programming Library
|
IBM Multi property graph class to store multiple properties. More...
#include <ibm_multiproperty_graph.hpp>
Public Types | |
typedef base_type::edged_type | edged_type |
Edge descriptor or unique edge identifier. | |
typedef base_type::vertex_type | vertex_type |
The vertex class; storage for property and edges. | |
typedef base_type::edge_type | edge_type |
typedef base_type::vertexd_type | vertexd_type |
Vertex descriptor. Unique vertex identifier. | |
typedef base_type::vertex_property | vertex_property |
Property type associated with each vertex. | |
typedef base_type::edge_property | edge_property |
Property type associated with each edge. | |
typedef base_type::edge_iterator | base_edge_iterator |
Iterator type for traversing vertices. | |
typedef base_type::vertex_iterator | base_vertex_iterator |
typedef base_type::pred_iterator | base_pred_iterator |
typedef imp_vertex_iterator < vertex_type, base_vertex_iterator, this_type, vertexd_type > | vertex_iterator |
typedef imp_edge_iterator < edge_type, base_edge_iterator, this_type, edged_type > | edge_iterator |
typedef imp_pred_iterator < edge_type, base_pred_iterator, this_type > | pred_iterator |
typedef omnidirectional_edge_iterator_t < edge_iterator, vertex_iterator, this_type > | omni_iterator |
typedef base_type::const_vertex_iterator | const_vertex_iterator |
Const Iterator type for traversing edges. You won't be able to modify properties when using this iterator. | |
typedef std::string | property_name_type |
typedef std::string | property_value_type |
typedef std::string | label_string_type |
typedef std::string | vclass_string_type |
typedef mp_subproperty_iterator_t < vertex_iterator, edge_iterator > | property_iterator |
![]() | |
typedef base_type::edged_type | edged_type |
Edge descriptor or unique edge identifier. | |
typedef base_type::vertexd_type | vertexd_type |
Vertex descriptor. Unique vertex identifier. | |
typedef base_type::vertex_property | vertex_property |
Property type associated with each vertex. | |
typedef base_type::edge_property | edge_property |
Property type associated with each edge. | |
typedef base_type::vertex_iterator | vertex_iterator |
Iterator type for traversing vertices. | |
typedef base_type::const_vertex_iterator | const_vertex_iterator |
typedef base_type::edge_iterator | edge_iterator |
edge iterator | |
Public Member Functions | |
ibm_multiproperty_graph_generic (string filename, string path, UINT64 max_memsize=(UINT64)(4294967295), size_t el_blk_sz=DEFAULT_BUNDLE_SZ, size_t vp_blk_sz=DEFAULT_BUNDLE_SZ, size_t ep_blk_sz=DEFAULT_BUNDLE_SZ) | |
IBM Multiporperty graph constructor. More... | |
virtual | ~ibm_multiproperty_graph_generic () |
IBM Multiprpoerty graph destructor. More... | |
bool | vert_index_available (size_t propid) const |
This method indicates if the named index exists. Currently the index name is the name of the vertex property that would be indexed. At the moment this class does not support edge properties. More... | |
bool | vert_index_available_we (size_t propid) const |
This method is like vert_index_available() but it will throw an out_of_range exception if the propid is beyond the highest index we're supporting. This will help the calling code to enumerate indices. More... | |
int | index_find (int propid, const property_value_type &pval, vertexd_type &vid) |
This method allows the caller to find the vid of a vertex that has the given value on the given property. More... | |
int | index_find_all (int propid, const property_value_type &pval, std::vector< vertexd_type > &vids) |
This method allows the caller to find all the vertices that have the given value on the given property. Warning: it will crash if there is no index. Check for that using the "available" method. More... | |
int | find_all (int propid, const property_value_type &pval, std::vector< vertexd_type > &vids) |
This method allows the caller to find all the vertices that have the given value on the given property. This version will not die if the index doesn't exist. Instead it will slowly generate the response after printing a warning message. More... | |
void | _index_insert (int propid, const property_value_type &pval, vertexd_type vid) |
This is a method that most people should not use. It's used internally to keep the index up to date. More... | |
void | index_erasexx (int propid, const property_value_type &pval) |
This is a method that most people should not use. It's used internally to keep the index up to date. More... | |
void | index_erase (int propid, const property_value_type &pval, vertexd_type vid) |
This is a method that most people should not use. It's used internally to keep the index up to date. More... | |
void | index_erase (int propid, char const *pval, int pvallen, vertexd_type vid) |
void | add_index (const property_name_type &pname, bool is_multi=false) |
This method creates an index on the specified property and property value. More... | |
void | set_esubproperty (edged_type eid, const property_name_type &pname, const property_value_type &value) |
This method adds a property to an edge. More... | |
void | set_esubproperty (edged_type eid, const size_t propid, const property_value_type &value) |
This method adds a property to an edge. More... | |
void | set_vsubproperty (vertexd_type vid, const property_name_type &pname, const property_value_type &value) |
Sets the specified property for the specified vertex to the specified string value. More... | |
void | set_vsubproperty (vertexd_type vid, const size_t propid, const property_value_type &value) |
Sets the specified property for the specified vertex to the specified string value. More... | |
property_value_type | get_vsubproperty (vertexd_type vid, const property_name_type &pname) |
Returns the specified property for the specified vertex. More... | |
property_value_type | get_vsubproperty (vertexd_type vid, size_t propid) |
size_t | get_or_allocate_epropertyid (const property_name_type &pname) |
Maps a specified edge property-name to it's property-id. More... | |
size_t | get_or_allocate_vpropertyid (const property_name_type &pname) |
Maps a specified vertex property-name to it's property-id. More... | |
size_t | get_or_allocate_labelid (const label_string_type &labelstr) |
Maps a specified label name to it's label-id. More... | |
size_t | get_or_allocate_vclassid (const vclass_string_type &vclassname) |
bool | get_labelid (const label_string_type &labelstr, size_t &retval) |
Maps a specified label name to it's label-id. More... | |
bool | get_vclassid (const vclass_string_type &vclassname, size_t &retval) |
size_t | get_epropertyid (const property_name_type &pname) |
Maps a specified edge property-name to it's property-id. More... | |
string | get_edge_property_name (const size_t propid) const |
Maps a specified edge property-id to it's property name. More... | |
int | get_edge_property_count () const |
get the number or propertynames found edge in the graph. The caller can follow this up by calling get_property_name() from 0 .. ((returned value-1)) Values 0, 1... are reserved pseudo-properties, so the caller might chose to skip these and start with the CSVP_PROPERTIES_FIRST_NON_PSEUDO_PROPERTY property. More... | |
size_t | get_vpropertyid (const property_name_type &pname) |
Maps a specified vertex property-name to it's property-id. More... | |
string | get_vertex_property_name (const size_t propid) const |
Maps a specified vertex property-id to it's property value. More... | |
int | get_vertex_property_count () const |
get the number or propertynames found vertices in the graph. The caller can follow this up by calling get_property_name() from 0 .. ((returned value-1)) Values 0, 1... are reserved pseudo-properties, so the caller might chose to skip these and start with the CSVP_PROPERTIES_FIRST_NON_PSEUDO_PROPERTY property. More... | |
size_t | get_labelid (const label_string_type &labelstr) |
Maps a specified label string to it's label-id. More... | |
size_t | get_vclassid (const vclass_string_type &vclassname) |
string | get_label_string (const size_t labelid) const |
Maps a specified label-id it's label string. More... | |
string | get_vclassname (size_t vclassid) |
string | deprecated_get_vclassname_as_stdstring (size_t vclassid) |
char const * | get_external_id_as_cstr (size_t vid) |
string | deprecated_get_external_id_as_stdstring (size_t vid) |
vertex_iterator | find_vertex (vertexd_type vid) |
Finds the first vertex with a given vertex id. More... | |
edge_iterator | find_edge (vertexd_type vid, edged_type eid) |
Finds the first edge for a given vertex with a given edge id. More... | |
vertex_iterator | find_vertex (const property_name_type &pname, const property_value_type &pval) |
Finds the first vertex with a given property value. More... | |
vertex_iterator | vertices_begin () |
vertex_iterator | vertices_end () |
void | delete_vertex (vertexd_type vid) |
Deletes specified vertex and adjacent edges. More... | |
void | delete_vertex (char const *exid, int exidlen) |
vertexd_type | add_vertex (vertex_property &vp) |
Add a vertex to the graph. More... | |
vertexd_type | add_vertex (size_t vclassid) |
Add a vertex to the graph. More... | |
vertexd_type | add_vertex (size_t vclassid, char const *exid, int exidlen) |
add a vertex More... | |
vertexd_type | add_vertexxxx (property_value_type &value) |
Add a vertex to the graph. More... | |
edged_type | add_edge (vertexd_type vsource, vertexd_type vtarget, edge_property ep) |
Add an edge to the graph. More... | |
edged_type | add_edge (vertexd_type vsource, vertexd_type vtarget, size_t lid) |
edged_type | add_edge (vertexd_type vsource, vertexd_type vtarget, std::string label) |
edge_iterator | add_edge_ref (vertexd_type vsource, vertexd_type vtarget, size_t lid) |
Add an edge to the graph. More... | |
edge_iterator | add_edge_ref (vertexd_type vsource, vertexd_type vtarget, std::string label) |
Add an edge to the graph. More... | |
![]() | |
rdfGraph (const graph_config &gc=graph_config()) | |
vertex_iterator | vertices_begin () |
const_vertex_iterator | vertices_begin () const |
vertex_iterator | vertices_begin (size_t lid) |
vertex_iterator | vertices_end () |
const_vertex_iterator | vertices_end () const |
vertex_iterator | vertices_end (size_t lid) |
edged_type | add_edge (vertexd_type s, vertexd_type t, const edge_property &ep) |
edge_iterator | add_edge_ref (vertexd_type s, vertexd_type t, const edge_property &ep) |
Protected Types | |
typedef index< size_t > | index_type |
typedef std::vector < index_type * >::iterator | index_iterator |
Protected Member Functions | |
void | _load_keys (std::string fn, std::map< std::string, vertexd_type > *vvec, std::vector< std::string > *revmap=0) |
Utility routine for reloading mappings between property-id's and property-name's. More... | |
void | _load_keys () |
Utility routine for reloading mappings between property-id's and property-name's. More... | |
void | _save_keys (std::string fn, std::map< std::string, vertexd_type > *vvec) |
Utility routine for persisting mappings between property-id's and property-name's. More... | |
void | _save_keys () |
Utility routine for persisting mappings between property-id's and property-name's. More... | |
size_t | _get_or_alloc_map (std::map< std::string, vertexd_type > *mapin, std::vector< std::string > *vecin, std::string keystring) |
Helper routine for get_or_allocXXXX() methods. More... | |
size_t | _get_mapping (std::map< std::string, vertexd_type > *mapin, std::string keystring) |
Helper routine to help implement get_Xpropertyid() methods. More... | |
Protected Attributes | |
std::map< std::string, size_t > | vpropname_to_id |
Maps a property name to a property id. | |
std::vector< std::string > | id_to_vpropname |
Maps a property id to a property name(string) | |
std::map< std::string, size_t > | epropname_to_id |
Similar as above for edges. | |
std::vector< std::string > | id_to_epropname |
std::vector< std::string > | id_to_label |
Maps a label id to a label string. | |
std::map< std::string, size_t > | label_to_id |
Maps a label string to a label id. | |
std::vector< std::string > | vclassid_to_vclassname |
Maps a label id to a label string. | |
std::map< std::string, size_t > | vclassname_to_vclassid |
Maps a label string to a label id. | |
std::string | store_name |
std::vector< index_type * > | vert_indices |
edge_iterator | eitCached |
edged_type | eitCachedEid |
Private Types | |
typedef rdfGraph < tabular_multiproperty_type, tabular_multiproperty_type, ST > | base_type |
Base class type. | |
typedef ibm_multiproperty_graph_generic < ST > | this_type |
Self type. | |
IBM Multi property graph class to store multiple properties.
IBM Multi property graph class; It maintains an associative table (hash table) for individual properties; All properties are stored as strings : <property_name:int, property_value:string> A secondary table maps from property_name as string to property name as integer
|
inline |
IBM Multiporperty graph constructor.
filename | the base filename in the directory specified in the path parameter. If they don't exist, this method will create a variety of files that start with this filename. Together they'll represent a graph. Initially it will be an empty graph. |
path | the path of the file name |
max_memsize | The maxmium number of bytes of RAM to use to service the graph requests. Far more space might be used on disk. |
This method returns a vector of index names. Right now the index names are the name of the property indexed. And at the moment only vertex properties are indexable.
|
inlinevirtual |
IBM Multiprpoerty graph destructor.
It is important that this method be called. It will do things like save meta-data on the graph and deallocate some underlying structures.
|
inlineprotected |
Helper routine to help implement get_Xpropertyid() methods.
|
inlineprotected |
Helper routine for get_or_allocXXXX() methods.
|
inline |
This is a method that most people should not use. It's used internally to keep the index up to date.
propid | The index property-id that needs to be updated. |
pval | The property value to be inserted to the index. |
vid | The vertex represented by that property in the index. |
|
inlineprotected |
Utility routine for reloading mappings between property-id's and property-name's.
|
inlineprotected |
Utility routine for reloading mappings between property-id's and property-name's.
|
inlineprotected |
Utility routine for persisting mappings between property-id's and property-name's.
|
inlineprotected |
Utility routine for persisting mappings between property-id's and property-name's.
|
inline |
Add an edge to the graph.
Note: please only use this method if you need to understand the underlying property implementation. Otherwise, please use the method of the same name that does not have a property parameter.
vsource | The source vertex of the edge. |
vtarget | The target vertex of the edge. |
ep | The property assoicated with the new edge. |
|
inline |
Add an edge to the graph.
vsource | The source vertex of the edge. |
vtarget | The target vertex of the edge. |
lid | The label associated with the new edge. |
|
inline |
Add an edge to the graph.
vsource | The source vertex of the edge. |
vtarget | The target vertex of the edge. |
lable | The label string associated with the new edge. |
|
inline |
Add an edge to the graph.
vsource | The source vertex of the edge. |
vtarget | The target vertex of the edge. |
lid | The label identifier associated with the new edge. |
|
inline |
Add an edge to the graph.
vsource | The source vertex of the edge. |
vtarget | The target vertex of the edge. |
label | The label string associated with the new edge. |
|
inline |
This method creates an index on the specified property and property value.
The caller should specify if it's possible that several vertices will have the same property value. It is safe to always specify that this is the case, but the code might be slightly slower than it needs to be. If the caller specifies that it's not the case, but then the graph does end up having more than one vertex with a given property value, the implementation will not notice this, but the index will not behave quite the way expected.
If the index already exists, this method does nothing. If it exists, but the is_multi is different than the existing index's is_multi value, still nothing is done.
pname | the vertex property that should be indexed |
is_multi | true if a given value might appear on the property of several vertices. |
|
inline |
Add a vertex to the graph.
Note: please only use this method if you need to understand the underlying property implementation. Otherwise, please use the parameter-less method of the same name.
Note: this class probably doesn't index the values provided. If that is needed, please test to confirm that another method should be used or the caller should arrange indexing.
vp | The vertex property of the new vertex begin added. |
|
inline |
Add a vertex to the graph.
|
inline |
add a vertex
This method does assume a vertex with that exid is not yet in the graph. If the caller is uncertain, it should check.
|
inline |
Add a vertex to the graph.
Adds a vertex to the graph with a specified property value The property value is associated with the external id.
Design: if you're using this method, check out if one of the other methods is faster. External id's are stored as lstrings, so converting to std::strings to call this method might be a waste of cycles. If you do need this method, please correct the name to be more reasonable.
|
inline |
Deletes specified vertex and adjacent edges.
vid | The vertex to be deleted. |
|
inline |
This method allows the caller to find all the vertices that have the given value on the given property. This version will not die if the index doesn't exist. Instead it will slowly generate the response after printing a warning message.
propid | the property of interest |
pval | the property value that must match |
vids | a reference to a vector of vids that will be updated with the vids of matching vertices. |
|
inline |
Finds the first edge for a given vertex with a given edge id.
This routine returns an iterator for a edge with the given property id. This method should be fairly fast, but not as fast as already having an iterator.
vid | The vertex for which the edges are considered. |
eid | The edge id being searched. |
|
inline |
Finds the first vertex with a given vertex id.
This routine returns an iterator for a vertex with the given property id. This method should be fairly fast, but not as fast as already having an iterator.
vid | The vertex id being searched. |
|
inline |
Finds the first vertex with a given property value.
This routine returns an iterator for a vertex with the given property value. If you really want multiple vertices with the same value, then you probably should refactor the graph to have a single vertex representing that value and have other vertices reference it.
At this date (2014/01/06) this method is not implemented. We'll implement it when we add indexing support. Until then the caller should perhaps implement this themselves and include appropriate caching support to that implementation.
pname | the property name being searched |
pval | the property value for specified property. |
|
inline |
get the number or propertynames found edge in the graph. The caller can follow this up by calling get_property_name() from 0 .. ((returned value-1)) Values 0, 1... are reserved pseudo-properties, so the caller might chose to skip these and start with the CSVP_PROPERTIES_FIRST_NON_PSEUDO_PROPERTY property.
|
inline |
Maps a specified edge property-id to it's property name.
If the mapping doesn't exist, it will (currently) throw an out of range exception. That might change in a future version.
propid | The edge property id for which the name is requested. |
|
inline |
Maps a specified edge property-name to it's property-id.
This method can be valuable because operations on property id's are faster than operations on property names.
If the mapping doesn't exist, it will (currently) throw an out of range exception. That might change in a future version.
pname | Edge property name for which id is requested. |
|
inline |
Maps a specified label-id it's label string.
If the mapping doesn't exist, it will (currently) throw an out of range exception. That might change in a future version.
labelid | The label-id for which the string is requested. |
|
inline |
Maps a specified label name to it's label-id.
This method maps the specified label-string to a label-id. If the label does not exist, it returs false, otherwise sets the parameter to the label-id. Label-id's can be valuable because operations on label id's are faster than operations on label strings.
labelstr | The label string requested. |
retval | The label id, if the label string exists in the mapping. |
|
inline |
Maps a specified label string to it's label-id.
This method can be valuable because operations on labelid's are faster than operations on label strings.
If the mapping doesn't exist, it will (currently) throw an out of range exception. That might change in a future version.
labelstr | The label for which an id is requested. |
|
inline |
Maps a specified edge property-name to it's property-id.
This method maps the specified edge property-name to a vertex property-id. If that mapping doesn't exist, it creates one.
Property-id's can be valuable because operations on property id's are faster than operations on property names.
pname | The name of the edge property requested. |
|
inline |
Maps a specified label name to it's label-id.
This method maps the specified label-string to a label-id. If that mapping doesn't exist, it creates one.
Label-id's can be valuable because operations on label id's are faster than operations on label strings.
labelstr | The label string requested. |
|
inline |
Maps a specified vertex property-name to it's property-id.
This method maps the specified vertex property-name to a vertex property-id. If that mapping doesn't exist, it creates one.
Property-id's can be valuable because operations on property id's are faster than operations on property names.
pname | The name of the property requested. |
|
inline |
get the number or propertynames found vertices in the graph. The caller can follow this up by calling get_property_name() from 0 .. ((returned value-1)) Values 0, 1... are reserved pseudo-properties, so the caller might chose to skip these and start with the CSVP_PROPERTIES_FIRST_NON_PSEUDO_PROPERTY property.
|
inline |
Maps a specified vertex property-id to it's property value.
If the mapping doesn't exist, it will (currently) throw an out of range exception. That might change in a future version.
propid | The vertex property id for which the name is being requested. |
|
inline |
Maps a specified vertex property-name to it's property-id.
This method can be valuable because operations on property id's are faster than operations on property names.
If the mapping doesn't exist, it will (currently) throw an out of range exception. That might change in a future version.
pname | The vertex property name for which the id is requested. |
|
inline |
Returns the specified property for the specified vertex.
This method returns the specified property for the specified vertex. The returned value is in string form. If the value itself is not a string value, the returned value is converted to string form before being returned.
Note: update docs to indicate what happens if the property doesn't exist on the element.
vid | The vertex for which the property is being queried. |
pname | The name of the property being queried. |
|
inline |
Returns the specified property for the specified vertex.
This method returns the specified property for the specified vertex. The returned value is in string form. If the value itself is not a string value, the returned value is converted to string form before being returned.
Note: update docs to indicate what happens if the property doesn't exist on the element.
vid | The vertex for which the property is being queried. |
propid | The property id being queried. |
|
inline |
This is a method that most people should not use. It's used internally to keep the index up to date.
propid | The index property-id that needs to be updated. |
pval | The property value to be erased to the index. |
vid | The vertex represented by that property in the index. |
|
inline |
This is a method that most people should not use. It's used internally to keep the index up to date.
propid | The index property-id that needs to be updated. |
pval | The property value to be erased to the index. |
|
inline |
This method allows the caller to find the vid of a vertex that has the given value on the given property.
propid | the property of interest |
pval | the property value that must match |
vid | a reference to a vid that will be updated with the vid of a matching vertex. |
|
inline |
This method allows the caller to find all the vertices that have the given value on the given property. Warning: it will crash if there is no index. Check for that using the "available" method.
propid | the property of interest |
pval | the property value that must match |
vids | a reference to a vector of vids that will be updated with the vids of matching vertices. |
|
inline |
This method adds a property to an edge.
eid | The edge to add the property to |
pname | The property name to be inserted. |
value | The property value to be set for the named property |
|
inline |
This method adds a property to an edge.
eid | The edge to add the property to |
pid | The property id to be inserted. |
value | The property value to be set for the named property |
|
inline |
Sets the specified property for the specified vertex to the specified string value.
This method set the specified property for the specified vertex to the specified string value. If you'd like to set it to a non-string value, see the other similarly named methods of the vertex and edge classes.
vid | The vertex to add the property to |
pname | The property name to add to the specified vertex. |
value | The value to be set for the specified property |
|
inline |
Sets the specified property for the specified vertex to the specified string value.
This method set the specified property for the specified vertex to the specified string value. If you'd like to set it to a non-string value, see the other similarly named methods of the vertex and edge classes.
vid | The vertex to add the property to |
propid | The property idetifier to add to the specified vertex. |
value | The value to be set for the specified property |
|
inline |
This method indicates if the named index exists. Currently the index name is the name of the vertex property that would be indexed. At the moment this class does not support edge properties.
propid | The property id queried for indexing. |
|
inline |
This method is like vert_index_available() but it will throw an out_of_range exception if the propid is beyond the highest index we're supporting. This will help the calling code to enumerate indices.
propid | The property id queried for indexing. |
todo: if the number of propid's allocated is often high, this polling approach will be inefficient and we'll need to replace this method.