File: rdf_core.h

package info (click to toggle)
virtuoso-opensource 6.1.6+dfsg2-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 260,992 kB
  • ctags: 125,220
  • sloc: ansic: 652,748; sql: 458,419; xml: 282,834; java: 61,031; sh: 40,031; cpp: 36,890; cs: 25,240; php: 12,692; yacc: 9,523; lex: 7,018; makefile: 6,157; jsp: 4,484; awk: 1,643; perl: 1,013; ruby: 1,003; python: 326
file content (313 lines) | stat: -rw-r--r-- 19,814 bytes parent folder | download | duplicates (2)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/*
 *  $Id$
 *
 *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 *  project.
 *
 *  Copyright (C) 1998-2012 OpenLink Software
 *
 *  This project is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License as published by the
 *  Free Software Foundation; only version 2 of the License, dated June 1991.
 *
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 *
 */

#ifndef __RDF_CORE_H
#define __RDF_CORE_H
#include "langfunc.h"
#include "uname_const_decl.h"
#include "sqlnode.h"
#include "rdf_mapping_jso.h"
#include "xmlparser.h" /* for xml_read_func_t and xml_read_abend_func_t */

#define RO_START_LEN 10 /*!< Maximum length of string prefixes in prefix table */

#define IRI_TO_ID_IF_KNOWN	0 /*!< Return IRI_ID if known, integer zero (NULL) if not known or error is not NULL */
#define IRI_TO_ID_WITH_CREATE	1 /*!< Return IRI_ID if known or created on the fly, integer zero (NULL) if error is not NULL */
#define IRI_TO_ID_IF_CACHED	2 /*!< Return IRI_ID if known and is in cache, integer zero (NULL) if not known or known but not cached or error is not NULL */

/*!< returns 0 for NULL or non-cached rdf box or error, 1 for ready to use iri_id, 2 for URI string */
extern int iri_canonicalize (query_instance_t *qi, caddr_t name, int mode, caddr_t *res_ret, caddr_t *err_ret);
extern caddr_t iri_to_id (caddr_t *qst, caddr_t name, int mode, caddr_t *err_ret);
extern caddr_t key_id_to_canonicalized_iri (query_instance_t * qi, iri_id_t iri_id_no);
extern caddr_t key_id_to_iri (query_instance_t * qi, iri_id_t iri_id_no);
extern int key_id_to_namespace_and_local (query_instance_t *qi, iri_id_t iid, caddr_t *subj_ns_ret, caddr_t *subj_loc_ret);
#define rdf_type_twobyte_to_iri(twobyte) nic_id_name (rdf_type_cache, (twobyte))
#define rdf_lang_twobyte_to_string(twobyte) nic_id_name (rdf_lang_cache, (twobyte))
/*! \returns NULL for string, (ccaddr_t)((ptrlong)1) for unsupported, 2 for NULL, UNAME for others */
extern caddr_t xsd_type_of_box (caddr_t arg);
/*! Casts \c new_val to some datatype appropriate for XPATH/XSLT and stores in an XSLT variable value or XQI slot passed as an address to free and set */
extern void rb_cast_to_xpath_safe (query_instance_t *qi, caddr_t new_val, caddr_t *retval_ptr);
#define BNODE_IID_TO_LABEL_BUFFER(buf,iid) (((iid) >= MIN_64BIT_BNODE_IRI_ID) ? \
  sprintf (buf, "nodeID://b" BOXINT_FMT, (boxint)((iid)-MIN_64BIT_BNODE_IRI_ID)) : \
  sprintf (buf, "nodeID://" BOXINT_FMT, (boxint)(iid)) )
#define BNODE_IID_TO_LABEL(iid) (((iid) >= MIN_64BIT_BNODE_IRI_ID) ? \
  box_sprintf (30, "nodeID://b" BOXINT_FMT, (boxint)((iid)-MIN_64BIT_BNODE_IRI_ID)) : \
  box_sprintf (30, "nodeID://" BOXINT_FMT, (boxint)(iid)) )
#define BNODE_IID_TO_LABEL_LOCAL(iid) (((iid) >= MIN_64BIT_BNODE_IRI_ID) ? \
  box_sprintf (30, "b" BOXINT_FMT, (boxint)((iid)-MIN_64BIT_BNODE_IRI_ID)) : \
  box_sprintf (30, BOXINT_FMT, (boxint)(iid)) )
