Graph patterns

## Graph patterns Graph patterns — Collections of triple patterns, sub-graph patterns with operators. |

## Functions

int | rasqal_graph_pattern_add_sub_graph_pattern ()
rasqal_expression * | rasqal_graph_pattern_get_filter_expression ()
int | rasqal_graph_pattern_set_filter_expression ()
raptor_sequence * | rasqal_graph_pattern_get_flattened_triples ()
int | rasqal_graph_pattern_get_index ()
rasqal_graph_pattern_operator | rasqal_graph_pattern_get_operator ()
rasqal_literal * | rasqal_graph_pattern_get_origin ()
rasqal_graph_pattern * | rasqal_graph_pattern_get_sub_graph_pattern ()
raptor_sequence * | rasqal_graph_pattern_get_sub_graph_pattern_sequence ()
rasqal_triple * | rasqal_graph_pattern_get_triple ()
raptor_sequence * | rasqal_graph_pattern_get_triples ()
rasqal_literal * | rasqal_graph_pattern_get_service ()
rasqal_variable * | rasqal_graph_pattern_get_variable ()
const char * | rasqal_graph_pattern_operator_as_string ()
int | rasqal_graph_pattern_print ()
int | rasqal_graph_pattern_variable_bound_in ()
int | (*rasqal_graph_pattern_visit_fn) ()
int | rasqal_graph_pattern_visit ()

## Types and Values

typedef | rasqal_graph_pattern
enum | rasqal_graph_pattern_operator

## Description

Graph patterns form a a tree structure that build a rasqal_query top-level graph pattern (see `rasqal_query_get_query_graph_pattern()`) which may have sub-graph patterns. Graph patterns at the leaf of the tree operate over triple patterns (rasqal_triple) matching the RDF triples in the data sources for `RASQAL_GRAPH_PATTERN_OPERATOR_BASIC` or `RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL`. Other graph patterns operators operate over sub graph patterns and group them, union them or apply a GRAPH matching keyword (`RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH`).

## Functions

### rasqal_graph_pattern_add_sub_graph_pattern ()

    int
    rasqal_graph_pattern_add_sub_graph_pattern
                                   (rasqal_graph_pattern *graph_pattern,
                                    rasqal_graph_pattern *sub_graph_pattern);

#### Returns

### rasqal_graph_pattern_get_filter_expression ()

    rasqal_expression *
    rasqal_graph_pattern_get_filter_expression
                                   (rasqal_graph_pattern *gp);

#### Returns

### rasqal_graph_pattern_set_filter_expression ()

    int
    rasqal_graph_pattern_set_filter_expression
                                   (rasqal_graph_pattern *gp,
                                    rasqal_expression *expr);

#### Returns

### rasqal_graph_pattern_get_flattened_triples ()

    raptor_sequence *
    rasqal_graph_pattern_get_flattened_triples
                                   (rasqal_query *query,
                                    rasqal_graph_pattern *graph_pattern);

#### Returns

### rasqal_graph_pattern_get_index ()

    int
    rasqal_graph_pattern_get_index (rasqal_graph_pattern *gp);

#### Returns

### rasqal_graph_pattern_get_operator ()

    rasqal_graph_pattern_operator
    rasqal_graph_pattern_get_operator (rasqal_graph_pattern *graph_pattern);

#### Returns

### rasqal_graph_pattern_get_origin ()

    rasqal_literal *
    rasqal_graph_pattern_get_origin (rasqal_graph_pattern *graph_pattern);

#### Returns

### rasqal_graph_pattern_get_sub_graph_pattern ()

    rasqal_graph_pattern *
    rasqal_graph_pattern_get_sub_graph_pattern
                                   (rasqal_graph_pattern *graph_pattern,
                                    int idx);

#### Returns

### rasqal_graph_pattern_get_sub_graph_pattern_sequence ()

    raptor_sequence *
    rasqal_graph_pattern_get_sub_graph_pattern_sequence
                                   (rasqal_graph_pattern *graph_pattern);

#### Returns

### rasqal_graph_pattern_get_triple ()

    rasqal_triple *
    rasqal_graph_pattern_get_triple (rasqal_graph_pattern *graph_pattern,
                                     int idx);

#### Returns

### rasqal_graph_pattern_get_triples ()

    raptor_sequence *
    rasqal_graph_pattern_get_triples (rasqal_query *query,
                                      rasqal_graph_pattern *graph_pattern);

#### Returns

### rasqal_graph_pattern_get_service ()

    rasqal_literal *
    rasqal_graph_pattern_get_service (rasqal_graph_pattern *graph_pattern);

#### Returns

### rasqal_graph_pattern_get_variable ()

    rasqal_variable *
    rasqal_graph_pattern_get_variable (rasqal_graph_pattern *graph_pattern);

#### Returns

### rasqal_graph_pattern_operator_as_string ()

    const char *
    rasqal_graph_pattern_operator_as_string
                                   (rasqal_graph_pattern_operator op);

#### Returns

### rasqal_graph_pattern_print ()

    int
    rasqal_graph_pattern_print (rasqal_graph_pattern *gp,
                                FILE *fh);

#### Returns

### rasqal_graph_pattern_variable_bound_in ()

    int
    rasqal_graph_pattern_variable_bound_in
                                   (rasqal_graph_pattern *gp,
                                    rasqal_variable *v);

#### Returns

### rasqal_graph_pattern_visit_fn ()

    int
    (*rasqal_graph_pattern_visit_fn) (rasqal_query *query,
                                      rasqal_graph_pattern *gp,
                                      void *user_data);

User function to visit an graph_pattern and operate on it with `rasqal_graph_pattern_visit()` or `rasqal_query_graph_pattern_visit()`

#### Parameters

query | rasqal_query containing the graph pattern |
gp | current graph_pattern |
user_data | user data passed in |

#### Returns

non-0 to truncate the visit

### rasqal_graph_pattern_visit ()

    int
    rasqal_graph_pattern_visit (rasqal_query *query,
                                rasqal_graph_pattern *gp,
                                rasqal_graph_pattern_visit_fn fn,
                                void *user_data);

#### Returns

## Types and Values

### rasqal_graph_pattern

    rasqal_graph_pattern* graph_pattern;

Rasqal graph pattern class.

### enum rasqal_graph_pattern_operator

Graph pattern operators

#### Members

RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN | Internal. |
RASQAL_GRAPH_PATTERN_OPERATOR_BASIC | Just triple patterns and constraints. |
RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL | Set of graph patterns (ANDed) and constraints. |
RASQAL_GRAPH_PATTERN_OPERATOR_UNION | Set of graph patterns (UNIONed) and constraints. |
RASQAL_GRAPH_PATTERN_OPERATOR_GROUP | Set of graph patterns (ANDed) and constraints. |
RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH | A graph term + a graph pattern and constraints. |
RASQAL_GRAPH_PATTERN_OPERATOR_FILTER | A filter graph pattern with an expression |
RASQAL_GRAPH_PATTERN_OPERATOR_LET | LET ?var := Expression (LAQRS) |
RASQAL_GRAPH_PATTERN_OPERATOR_SELECT | SELECT graph pattern |
RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE | SERVICE graph pattern |
RASQAL_GRAPH_PATTERN_OPERATOR_MINUS | MINUS graph pattern |
RASQAL_GRAPH_PATTERN_OPERATOR_VALUES | VALUES graph pattern |
RASQAL_GRAPH_PATTERN_OPERATOR_LAST | Internal. |