IBM SYSTEMG G RUNTIME & NATIVE STORE  0.5
IBM Native Graph Computing and Storage System based on IBM Parallel Programming Library
 All Classes Functions Variables Typedefs Pages
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Types | List of all members
ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType > Class Template Reference

Buffers all modifications to the properties until the user triggers the commit. More...

#include <ibm_multiproperty_graph.hpp>

Public Types

typedef IdType elementd_type
 
typedef GraphElement::property_type property_type
 
typedef std::string property_name_type
 
typedef std::string property_value_type
 
typedef std::string label_string_type
 
typedef std::string vclass_string_type
 

Public Member Functions

 imp_graphelement_iterator (base_type it, graph_type *g)
 
 imp_graphelement_iterator (imp_graphelement_iterator const &others)
 
imp_graphelement_iteratoroperator= (imp_graphelement_iterator const &others)
 
graph_typegraph_ptr (void)
 
void check_consistency (const char *filename, int linenum)
 
GraphElement & operator* ()
 
imp_graphelement_iteratoroperator-> ()
 
void operator++ (int xx)
 
void operator++ ()
 
bool operator== (const imp_graphelement_iterator &other)
 
bool operator!= (const imp_graphelement_iterator &other)
 
const property_type & property () const
 
property_type & property ()
 
const elementd_type id () const
 
void set_property (property_type &new_vp)
 
size_t get_first_subproperty_id ()
 
size_t get_next_subproperty_id (size_t propid)
 
void set_externalidxxx (property_value_type value)
 
std::string get_externalid_xx ()
 
std::string get_label ()
 
img_labelid_type get_labelid ()
 
void set_label (std::string label)
 
void set_labelid (img_labelid_type labelid)
 
void set_subproperty (const property_name_type &pname, const property_value_type &value)
 
void set_subproperty (const size_t propid, const property_value_type &value)
 
void set_subproperty (const size_t propid, char const *value, int valuelen)
 
void set_subproperty (const size_t propid, int ivalue)
 
void set_subproperty (const size_t propid, double dvalue)
 
property_value_type get_subproperty (const property_name_type &pname)
 
int get_subpropertytype (size_t propid)
 
property_value_type get_subproperty (size_t propid)
 
int get_int_subproperty (size_t propid)
 
double get_double_subproperty (size_t propid)
 
void delete_subproperty (const property_name_type &pname)
 
void delete_subproperty (size_t propid)
 
size_t get_subproperty_count ()
 
void iter_setEnd (base_type itEnd)
 
int iter_done ()
 

Public Attributes

base_type _iter
 
graph_type_graph_ptr
 

Protected Member Functions

size_t _get_or_allocate_propertyid (const property_name_type &pname)
 
size_t _get_propertyid (const property_name_type &pname)
 

Protected Attributes

bool _isEdge
 
long vid_source
 
int boolEndIterSet
 
base_type _iterEnd
 

Private Types

typedef BaseIterator base_type
 
typedef Graph graph_type
 

Detailed Description

template<class GraphElement, class BaseIterator, class Graph, class IdType>
class ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >

Buffers all modifications to the properties until the user triggers the commit.

Multiproperty graph base iterator; Vertex and edge iterators derive from it. Pred iterator does not.

Member Function Documentation

template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::check_consistency ( const char *  filename,
int  linenum 
)
inline

Call this method with the pertinent file name and line number of the calling code. This method will do a trivial consistency check on this iterator. If the test fails, CHKCONSIST_ASSERT4 will take action. See checkconsistency.h.

Author
ccjason (3/4/2014)
template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::delete_subproperty ( const property_name_type &  pname)
inline

Delete the specified sub-property from this graph element

Note: the propid version of this method is somewhat faster.

Author
ccjason (1/6/2014)
template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::delete_subproperty ( size_t  propid)
inline

Delete the specified sub-property from this graph element

Author
ccjason (1/6/2014)
template<class GraphElement, class BaseIterator, class Graph, class IdType>
double ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::get_double_subproperty ( size_t  propid)
inline

Get the specified property value as a double value.

To-do: document what happens if the property is not set or is not of the specified type.

Author
ccjason (1/6/2014)
Returns
double
template<class GraphElement, class BaseIterator, class Graph, class IdType>
std::string ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::get_externalid_xx ( )
inline

Get the external id of a given vertex.

See the set_externalid() method for more information about external id's.

Author
ccjason (1/6/2014)
Returns
std::string
template<class GraphElement, class BaseIterator, class Graph, class IdType>
size_t ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::get_first_subproperty_id ( )
inline

Method to implement the first step in implementing a property iterator on a given vertex.

Also see get_next_subproperty_id() method.

Author
ccjason (1/6/2014)
Returns
size_t the first property-id set on a given graph element.
template<class GraphElement, class BaseIterator, class Graph, class IdType>
int ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::get_int_subproperty ( size_t  propid)
inline

Get the specified property value as an int value.

To-do: document what happens if the property is not set or is not of the specified type.

Author
ccjason (1/6/2014)
Returns
int
template<class GraphElement, class BaseIterator, class Graph, class IdType>
std::string ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::get_label ( )
inline

Returns the label of an edge.

See the set_label() method for information about labels.

Exceptions
(int)505- if the iterator is not for an edge;
(int)506- the label is not set
Author
ccjason (1/6/2014)
Returns
std::string
template<class GraphElement, class BaseIterator, class Graph, class IdType>
img_labelid_type ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::get_labelid ( )
inline

Returns the labelid of an edge.

See the set_label() method for information about labels.

