Rasqal RDF Query Library Manual | ||||
---|---|---|---|---|
Top | Description |
typedef rasqal_graph_pattern; int rasqal_graph_pattern_add_sub_graph_pattern (rasqal_graph_pattern *graph_pattern
,rasqal_graph_pattern *sub_graph_pattern
); rasqal_expression * rasqal_graph_pattern_get_filter_expression (rasqal_graph_pattern *gp
); int rasqal_graph_pattern_set_filter_expression (rasqal_graph_pattern *gp
,rasqal_expression *expr
); raptor_sequence * rasqal_graph_pattern_get_flattened_triples (rasqal_query *query
,rasqal_graph_pattern *graph_pattern
); int rasqal_graph_pattern_get_index (rasqal_graph_pattern *gp
); rasqal_graph_pattern_operator rasqal_graph_pattern_get_operator (rasqal_graph_pattern *graph_pattern
); rasqal_literal * rasqal_graph_pattern_get_origin (rasqal_graph_pattern *graph_pattern
); rasqal_graph_pattern * rasqal_graph_pattern_get_sub_graph_pattern (rasqal_graph_pattern *graph_pattern
,int idx
); raptor_sequence * rasqal_graph_pattern_get_sub_graph_pattern_sequence (rasqal_graph_pattern *graph_pattern
); rasqal_triple * rasqal_graph_pattern_get_triple (rasqal_graph_pattern *graph_pattern
,int idx
); raptor_sequence * rasqal_graph_pattern_get_triples (rasqal_query *query
,rasqal_graph_pattern *graph_pattern
); rasqal_literal * rasqal_graph_pattern_get_service (rasqal_graph_pattern *graph_pattern
); rasqal_variable * rasqal_graph_pattern_get_variable (rasqal_graph_pattern *graph_pattern
); enum rasqal_graph_pattern_operator; const char * rasqal_graph_pattern_operator_as_string (rasqal_graph_pattern_operator op
); int rasqal_graph_pattern_print (rasqal_graph_pattern *gp
,FILE *fh
); int rasqal_graph_pattern_variable_bound_in (rasqal_graph_pattern *gp
,rasqal_variable *v
); int (*rasqal_graph_pattern_visit_fn) (rasqal_query *query
,rasqal_graph_pattern *gp
,void *user_data
); int rasqal_graph_pattern_visit (rasqal_query *query
,rasqal_graph_pattern *gp
,rasqal_graph_pattern_visit_fn fn
,void *user_data
);
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
).
int rasqal_graph_pattern_add_sub_graph_pattern (rasqal_graph_pattern *graph_pattern
,rasqal_graph_pattern *sub_graph_pattern
);
Add a sub graph pattern to a graph pattern.
|
graph pattern to add to |
|
graph pattern to add inside |
Returns : |
non-0 on failure |
rasqal_expression * rasqal_graph_pattern_get_filter_expression
(rasqal_graph_pattern *gp
);
Get a filter graph pattern's constraint expression
|
rasqal_graph_pattern query object |
Returns : |
expression or NULL on failure |
int rasqal_graph_pattern_set_filter_expression (rasqal_graph_pattern *gp
,rasqal_expression *expr
);
Set a filter graph pattern constraint expression
|
rasqal_graph_pattern query object |
|
rasqal_expression expr - ownership taken |
Returns : |
non-0 on failure |
raptor_sequence * rasqal_graph_pattern_get_flattened_triples (rasqal_query *query
,rasqal_graph_pattern *graph_pattern
);
Get the triples inside a tree of graph patterns (BASIC + GRAPH) as a single sequence with GRAPHs turned into triple origin.
The returned sequence and all the rasqal_triple in it are owned by the caller (hold references).
|
query |
|
graph pattern |
Returns : |
new sequence of raptor_triple or NULL on failure |
int rasqal_graph_pattern_get_index (rasqal_graph_pattern *gp
);
Get the graph pattern absolute index in the array of graph patterns.
The graph pattern index is assigned when rasqal_query_prepare()
is
run on a query containing a graph pattern.
|
rasqal_graph_pattern graph pattern |
Returns : |
index or <0 if no index has been assigned yet |
rasqal_graph_pattern_operator rasqal_graph_pattern_get_operator
(rasqal_graph_pattern *graph_pattern
);
Get the graph pattern operator .
The operator for the given graph pattern. See also
rasqal_graph_pattern_operator_as_string()
.
|
rasqal_graph_pattern graph pattern object |
Returns : |
graph pattern operator |
rasqal_literal * rasqal_graph_pattern_get_origin (rasqal_graph_pattern *graph_pattern
);
Get the graph pattern literal for RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH graph pattern
|
rasqal_graph_pattern graph pattern object |
Returns : |
graph literal parameter or NULL if wrong graph pattern type or not defined |
rasqal_graph_pattern * rasqal_graph_pattern_get_sub_graph_pattern (rasqal_graph_pattern *graph_pattern
,int idx
);
Get a sub-graph pattern inside a graph pattern.
|
rasqal_graph_pattern graph pattern object |
|
index into the sequence of sub graph_patterns in the graph pattern |
Returns : |
rasqal_graph_pattern or NULL if out of range |
raptor_sequence * rasqal_graph_pattern_get_sub_graph_pattern_sequence
(rasqal_graph_pattern *graph_pattern
);
Get the sequence of graph patterns inside a graph pattern .
|
rasqal_graph_pattern graph pattern object |
Returns : |
a raptor_sequence of rasqal_graph_pattern pointers. |
rasqal_triple * rasqal_graph_pattern_get_triple (rasqal_graph_pattern *graph_pattern
,int idx
);
Get a triple inside a graph pattern.
|
rasqal_graph_pattern graph pattern object |
|
index into the sequence of triples in the graph pattern |
Returns : |
rasqal_triple or NULL if out of range |
raptor_sequence * rasqal_graph_pattern_get_triples (rasqal_query *query
,rasqal_graph_pattern *graph_pattern
);
Get the triples inside this graph pattern (if any).
The returned sequence and all the rasqal_triple in it are owned by the caller (hold references).
|
query |
|
graph pattern |
Returns : |
new sequence of raptor_triple or NULL on failure or no triples |
rasqal_literal * rasqal_graph_pattern_get_service (rasqal_graph_pattern *graph_pattern
);
Get the literal for RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE graph pattern
|
rasqal_graph_pattern graph pattern object |
Returns : |
graph variable or NULL if wrong graph pattern or not defined |
rasqal_variable * rasqal_graph_pattern_get_variable (rasqal_graph_pattern *graph_pattern
);
Get the variable for RASQAL_GRAPH_PATTERN_OPERATOR_LET graph pattern
|
rasqal_graph_pattern graph pattern object |
Returns : |
graph variable or NULL if wrong graph pattern or not defined |
typedef enum { RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN = 0, RASQAL_GRAPH_PATTERN_OPERATOR_BASIC = 1, RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL = 2, RASQAL_GRAPH_PATTERN_OPERATOR_UNION = 3, RASQAL_GRAPH_PATTERN_OPERATOR_GROUP = 4, RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH = 5, RASQAL_GRAPH_PATTERN_OPERATOR_FILTER = 6, RASQAL_GRAPH_PATTERN_OPERATOR_LET = 7, RASQAL_GRAPH_PATTERN_OPERATOR_SELECT = 8, RASQAL_GRAPH_PATTERN_OPERATOR_SERVICE = 9, RASQAL_GRAPH_PATTERN_OPERATOR_MINUS = 10, RASQAL_GRAPH_PATTERN_OPERATOR_VALUES = 11, RASQAL_GRAPH_PATTERN_OPERATOR_LAST = RASQAL_GRAPH_PATTERN_OPERATOR_VALUES } rasqal_graph_pattern_operator;
Graph pattern operators
Internal. | |
Just triple patterns and constraints. | |
Set of graph patterns (ANDed) and constraints. | |
Set of graph patterns (UNIONed) and constraints. | |
Set of graph patterns (ANDed) and constraints. | |
A graph term + a graph pattern and constraints. | |
A filter graph pattern with an expression | |
LET ?var := Expression (LAQRS) | |
SELECT graph pattern | |
SERVICE graph pattern | |
MINUS graph pattern | |
VALUES graph pattern | |
Internal. |
const char * rasqal_graph_pattern_operator_as_string
(rasqal_graph_pattern_operator op
);
Get a string for the query verb.
|
the rasqal_graph_pattern_operator verb of the query |
Returns : |
pointer to a shared string label for the query verb |
int rasqal_graph_pattern_print (rasqal_graph_pattern *gp
,FILE *fh
);
Print a rasqal_graph_pattern in a debug format.
The print debug format may change in any release.
|
the rasqal_graph_pattern object |
|
the FILE* handle to print to |
Returns : |
non-0 on failure |
int rasqal_graph_pattern_variable_bound_in (rasqal_graph_pattern *gp
,rasqal_variable *v
);
Is the variable bound in this graph pattern (not including children)?
|
graph pattern |
|
variable |
Returns : |
non-0 if variable is bound in the given graph pattern. |
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()
|
rasqal_query containing the graph pattern |
|
current graph_pattern |
|
user data passed in |
Returns : |
non-0 to truncate the visit |
int rasqal_graph_pattern_visit (rasqal_query *query
,rasqal_graph_pattern *gp
,rasqal_graph_pattern_visit_fn fn
,void *user_data
);
Visit a user function over a rasqal_graph_pattern
If the user function fn
returns 0, the visit is truncated.
|
rasqal_query to operate on |
|
rasqal_graph_pattern graph pattern |
|
pointer to function to apply that takes user data and graph pattern parameters |
|
user data for applied function |
Returns : |
0 if the visit was truncated. |
Navigation: Redland Home Page