GDAL
Public Member Functions | Static Public Member Functions | List of all members
GDALRelationship Class Reference

Definition of a table relationship. More...

#include <gdal_priv.h>

Public Member Functions

 GDALRelationship (const std::string &osName, const std::string &osLeftTableName, const std::string &osRightTableName, GDALRelationshipCardinality eCardinality=GDALRelationshipCardinality::GRC_ONE_TO_MANY)
 Constructor for a relationship between two tables.
 
const std::string & GetName () const
 Get the name of the relationship.
 
GDALRelationshipCardinality GetCardinality () const
 Get the cardinality of the relationship.
 
const std::string & GetLeftTableName () const
 Get the name of the left (or base/origin) table in the relationship.
 
const std::string & GetRightTableName () const
 Get the name of the right (or related/destination) table in the relationship.
 
const std::string & GetMappingTableName () const
 Get the name of the mapping table for many-to-many relationships.
 
void SetMappingTableName (const std::string &osName)
 Sets the name of the mapping table for many-to-many relationships.
 
const std::vector< std::string > & GetLeftTableFields () const
 Get the names of the participating fields from the left table in the relationship.
 
const std::vector< std::string > & GetRightTableFields () const
 Get the names of the participating fields from the right table in the relationship.
 
void SetLeftTableFields (const std::vector< std::string > &osListFields)
 Sets the names of the participating fields from the left table in the relationship.
 
void SetRightTableFields (const std::vector< std::string > &osListFields)
 Sets the names of the participating fields from the right table in the relationship.
 
const std::vector< std::string > & GetLeftMappingTableFields () const
 Get the names of the mapping table fields which correspond to the participating fields from the left table in the relationship.
 
const std::vector< std::string > & GetRightMappingTableFields () const
 Get the names of the mapping table fields which correspond to the participating fields from the right table in the relationship.
 
void SetLeftMappingTableFields (const std::vector< std::string > &osListFields)
 Sets the names of the mapping table fields which correspond to the participating fields from the left table in the relationship.
 
void SetRightMappingTableFields (const std::vector< std::string > &osListFields)
 Sets the names of the mapping table fields which correspond to the participating fields from the right table in the relationship.
 
GDALRelationshipType GetType () const
 Get the type of the relationship.
 
void SetType (GDALRelationshipType eType)
 Sets the type of the relationship.
 
const std::string & GetForwardPathLabel () const
 Get the label of the forward path for the relationship.
 
void SetForwardPathLabel (const std::string &osLabel)
 Sets the label of the forward path for the relationship.
 
const std::string & GetBackwardPathLabel () const
 Get the label of the backward path for the relationship.
 
void SetBackwardPathLabel (const std::string &osLabel)
 Sets the label of the backward path for the relationship.
 
const std::string & GetRelatedTableType () const
 Get the type string of the related table.
 
void SetRelatedTableType (const std::string &osType)
 Sets the type string of the related table.
 

Static Public Member Functions

static GDALRelationshipH ToHandle (GDALRelationship *poRelationship)
 Convert a GDALRelationship* to a GDALRelationshipH.
 
static GDALRelationshipFromHandle (GDALRelationshipH hRelationship)
 Convert a GDALRelationshipH to a GDALRelationship*.
 

Detailed Description

Definition of a table relationship.

GDALRelationship describes the relationship between two tables, including properties such as the cardinality of the relationship and the participating tables.

Not all relationship properties are supported by all data formats.

Since
GDAL 3.6

Constructor & Destructor Documentation

◆ GDALRelationship()

GDALRelationship::GDALRelationship ( const std::string &  osName,
const std::string &  osLeftTableName,
const std::string &  osRightTableName,
GDALRelationshipCardinality  eCardinality = GDALRelationshipCardinality::GRC_ONE_TO_MANY 
)
inline

Constructor for a relationship between two tables.

Parameters
osNamerelationship name
osLeftTableNameleft table name
osRightTableNameright table name
eCardinalitycardinality of relationship

Member Function Documentation

◆ GetBackwardPathLabel()

const std::string & GDALRelationship::GetBackwardPathLabel ( ) const
inline

Get the label of the backward path for the relationship.

The forward and backward path labels are free-form, user-friendly strings which can be used to generate descriptions of the relationship between features from the right and left tables.

E.g. when the left table contains buildings and the right table contains furniture, the forward path label could be "contains" and the backward path label could be "is located within". A client could then generate a user friendly description string such as "fire hose 1234 is located within building 15a".

See also
SetBackwardPathLabel()
GetForwardPathLabel()

◆ GetForwardPathLabel()

const std::string & GDALRelationship::GetForwardPathLabel ( ) const
inline

Get the label of the forward path for the relationship.

The forward and backward path labels are free-form, user-friendly strings which can be used to generate descriptions of the relationship between features from the right and left tables.

E.g. when the left table contains buildings and the right table contains furniture, the forward path label could be "contains" and the backward path label could be "is located within". A client could then generate a user friendly description string such as "fire hose 1234 is located within building 15a".

See also
SetForwardPathLabel()
GetBackwardPathLabel()