#define BNODE_IID_TO_TTL_LABEL_LOCAL(iid) (((iid) >= MIN_64BIT_BNODE_IRI_ID) ? \
  box_sprintf (30, "vb" BOXINT_FMT, (boxint)((iid)-MIN_64BIT_BNODE_IRI_ID)) : \
  box_sprintf (30, "v" BOXINT_FMT, (boxint)(iid)) )
#define BNODE_IID_TO_TALIS_JSON_LABEL(iid) (((iid) >= MIN_64BIT_BNODE_IRI_ID) ? \
  box_sprintf (30, "_:vb" BOXINT_FMT, (boxint)((iid)-MIN_64BIT_BNODE_IRI_ID)) : \
  box_sprintf (30, "_:v" BOXINT_FMT, (boxint)(iid)) )


/* Set of callback to accept the stream of RDF quads that are grouped by graph and share blank node IDs */

#define TRIPLE_FEED_NEW_GRAPH	0
#define TRIPLE_FEED_NEW_BLANK	1
#define TRIPLE_FEED_GET_IID	2
#define TRIPLE_FEED_TRIPLE	3
#define TRIPLE_FEED_TRIPLE_L	4
#define TRIPLE_FEED_COMMIT	5
#define TRIPLE_FEED_MESSAGE	6
#define COUNTOF__TRIPLE_FEED__REQUIRED	7
#define TRIPLE_FEED_NEW_BASE	7
#define COUNTOF__TRIPLE_FEED__ALL	8

typedef struct triple_feed_s {
  query_instance_t *tf_qi;
  id_hash_t *tf_blank_node_ids;
  caddr_t *tf_app_env;		/*!< Environment for use by callbacks, owned by caller. It's "caddr_t *" instead of plain "caddr_t" because it's vector in most cases. */
  caddr_t tf_boxed_input_name;	/*!< URI or file name or other name of source, can be NULL, local */
  caddr_t tf_default_graph_uri;	/*!< Default graph uri, local */
  caddr_t tf_current_graph_uri;	/*!< Currently active graph uri, can be equal to tf_default_graph_uri, local */
  caddr_t tf_base_uri;		/*!< Base URI to resolve relative URIs, local */
  caddr_t tf_default_graph_iid;	/*!< Default graph iri ID, local */
  caddr_t tf_current_graph_iid;	/*!< Current graph iri ID, local */
  const char *tf_creator;	/*!< Name of BIF that created the feed (this name is printed in diagnostics) */
  ccaddr_t tf_cbk_names[COUNTOF__TRIPLE_FEED__ALL];	/*!< Callback names, owned by caller */
  query_t *tf_cbk_qrs[COUNTOF__TRIPLE_FEED__ALL];	/*!< Compiled callback queries, they can be NULLs for empty string names or names that starts with '!' */
  ptrlong tf_triple_count;	/*!< Number of triples that are sent to callbacks already, must be boxed before sending to SQL callbacks! */
  ptrlong tf_message_count;	/*!< Number of messages that are reported already, must be boxed before sending to SQL callbacks! */
  int *tf_line_no_ptr;		/*!< Pointer to some line number counter somewhere outside, may be NULL */
} triple_feed_t;

extern triple_feed_t *tf_alloc (void);
extern void tf_free (triple_feed_t *tf);
extern void tf_set_cbk_names (triple_feed_t *tf, ccaddr_t *cbk_names);
extern void tf_new_graph (triple_feed_t *tf, caddr_t uri);
extern caddr_t tf_get_iid (triple_feed_t *tf, caddr_t uri);
extern void tf_commit (triple_feed_t *tf);
extern void tf_triple (triple_feed_t *tf, caddr_t s_uri, caddr_t p_uri, caddr_t o_uri);
extern void tf_triple_l (triple_feed_t *tf, caddr_t s_uri, caddr_t p_uri, caddr_t obj_sqlval, caddr_t obj_datatype, caddr_t obj_language);
extern void tf_report (triple_feed_t *tf, char msg_type, const char *sqlstate, const char *sqlmore, const char *descr);
extern void tf_new_base (triple_feed_t *tf, caddr_t new_base);


#define TF_ONE_GRAPH_AT_TIME(tf) (NULL != (tf)->tf_cbk_names[TRIPLE_FEED_NEW_GRAPH])