Exceptions
(int)505- if the iterator is not for an edge;
Author
ccjason (1/10/2014)
Returns
img_label_type
template<class GraphElement, class BaseIterator, class Graph, class IdType>
size_t ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::get_next_subproperty_id ( size_t  propid)
inline

Method to implement a property iterator on a given vertex.

Parameters
propidThis is the propid returned from get_first_subproperty_id or the last call to get_next_subproperty_id().
Author
ccjason (1/6/2014)
Returns
size_t
template<class GraphElement, class BaseIterator, class Graph, class IdType>
property_value_type ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::get_subproperty ( const property_name_type &  pname)
inline

returns the specified property value as a string.

Note: other methods are likely to be somewhat faster because property-id's are faster than property names and eventually value-type specific methods can be expected to be faster than generic string methods.

Author
ccjason (1/6/2014)
Returns
property_value_type
template<class GraphElement, class BaseIterator, class Graph, class IdType>
property_value_type ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::get_subproperty ( size_t  propid)
inline

Get the specified property value as a string.

To-do: document what happens if the property is not set.

To-do: document what happens if the property is not of the specified type. (I think it actually "converts" to the specified type in this case. If so, in the future there might be a performance penalty for that.)

Author
ccjason (1/6/2014)
Returns
int
template<class GraphElement, class BaseIterator, class Graph, class IdType>
size_t ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::get_subproperty_count ( )
inline
Author
ccjason (1/6/2014)
Returns
size_t The number of sub-properties on this graph element
template<class GraphElement, class BaseIterator, class Graph, class IdType>
int ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::get_subpropertytype ( size_t  propid)
inline

Returns the value type of the given property on the given element.

Right now there are several property value types supported (string, int, double, unset). This method allows the caller to know what type value to expect before making a call to extract that value. In doing so, it also lets the caller know which method is best for extracting that value.

Author
ccjason (1/6/2014)
Returns
int
template<class GraphElement, class BaseIterator, class Graph, class IdType>
const elementd_type ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::id ( ) const
inline

This method returns the internal id of the element currently referenced by this iterator. The type of returned value (elementd_type) is usually a 64bit integer.

Author
ccjason (3/4/2014)
Returns
const elementd_type
template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::operator++ ( int  xx)
inline

This method advances the iterator.

Author
ccjason (3/4/2014)
template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::operator++ ( )
inline

advance the iterator

Author
ccjason (3/4/2014)
template<class GraphElement, class BaseIterator, class Graph, class IdType>
bool ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::operator== ( const imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType > &  other)
inline

equals operator.

Author
ccjason (3/4/2014)
Returns
bool
template<class GraphElement, class BaseIterator, class Graph, class IdType>
const property_type& ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::property ( ) const
inline

This method is implemented in the superclass but is deprecated for objects of this class.

Author
ccjason (3/4/2014)
Returns
bool
template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::set_externalidxxx ( property_value_type  value)
inline

Set the external vertex id

External id's are unique values that the application sets on a given graph element that are meaningful to the application. Ex. "George Washington" or "IBM". We don't enforce this yet, but it expected that only one element will have a given external id value.

Note: 2013-01-06: it is likely that in a future implementation of this graph we'll automatically build an index for vertex external id's. That index is likely to support only unique mappings from externalid -> vertex.

FIXME: It should be set in the constructor;

template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::set_label ( std::string  label)
inline

set the label of an edge

Labels are strings that designate the purpose of an edge. An example of this concept is the "likes" or "member_of" label.

One should set the label of and edge only once. We'll eventually enforce that rule.

FIXME: It should be set in the constructor;

Note: the labelid method is faster than this one. Use it if you can.

Exceptions
505must be an edge
Author
ccjason (1/10/2014)
template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::set_labelid ( img_labelid_type  labelid)
inline

set the labelid of an edge

Labels are strings that designate the purpose of an edge. An example of this concept is the "likes" or "member_of" label. The labelid is a shorter key that more compactly represents a label string.

FIXME: It should be set in the constructor;

Exceptions
505must be an edge
Author
ccjason (1/10/2014)
template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::set_property ( property_type &  new_vp)
inline

This method is implemented in the super class but deprecated in this class.

Author
ccjason (3/4/2014)
Returns
const elementd_type
template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::set_subproperty ( const property_name_type &  pname,
const property_value_type &  value 
)
inline

This method takes the name of a property and a new (string) value and updates the referenced element.

Author
ccjason (3/4/2014)
template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::set_subproperty ( const size_t  propid,
const property_value_type &  value 
)
inline

This method sets the value of the specified property on the referenced element.

Parameters
propid
newvalue
Author
ccjason (3/4/2014)
template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::set_subproperty ( const size_t  propid,
char const *  value,
int  valuelen 
)
inline

Same as the version of this method that takes a std::string. In fact currently this method calls that method. This one exists to be a place holder for a faster implementation we might write in the future that strives to reduce the use of std::string which appears to be responsible for most of the the CPU time spent in and below these set of methods. – If a caller doesn't currently have a std::string, they should call this method instead. This should also be the case if the caller is constructing a std::string simply for the sake of calling the existing method. Otherwise, if the caller does have a std::string value, it should call the other method.

Author
ccjason (9/15/2014)
template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::set_subproperty ( const size_t  propid,
int  ivalue 
)
inline

An int version of the set_subproperty() method.

Author
ccjason (1/6/2014)
template<class GraphElement, class BaseIterator, class Graph, class IdType>
void ibmppl::imp_graphelement_iterator< GraphElement, BaseIterator, Graph, IdType >::set_subproperty ( const size_t  propid,
double  dvalue 
)
inline

An double version of the set_subproperty() method.

Author
ccjason (1/6/2014)

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