1/* -*- Mode: c; c-basic-offset: 2 -*-
2 *
3 * rdf_parser.h - RDF Parser Factory / Parser interfaces and definition
4 *
5 * Copyright (C) 2000-2009, David Beckett http://www.dajobe.org/
6 * Copyright (C) 2000-2005, University of Bristol, UK http://www.bristol.ac.uk/
7 *
8 * This package is Free Software and part of Redland http://librdf.org/
9 *
10 * It is licensed under the following three licenses as alternatives:
11 * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
12 * 2. GNU General Public License (GPL) V2 or any newer version
13 * 3. Apache License, V2.0 or any newer version
14 *
15 * You may not use this file except in compliance with at least one of
16 * the above three licenses.
17 *
18 * See LICENSE.html or LICENSE.txt at the top of this package for the
19 * complete terms and further detail along with the license texts for
20 * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively.
21 *
22 *
23 */
24
25
26
27#ifndef LIBRDF_PARSER_H
28#define LIBRDF_PARSER_H
29
30#ifdef LIBRDF_INTERNAL
31#include <rdf_parser_internal.h>
32#endif
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38/* class methods */
39REDLAND_API
40void librdf_parser_register_factory(librdf_world *world, const char *name, const char *label, const char *mime_type, const unsigned char *uri_string, void (*factory) (librdf_parser_factory*));
41
42REDLAND_API REDLAND_DEPRECATED
43int librdf_parser_enumerate(librdf_world* world, const unsigned int counter, const char **name, const char **label);
44REDLAND_API
45const raptor_syntax_description* librdf_parser_get_description(librdf_world* world, unsigned int counter);
46REDLAND_API
47int librdf_parser_check_name(librdf_world* world, const char *name);
48
49/* constructor */
50REDLAND_API
51librdf_parser* librdf_new_parser(librdf_world* world, const char *name, const char *mime_type, librdf_uri *type_uri);
52REDLAND_API
53librdf_parser* librdf_new_parser_from_factory(librdf_world* world, librdf_parser_factory *factory);
54
55/* destructor */
56REDLAND_API
57void librdf_free_parser(librdf_parser *parser);
58
59
60/* methods */
61REDLAND_API
62librdf_stream* librdf_parser_parse_as_stream(librdf_parser* parser, librdf_uri* uri, librdf_uri* base_uri);
63REDLAND_API
64int librdf_parser_parse_into_model(librdf_parser* parser, librdf_uri* uri, librdf_uri* base_uri, librdf_model* model);
65REDLAND_API
66librdf_stream* librdf_parser_parse_string_as_stream(librdf_parser* parser, const unsigned char* string, librdf_uri* base_uri);
67REDLAND_API
68int librdf_parser_parse_string_into_model(librdf_parser* parser, const unsigned char *string, librdf_uri* base_uri, librdf_model* model);
69REDLAND_API
70librdf_stream* librdf_parser_parse_iostream_as_stream(librdf_parser* parser, raptor_iostream *iostream, librdf_uri* base_uri);
71REDLAND_API
72int librdf_parser_parse_iostream_into_model(librdf_parser* parser, raptor_iostream *iostream, librdf_uri* base_uri, librdf_model* model);
73REDLAND_API
74librdf_stream* librdf_parser_parse_file_handle_as_stream(librdf_parser* parser, FILE* fh, int close_fh, librdf_uri* base_uri);
75REDLAND_API
76int librdf_parser_parse_file_handle_into_model(librdf_parser* parser, FILE *fh, int close_fh, librdf_uri* base_uri, librdf_model* model);
77REDLAND_API REDLAND_DEPRECATED
78void librdf_parser_set_error(librdf_parser* parser, void *user_data, void (*error_fn)(void *user_data, const char *msg, ...));
79REDLAND_API REDLAND_DEPRECATED
80void librdf_parser_set_warning(librdf_parser* parser, void *user_data, void (*warning_fn)(void *user_data, const char *msg, ...));
81REDLAND_API
82librdf_stream* librdf_parser_parse_counted_string_as_stream(librdf_parser* parser, const unsigned char *string, size_t length, librdf_uri* base_uri);
83REDLAND_API
84int librdf_parser_parse_counted_string_into_model(librdf_parser* parser, const unsigned char *string, size_t length, librdf_uri* base_uri, librdf_model* model);
85REDLAND_API
86void librdf_parser_set_uri_filter(librdf_parser* parser, librdf_uri_filter_func filter, void* user_data);
87REDLAND_API
88librdf_uri_filter_func librdf_parser_get_uri_filter(librdf_parser* parser, void** user_data_p);
89
90/**
91 * LIBRDF_PARSER_FEATURE_ERROR_COUNT:
92 *
93 * Parser feature URI string for getting the error count of the last parse.
94 */
95#define LIBRDF_PARSER_FEATURE_ERROR_COUNT "http://feature.librdf.org/parser-error-count"
96
97/**
98 * LIBRDF_PARSER_FEATURE_WARNING_COUNT:
99 *
100 * Parser feature URI string for getting the warning count of the last parse.
101 */
102#define LIBRDF_PARSER_FEATURE_WARNING_COUNT "http://feature.librdf.org/parser-warning-count"
103
104REDLAND_API
105librdf_node* librdf_parser_get_feature(librdf_parser* parser, librdf_uri *feature);
106REDLAND_API
107int librdf_parser_set_feature(librdf_parser* parser, librdf_uri* feature, librdf_node* value);
108REDLAND_API
109char* librdf_parser_get_accept_header(librdf_parser* parser);
110REDLAND_API REDLAND_DEPRECATED
111const char* librdf_parser_guess_name(const char *mime_type, const unsigned char *buffer, const unsigned char *identifier);
112REDLAND_API
113const char* librdf_parser_guess_name2(librdf_world* world, const char *mime_type, const unsigned char *buffer, const unsigned char *identifier);
114REDLAND_API
115const char* librdf_parser_get_namespaces_seen_prefix(librdf_parser* parser, int offset);
116REDLAND_API
117librdf_uri* librdf_parser_get_namespaces_seen_uri(librdf_parser* parser, int offset);
118REDLAND_API
119int librdf_parser_get_namespaces_seen_count(librdf_parser* parser);
120
121#ifdef __cplusplus
122}
123#endif
124
125#endif
126