File: query-datatypes.h

package info (click to toggle)
4store 1.1.6+20151109-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 82,388 kB
  • sloc: ansic: 65,689; sh: 2,916; perl: 2,245; makefile: 281; python: 213
file content (69 lines) | stat: -rw-r--r-- 2,950 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef QUERY_DATATYPES_H
#define QUERY_DATATYPES_H

#include <glib.h>
#include <rasqal.h>

#include "../common/4s-datatypes.h"
#include "../common/params.h"

#define FS_BINDING_MAX_VARS 128

typedef struct _fs_binding {
	char *name;
	fs_rid_vector *vals;
	rasqal_expression *expression;
			/* if the var is projected as an expression, this
			   points to the expression */
	int proj;	/* is var projected? */
	int selected;	/* is the variable used in final stage selections */
	int used;	/* used in current expression */
	int bound_in_block[FS_MAX_BLOCKS];
			/* number of times var bound in block */
	int need_val;	/* do we need the RID values (for joins or FILTERs) */
	int bound;	/* is var bound yet? */
	int appears;	/* block var first appears in */
	int depends;	/* column that this variable depends on */
	int sort;       /* whether to sort on that column */
} fs_binding;

typedef struct _fs_query fs_query;
typedef struct _fs_query_state fs_query_state;
typedef struct _fs_bind_expression fs_bind_expression;

typedef enum { FS_NONE, FS_INNER, FS_LEFT, FS_UNION, FS_MINUS } fs_join_type;

fs_binding *fs_binding_new(void);
int fs_binding_set_expression(fs_binding *b, rasqal_variable *var, rasqal_expression *ex);
void fs_binding_free(fs_binding *b);
int fs_binding_any_bound(fs_binding *b);
int fs_binding_width(fs_binding *b);
int fs_binding_length(fs_binding *b);
fs_binding *fs_binding_add(fs_binding *b, rasqal_variable *var, fs_rid val, int projected);
fs_binding *fs_binding_create(fs_binding *b, const char *name, fs_rid val, int projected);
fs_binding *fs_binding_copy(fs_binding *b);
fs_binding *fs_binding_copy_and_clear(fs_binding *b);
void fs_binding_add_vector(fs_binding *b, rasqal_variable *var, fs_rid_vector *vals);
void fs_binding_intersect_vector(fs_binding *b, const char *name,
		        fs_rid_vector *vals);
fs_binding *fs_binding_get(fs_binding *b, rasqal_variable *var);
fs_rid fs_binding_get_val(fs_binding *b, rasqal_variable *var, int idx, int *bound);
fs_rid_vector *fs_binding_get_vals(fs_binding *b, const char *name, int *bound);
void fs_binding_clear_used_all(fs_binding *b);
void fs_binding_set_used(fs_binding *b, rasqal_variable *var);
void fs_binding_copy_row_unused(fs_binding *b1, int row, int count, fs_binding *b2);
void fs_binding_union(fs_query *q, fs_binding *a, fs_binding *b);
void fs_binding_merge(fs_query *q, int block, fs_binding *from, fs_binding *to);
fs_binding *fs_binding_join(fs_query *q, fs_binding *a, fs_binding *b, fs_join_type);
fs_binding *fs_binding_minus(fs_query *q, fs_binding *a, fs_binding *b);
const char *fs_join_type_as_string(fs_join_type t);
void fs_binding_print(fs_binding *b, FILE *out);
void fs_binding_sort(fs_binding *b);
void fs_binding_uniq(fs_binding *b);
void fs_binding_truncate(fs_binding *b, int length);

fs_binding *fs_binding_apply_filters(fs_query *q, int block, fs_binding *b, raptor_sequence *c);

void fs_free_cached_resource(gpointer r);

#endif