#define TF_CHANGE_GRAPH(tf,new_uri) do { \
    if ((NULL != (tf)->tf_cbk_names[TRIPLE_FEED_NEW_GRAPH]) && (NULL != (tf)->tf_current_graph_uri)) \
      tf_commit ((tf)); \
    if ((tf)->tf_current_graph_uri != (tf)->tf_default_graph_uri) \
      dk_free_tree ((tf)->tf_current_graph_uri); \
    (tf)->tf_current_graph_uri = (new_uri); \
    (new_uri) = NULL; \
    if (TF_ONE_GRAPH_AT_TIME(tf)) { \
        dk_free_tree ((tf)->tf_current_graph_iid); \
        (tf)->tf_current_graph_iid = NULL; /* to avoid double free in case of error in tf_get_iid() below */ \
        (tf)->tf_current_graph_iid = tf_get_iid ((tf), (tf)->tf_current_graph_uri); \
        tf_new_graph ((tf), (tf)->tf_current_graph_uri); } \
  } while (0)

#define TF_CHANGE_GRAPH_TO_DEFAULT(tf) do { \
    if ((NULL != (tf)->tf_cbk_names[TRIPLE_FEED_NEW_GRAPH]) && (NULL != (tf)->tf_current_graph_uri)) \
      tf_commit ((tf)); \
    if ((tf)->tf_current_graph_uri != (tf)->tf_default_graph_uri) \
      dk_free_tree ((tf)->tf_current_graph_uri); \
    (tf)->tf_current_graph_uri = (tf)->tf_default_graph_uri; \
    if (NULL != (tf)->tf_cbk_names[TRIPLE_FEED_NEW_GRAPH]) { \
        dk_free_tree ((tf)->tf_current_graph_iid); \
        if (TF_ONE_GRAPH_AT_TIME(tf)) { \
            (tf)->tf_current_graph_iid = NULL; /* to avoid double free in case of error in tf_get_iid() below */ \
            (tf)->tf_default_graph_iid = tf_get_iid ((tf), (tf)->tf_default_graph_uri); } \
        (tf)->tf_current_graph_iid = box_copy ((tf)->tf_default_graph_iid); \
        tf_new_graph ((tf), (tf)->tf_current_graph_uri); } \
  } while (0)

#define TF_CHANGE_BASE_AND_DEFAULT_GRAPH(tf,new_uri) do { \
    if (NULL != (tf)->tf_cbk_names[TRIPLE_FEED_NEW_BASE]) \
      tf_new_base ((tf),(new_uri)); \
    else { \
        dk_free_box ((tf)->tf_base_uri); (tf)->tf_base_uri = (new_uri); } \
  } while (0)

#define TF_GRAPH_ARG(tf) ((TF_ONE_GRAPH_AT_TIME((tf))) ? &((tf)->tf_current_graph_iid) : &(tf->tf_current_graph_uri))

#define TTLP_STRING_MAY_CONTAIN_CRLF	0x0001	/*!< Single quoted and double quoted strings may contain newlines. */
#define TTLP_VERB_MAY_BE_BLANK		0x0002	/*!< Allows bnode predicates (but SPARQL processor may ignore them!) */
#define TTLP_ACCEPT_VARIABLES		0x0004	/*!< Allows variables, but triples with variables are ignored. */
#define TTLP_SKIP_LITERAL_SUBJECTS	0x0008	/*!< Allows literal subjects, but triples with them are ignored. */
#define TTLP_NAME_MAY_CONTAIN_PATH	0x0010	/*!< Allows '/', '#', '%' and '+' in local part of QName ("Qname with path") */
#define TTLP_ACCEPT_DIRTY_NAMES		0x0020	/*!< Allows ill bnode labels and invalid symbols between '<' and '>', i.e. in relative IRIs. */
#define TTLP_ACCEPT_DIRTY_SYNTAX	0x0040	/*!< Relax TURTLE syntax to include popular violations. */
#define TTLP_ERROR_RECOVERY		0x0080	/*!< Try to recover from lexical errors as much as it is possible. */
#define TTLP_ALLOW_TRIG			0x0100	/*!< Allows TriG syntax, thus loading data in more than one graph. */
#define TTLP_ALLOW_NQUAD		0x0200	/*!< Enables NQuads syntax but disables TURTLE and TriG */
#define TTLP_DEBUG_BNODES		0x1000	/*!< Add virtrdf:bnode-base, virtrdf:bnode-row and virtrdf:bnode-label triples for every created blank node. */