◆ GetLeftMappingTableFields()

const std::vector< std::string > & GDALRelationship::GetLeftMappingTableFields ( ) const
inline

Get the names of the mapping table fields which correspond to the participating fields from the left table in the relationship.

See also
GetRightMappingTableFields()
SetLeftMappingTableFields()

◆ GetLeftTableFields()

const std::vector< std::string > & GDALRelationship::GetLeftTableFields ( ) const
inline

Get the names of the participating fields from the left table in the relationship.

See also
GetRightTableFields()
SetLeftTableFields()

◆ GetLeftTableName()

const std::string & GDALRelationship::GetLeftTableName ( ) const
inline

Get the name of the left (or base/origin) table in the relationship.

See also
GetRightTableName()

◆ GetMappingTableName()

const std::string & GDALRelationship::GetMappingTableName ( ) const
inline

Get the name of the mapping table for many-to-many relationships.

See also
SetMappingTableName()

◆ GetRelatedTableType()

const std::string & GDALRelationship::GetRelatedTableType ( ) const
inline

Get the type string of the related table.

This a free-form string representing the type of related features, where the exact interpretation is format dependent. For instance, table types from GeoPackage relationships will directly reflect the categories from the GeoPackage related tables extension (i.e. "media", "simple attributes", "features", "attributes" and "tiles").

See also
SetRelatedTableType()

◆ GetRightMappingTableFields()

const std::vector< std::string > & GDALRelationship::GetRightMappingTableFields ( ) const
inline

Get the names of the mapping table fields which correspond to the participating fields from the right table in the relationship.

See also
GetLeftMappingTableFields()
SetRightMappingTableFields()

◆ GetRightTableFields()

const std::vector< std::string > & GDALRelationship::GetRightTableFields ( ) const
inline

Get the names of the participating fields from the right table in the relationship.

See also
GetLeftTableFields()
SetRightTableFields()

◆ GetType()

GDALRelationshipType GDALRelationship::GetType ( ) const
inline

Get the type of the relationship.

See also
SetType()

◆ SetBackwardPathLabel()

void GDALRelationship::SetBackwardPathLabel ( const std::string &  osLabel)
inline

Sets the label of the backward path for the relationship.

The forward and backward path labels are free-form, user-friendly strings which can be used to generate descriptions of the relationship between features from the right and left tables.

E.g. when the left table contains buildings and the right table contains furniture, the forward path label could be "contains" and the backward path label could be "is located within". A client could then generate a user friendly description string such as "fire hose 1234 is located within building 15a".

See also
GetBackwardPathLabel()
SetForwardPathLabel()

◆ SetForwardPathLabel()

void GDALRelationship::SetForwardPathLabel ( const std::string &  osLabel)
inline

Sets the label of the forward path for the relationship.

The forward and backward path labels are free-form, user-friendly strings which can be used to generate descriptions of the relationship between features from the right and left tables.

E.g. when the left table contains buildings and the right table contains furniture, the forward path label could be "contains" and the backward path label could be "is located within". A client could then generate a user friendly description string such as "fire hose 1234 is located within building 15a".

See also
GetForwardPathLabel()
SetBackwardPathLabel()

◆ SetLeftMappingTableFields()

void GDALRelationship::SetLeftMappingTableFields ( const std::vector< std::string > &  osListFields)
inline

Sets the names of the mapping table fields which correspond to the participating fields from the left table in the relationship.

See also
GetLeftMappingTableFields()
SetRightMappingTableFields()

◆ SetLeftTableFields()

void GDALRelationship::SetLeftTableFields ( const std::vector< std::string > &  osListFields)
inline

Sets the names of the participating fields from the left table in the relationship.

See also
GetLeftTableFields()
SetRightTableFields()

◆ SetMappingTableName()

void GDALRelationship::SetMappingTableName ( const std::string &  osName)
inline

Sets the name of the mapping table for many-to-many relationships.

See also
GetMappingTableName()

◆ SetRelatedTableType()

void GDALRelationship::SetRelatedTableType ( const std::string &  osType)
inline

Sets the type string of the related table.

This a free-form string representing the type of related features, where the exact interpretation is format dependent. For instance, table types from GeoPackage relationships will directly reflect the categories from the GeoPackage related tables extension (i.e. "media", "simple attributes", "features", "attributes" and "tiles").

See also
GetRelatedTableType()

◆ SetRightMappingTableFields()

void GDALRelationship::SetRightMappingTableFields ( const std::vector< std::string > &  osListFields)
inline

Sets the names of the mapping table fields which correspond to the participating fields from the right table in the relationship.

See also
GetRightMappingTableFields()
SetLeftMappingTableFields()

◆ SetRightTableFields()

void GDALRelationship::SetRightTableFields ( const std::vector< std::string > &  osListFields)
inline

Sets the names of the participating fields from the right table in the relationship.

See also
GetRightTableFields()
SetLeftTableFields()

◆ SetType()

void GDALRelationship::SetType ( GDALRelationshipType  eType)
inline

Sets the type of the relationship.

See also
GetType()

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