#define TTLP_ALLOW_QNAME_A		0x01
#define TTLP_ALLOW_QNAME_HAS		0x02
#define TTLP_ALLOW_QNAME_IS		0x04
#define TTLP_ALLOW_QNAME_OF		0x08
#define TTLP_ALLOW_QNAME_THIS		0x10

typedef struct ttlp_s
{
  /* inputs */
  const char *ttlp_text;	/*!< Full source text, if short, or the beginning of long text, or an empty string */
  int ttlp_text_len;		/*!< Length of \c ttlp_text */
  int ttlp_text_ofs;		/*!< Current position in \c ttlp_text */
  xml_read_func_t ttlp_iter;
  xml_read_abend_func_t ttlp_iter_abend;
  void *ttlp_iter_data;
  encoding_handler_t *ttlp_enc;	/*!< Encoding of the source */
  long ttlp_flags;		/*!< TTLP_xxx Flags for dirty load, enabling TriG or NQuad, debugging */
  /* lexer */
  int ttlp_lexlineno;		/*!< Current line number */
  int ttlp_lexdepth;		/*!< Current number of not-yet-closed parenthesis */
  const char *ttlp_raw_text;	/*!< Raw text of the lexem */
  ptrlong ttlp_special_qnames;	/*!< Bitmask where every bit means that the identifier in qname, not a keyword */
  /* parser */
  const char *ttlp_err_hdr;	/*!< Human-readable phrase that gives a name to the parsing routine, e.g. "Turtle parser of web crawler" */
  caddr_t ttlp_catched_error;	/*!< The error that stopped the processing, as a three-element vector made by srv_make_new_error () */
  caddr_t ttlp_default_ns_uri;	/*!< IRI associated with ':' prefix */
  id_hash_t *ttlp_namespaces_prefix2iri;	/*!< A hashtable of namespace prefixes (keys) and IRIs (values) */
  dk_set_t ttlp_saved_uris;	/*!< Stack that keeps URIs. YACC stack is not used to let us free memory on error */
  dk_set_t ttlp_unused_seq_bnodes;	/*!< A list of bnodes that were allocated for use in lists but not used because lists are terminated before use */
  caddr_t ttlp_base_uri;		/*!< Base URI used to resolve relative URIs of the document and optionally to resolve the relative URI of the graph in "graph CRUD" endpoint */
  caddr_t ttlp_last_complete_uri;	/*!< Last \c QNAME or \c Q_IRI_REF that is expanded and resolved if needed */
  caddr_t ttlp_subj_uri;	/*!< Current subject URI, but it become object URI if ttlp_pred_is_reverse */
  caddr_t ttlp_pred_uri;	/*!< Current predicate URI */
  caddr_t ttlp_obj;		/*!< Current object URI or value */
  caddr_t ttlp_obj_type;	/*!< Current object type URI */
  caddr_t ttlp_obj_lang;	/*!< Current object language mark */
  int ttlp_pred_is_reverse;	/*!< Flag if ttlp_pred_uri is used as reverse, e.g. in 'O is P of S' syntax */
  caddr_t ttlp_formula_iid;	/*!< IRI ID of the blank node of the formula ( '{ ... }' notation of N3 */
  int ttlp_in_trig_graph;	/*!< The parser is inside TriG graph so \c ttlp_inner_namespaces_prefix2iri is in use etc. */
  id_hash_t *ttlp_inner_namespaces_prefix2iri;	/*!< An equivalent of \c ttlp_namespaces_prefix2iri for prefixes defined inside TriG block */
  caddr_t ttlp_default_ns_uri_saved;	/*!< In TriG, @prefix can be used inside the graph block, in that case global \c ttlp_default_ns_uri is temporarily saved here */
  caddr_t ttlp_base_uri_saved;	/*!< In TriG, @base can be used inside the graph block, in that case global \c ttlp_base_uri is temporarily saved here */
  /* feeder */
  triple_feed_t *ttlp_tf;
} ttlp_t;


extern ttlp_t *ttlp_alloc (void);
extern void ttlp_enter_trig_group (ttlp_t *ttlp);
extern void ttlp_leave_trig_group (ttlp_t *ttlp);
extern void ttlp_free (ttlp_t *ttlp);

extern caddr_t rdf_load_turtle (
  caddr_t text_or_filename, int arg1_is_filename, caddr_t base_uri, caddr_t graph_uri, long flags,
  ccaddr_t *cbk_names, caddr_t *app_env,
  query_instance_t *qi, wcharset_t *query_charset, caddr_t *err_ret );

#ifndef YY_TYPEDEF_YY_SCANNER_T
#define YY_TYPEDEF_YY_SCANNER_T
typedef void* yyscan_t;
#endif

extern int ttlyyparse (ttlp_t *ttlp_arg, yyscan_t scanner);
extern int nqyyparse (ttlp_t *ttlp_arg, yyscan_t scanner);
extern void ttlyyerror_impl (ttlp_t *ttlp_arg, const char *raw_text, const char *strg);
extern void ttlyyerror_impl_1 (ttlp_t *ttlp_arg, const char *raw_text, int yystate, short *yyssa, short *yyssp, const char *strg);

extern ptrlong ttlp_bit_of_special_qname (caddr_t qname);
extern caddr_t DBG_NAME (ttlp_expand_qname_prefix) (DBG_PARAMS ttlp_t *ttlp_arg, caddr_t qname);
extern caddr_t DBG_NAME (tf_bnode_iid) (DBG_PARAMS triple_feed_t *tf, caddr_t boxed_sparyytext);
extern caddr_t DBG_NAME (tf_formula_bnode_iid) (DBG_PARAMS ttlp_t *ttlp_arg, caddr_t boxed_sparyytext);
#ifdef MALLOC_DEBUG
#define ttlp_expand_qname_prefix(ttlp,qname) DBG_NAME (ttlp_expand_qname_prefix) (__FILE__, __LINE__, (ttlp), (qname))
#define tf_bnode_iid(tf, boxed_sparyytext) DBG_NAME (tf_bnode_iid) (__FILE__, __LINE__, (tf), (boxed_sparyytext))
#define tf_formula_bnode_iid(ttlp,boxed_sparyytext) DBG_NAME (tf_formula_bnode_iid) (__FILE__, __LINE__, (ttlp), (boxed_sparyytext))
#endif
extern caddr_t ttlp_uri_resolve (ttlp_t *ttlp_arg, caddr_t qname);

/* Numeric values of these constants are important, do not alter them. They are used in tricky way. */
#define TTLP_STRLITERAL_LTGT 		0x10
#define TTLP_STRLITERAL_QUOT 		0x11
#define TTLP_STRLITERAL_QUOT_AT		0x21
#define TTLP_STRLITERAL_3QUOT 		0x31
#define TTLP_STRLITERAL_3QUOT_AT	0x41
extern caddr_t ttlp_strliteral (ttlp_t *ttlp_arg, const char *sparyytext, int mode, char delimiter);
extern caddr_t ttl_lex_analyze (caddr_t str, int mode_bits, wcharset_t *query_charset);

extern void ttlp_triple_and_inf (ttlp_t *ttlp_arg, caddr_t o_uri);
extern void ttlp_triple_l_and_inf (ttlp_t *ttlp_arg, caddr_t o_sqlval, caddr_t o_dt, caddr_t o_lang);
extern void ttlp_triples_for_bnodes_debug (ttlp_t *ttlp_arg, caddr_t bnode_iid, int lineno, caddr_t label);

#define RDFXML_COMPLETE		0
#define RDFXML_OMIT_TOP_RDF	1
#define RDFXML_IN_ATTRIBUTES	2
#define RDFXML_IN_MDATA		4

extern void
rdfxml_parse (query_instance_t * qi, caddr_t text, caddr_t *err_ret,
  int mode_bits, const char *source_name, caddr_t base_uri, caddr_t graph_uri,
  ccaddr_t *stmt_texts, caddr_t *app_env,
  const char *enc, lang_handler_t *lh
   /*, caddr_t dtd_config, dtd_t **ret_dtd,
   id_hash_t **ret_id_cache, xml_ns_2dict_t *ret_ns_2dict*/ );

/* Metadata about free-text index on DB.DBA.RDF_OBJ. We're keeping two similar hashtables but one has IRI_IDs as keys and other has strings. */
extern id_hash_t *rdf_obj_ft_rules_by_iids;
extern id_hash_t *rdf_obj_ft_rules_by_iris;

extern int uriqa_dynamic_local;
extern caddr_t uriqa_get_host_for_dynamic_local (client_connection_t *qi, int * is_https);
extern caddr_t uriqa_get_default_for_connvar (query_instance_t *qi, const char *varname);
/*!< checks whether the given \c iri starts with the http://default-host , returns zero if not or number of leading chars to cut the local part. */
extern int uriqa_iri_is_local (query_instance_t *qi, const char *iri);

#define RDF_GRAPH_PERM_READ 0x01
#define RDF_GRAPH_PERM_WRITE 0x02
#define RDF_GRAPH_PERM_SPONGE 0x04
#define RDF_GRAPH_PERM_LIST 0x08
#define RDF_GRAPH_PERM_DEFAULT (RDF_GRAPH_PERM_READ | RDF_GRAPH_PERM_WRITE | RDF_GRAPH_PERM_SPONGE | RDF_GRAPH_PERM_LIST)

extern id_hash_t *rdf_graph_iri2id_dict_htable;		/*!< Dictionary of IRI_IDs of IRIs of graphs mentioned in graph-level security config, IRI UNAMEs are keys, boxed IRI_IDs are values */
extern id_hash_iterator_t *rdf_graph_iri2id_dict_hit;	/*!< Hash iterator for \c rdf_graph_iri2id_dict_hit */
extern id_hash_t *rdf_graph_id2iri_dict_htable;		/*!< Dictionary of IRIs of IRI_IDs of graphs mentioned in graph-level security config, boxed IRI_IDs are keys, IRI UNAMEs are values */
extern id_hash_iterator_t *rdf_graph_id2iri_dict_hit;	/*!< Hash iterator for \c rdf_graph_id2irid_dict_hit */
extern id_hash_t *rdf_graph_group_dict_htable;		/*!< Dictionary of graph group members: group IID is key, vector of member IIDs is value */
extern id_hash_iterator_t *rdf_graph_group_dict_hit;	/*!< Hash iterator for \c rdf_graph_group_dict_htable */
extern id_hash_t *rdf_graph_public_perms_dict_htable;		/*!< Dictionary of public permissions for graphs: graph/group IID is key, copy of DB.DBA.RDF_GRAPH_USER.RGU_PERMISSIONS is a value */
extern id_hash_iterator_t *rdf_graph_public_perms_dict_hit;	/*!< Hash iterator for \c rdf_graph_group_dict_htable */
extern id_hash_t *rdf_graph_group_of_privates_dict_htable;		/*!< Dictionary of private graphs, to accelerate the access to content of virtrdf:PrivateGraphs */
extern id_hash_iterator_t *rdf_graph__of_privates_dict_hit;	/*!< Hash iterator for \c rdf_graph_group_of_privates_dict_htable */
extern id_hash_t *rdf_graph_default_world_perms_of_user_dict_htable;		/*!< Dictionary of default permissions for users: user ID is key, copy of DB.DBA.RDF_GRAPH_USER.RGU_PERMISSIONS for #0 is a value */
extern id_hash_iterator_t *rdf_graph_default_world_perms_of_user_dict_hit;	/*!< Hash iterator for \c rdf_graph_default_world_perms_of_user_dict_htable */
extern id_hash_t *rdf_graph_default_private_perms_of_user_dict_htable;		/*!< Dictionary of default permissions for users: user ID is key, copy of DB.DBA.RDF_GRAPH_USER.RGU_PERMISSIONS for #0 is a value */
extern id_hash_iterator_t *rdf_graph_default_private_perms_of_user_dict_hit;	/*!< Hash iterator for \c rdf_graph_default_private_perms_of_user_dict_htable */
extern id_hash_t *rdf_graph_default_private_perms_of_user_dict_htable;		/*!< Dictionary of default permissions for users: user ID is key, copy of DB.DBA.RDF_GRAPH_USER.RGU_PERMISSIONS for #0 is a value */
extern id_hash_iterator_t *rdf_graph_default_private_perms_of_user_dict_hit;	/*!< Hash iterator for \c rdf_graph_default_private_perms_of_user_dict_htable */

extern caddr_t boxed_zero_iid;
extern caddr_t boxed_one_iid;
extern caddr_t boxed_nobody_uid;

caddr_t iri_ensure (caddr_t * qst, caddr_t name, int flag, caddr_t * err_ret);
void rdf_graph_keyword (iri_id_t id, char *ret);
extern caddr_t uriqa_dynamic_local_replace_nocheck (caddr_t name, client_connection_t * cli);
#define uriqa_dynamic_local_replace(name, cli) \
  (strncmp ((name), "local:", 6) ? (name) : uriqa_dynamic_local_replace_nocheck ((name), (cli)))

/* if rb content longer than this, use md5 in rdf_obj table key */
#define RB_BOX_HASH_MIN_LEN 50


#endif