| Redland RDF Library Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
typedef librdf_parser; typedef librdf_parser_factory; int librdf_parser_check_name (librdf_world *world,const char *name); const raptor_syntax_description * librdf_parser_get_description (librdf_world *world,unsigned int counter); int librdf_parser_enumerate (librdf_world *world,const unsigned int counter,const char **name,const char **label); const char * librdf_parser_guess_name (const char *mime_type,const unsigned char *buffer,const unsigned char *identifier); const char * librdf_parser_guess_name2 (librdf_world *world,const char *mime_type,const unsigned char *buffer,const unsigned char *identifier); void 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*)); librdf_parser * librdf_new_parser (librdf_world *world,const char *name,const char *mime_type,librdf_uri *type_uri); librdf_parser * librdf_new_parser_from_factory (librdf_world *world,librdf_parser_factory *factory); void librdf_free_parser (librdf_parser *parser); librdf_stream * librdf_parser_parse_as_stream (librdf_parser *parser,librdf_uri *uri,librdf_uri *base_uri); int librdf_parser_parse_into_model (librdf_parser *parser,librdf_uri *uri,librdf_uri *base_uri,librdf_model *model); librdf_stream * librdf_parser_parse_file_handle_as_stream (librdf_parser *parser,FILE *fh,int close_fh,librdf_uri *base_uri); int librdf_parser_parse_file_handle_into_model (librdf_parser *parser,FILE *fh,int close_fh,librdf_uri *base_uri,librdf_model *model); librdf_stream * librdf_parser_parse_string_as_stream (librdf_parser *parser,const unsigned char *string,librdf_uri *base_uri); int librdf_parser_parse_string_into_model (librdf_parser *parser,const unsigned char *string,librdf_uri *base_uri,librdf_model *model); void librdf_parser_set_error (librdf_parser *parser,void *user_data,void (*error_fn) (void *user_data, const char *msg, ...)); void librdf_parser_set_warning (librdf_parser *parser,void *user_data,void (*warning_fn) (void *user_data, const char *msg, ...)); librdf_stream * librdf_parser_parse_counted_string_as_stream (librdf_parser *parser,const unsigned char *string,size_t length,librdf_uri *base_uri); int librdf_parser_parse_counted_string_into_model (librdf_parser *parser,const unsigned char *string,size_t length,librdf_uri *base_uri,librdf_model *model); librdf_stream * librdf_parser_parse_iostream_as_stream (librdf_parser *parser,raptor_iostream *iostream,librdf_uri *base_uri); int librdf_parser_parse_iostream_into_model (librdf_parser *parser,raptor_iostream *iostream,librdf_uri *base_uri,librdf_model *model); #define LIBRDF_PARSER_FEATURE_ERROR_COUNT #define LIBRDF_PARSER_FEATURE_WARNING_COUNT librdf_node * librdf_parser_get_feature (librdf_parser *parser,librdf_uri *feature); int librdf_parser_set_feature (librdf_parser *parser,librdf_uri *feature,librdf_node *value); char * librdf_parser_get_accept_header (librdf_parser *parser); int librdf_parser_get_namespaces_seen_count (librdf_parser *parser); const char * librdf_parser_get_namespaces_seen_prefix (librdf_parser *parser,int offset); librdf_uri * librdf_parser_get_namespaces_seen_uri (librdf_parser *parser,int offset); librdf_uri_filter_func librdf_parser_get_uri_filter (librdf_parser *parser,void **user_data_p); void librdf_parser_set_uri_filter (librdf_parser *parser,librdf_uri_filter_func filter,void *user_data);
Provides classes to create parsers and parse syntaxes from URIs or a string into RDF graphs (librdf_model) or sequences of triples (librdf_stream). Parser features can be set, which are passed down to Raptor and errors and warnings that are returned can be retrieved by callbacks.
typedef struct librdf_parser_factory_s librdf_parser_factory;
Redland parser factory class.
int librdf_parser_check_name (librdf_world *world,const char *name);
Check if a parser name is known
|
redland world object |
|
name of parser |
Returns : |
non 0 if name is a known parser |
const raptor_syntax_description * librdf_parser_get_description (librdf_world *world,unsigned int counter);
Get parser descriptive syntax information
|
world object |
|
index into the list of parsers |
Returns : |
description or NULL if counter is out of range |
int librdf_parser_enumerate (librdf_world *world,const unsigned int counter,const char **name,const char **label);
Get information on parsers.
Deprecated: use librdf_parser_get_description() to return more information in a static structure.
|
redland world object |
|
index into the list of parsers |
|
pointer to store the name of the parser (or NULL) |
|
pointer to store syntax readable label (or NULL) |
Returns : |
non 0 on failure of if counter is out of range |
const char * librdf_parser_guess_name (const char *mime_type,const unsigned char *buffer,const unsigned char *identifier);
Get a parser name for content with type or identifier
|
MIME type of syntax or NULL |
|
content buffer or NULL |
|
content identifier or NULL |
Returns : |
a parser name or NULL if nothing was guessable |
const char * librdf_parser_guess_name2 (librdf_world *world,const char *mime_type,const unsigned char *buffer,const unsigned char *identifier);
Get a parser name for content with type or identifier
|
librdf_world object |
|
MIME type of syntax or NULL |
|
content buffer or NULL |
|
content identifier or NULL |
Returns : |
a parser name or NULL if nothing was guessable |
void 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*));
Register a parser factory .
|
redland world object |
|
the name of the parser |
|
the label of the parser (optional) |
|
MIME type of the syntax (optional) |
|
URI of the syntax (optional) |
|
function to be called to register the factor parameters |
librdf_parser * librdf_new_parser (librdf_world *world,const char *name,const char *mime_type,librdf_uri *type_uri);
Constructor - create a new librdf_parser object.
If all fields are NULL, this means any parser supporting MIME Type "application/rdf+xml"
|
redland world object |
|
the parser factory name (or NULL or empty string if don't care) |
|
the MIME type of the syntax (NULL if not used) |
|
URI of syntax (NULL if not used) |
Returns : |
new librdf_parser object or NULL |
librdf_parser * librdf_new_parser_from_factory (librdf_world *world,librdf_parser_factory *factory);
Constructor - create a new librdf_parser object.
|
redland world object |
|
the parser factory to use to create this parser |
Returns : |
new librdf_parser object or NULL |
void librdf_free_parser (librdf_parser *parser);
Destructor - destroys a librdf_parser object.
|
the parser |
librdf_stream * librdf_parser_parse_as_stream (librdf_parser *parser,librdf_uri *uri,librdf_uri *base_uri);
Parse a URI to a librdf_stream of statements.
|
the parser |
|
the URI to read |
|
the base URI to use or NULL |
Returns : |
librdf_stream of statements or NULL |
int librdf_parser_parse_into_model (librdf_parser *parser,librdf_uri *uri,librdf_uri *base_uri,librdf_model *model);
Parse a URI of content into an librdf_model.
|
the parser |
|
the URI to read the content |
|
the base URI to use or NULL |
|
the model to use |
Returns : |
non 0 on failure |
librdf_stream * librdf_parser_parse_file_handle_as_stream (librdf_parser *parser,FILE *fh,int close_fh,librdf_uri *base_uri);
Parse a FILE* handle of content to a librdf_stream of statements.
|
the parser |
|
FILE* to read content source |
|
non-0 to fclose() the file handle on finishing |
|
the base URI to use (or NULL) |
Returns : |
librdf_stream of statements or NULL |
int librdf_parser_parse_file_handle_into_model (librdf_parser *parser,FILE *fh,int close_fh,librdf_uri *base_uri,librdf_model *model);
Parse a FILE* handle of content into an librdf_model.
|
the parser |
|
FILE* to read content source |
|
non-0 to fclose() the file handle on finishing |
|
the base URI to use (or NULL) |
|
the model to write to |
Returns : |
non 0 on failure |
librdf_stream * librdf_parser_parse_string_as_stream (librdf_parser *parser,const unsigned char *string,librdf_uri *base_uri);
Parse a string of content to a librdf_stream of statements.
|
the parser |
|
the string to parse |
|
the base URI to use or NULL |
Returns : |
librdf_stream of statements or NULL |
int librdf_parser_parse_string_into_model (librdf_parser *parser,const unsigned char *string,librdf_uri *base_uri,librdf_model *model);
Parse a string of content into an librdf_model.
|
the parser |
|
the content to parse |
|
the base URI to use or NULL |
|
the model to use |
Returns : |
non 0 on failure |
void librdf_parser_set_error (librdf_parser *parser,void *user_data,void (*error_fn) (void *user_data, const char *msg, ...));
Deprecated: Does nothing
Set the parser error handling function.
|
the parser |
|
user data to pass to function |
|
pointer to the function |
void librdf_parser_set_warning (librdf_parser *parser,void *user_data,void (*warning_fn) (void *user_data, const char *msg, ...));
Deprecated: Does nothing.
Set the parser warning handling function.
|
the parser |
|
user data to pass to function |
|
pointer to the function |
librdf_stream * librdf_parser_parse_counted_string_as_stream (librdf_parser *parser,const unsigned char *string,size_t length,librdf_uri *base_uri);
Parse a counted string of content to a librdf_stream of statements.
|
the parser |
|
the string to parse |
|
length of the string content (must be >0) |
|
the base URI to use or NULL |
Returns : |
librdf_stream of statements or NULL |
int librdf_parser_parse_counted_string_into_model (librdf_parser *parser,const unsigned char *string,size_t length,librdf_uri *base_uri,librdf_model *model);
Parse a counted string of content into an librdf_model.
|
the parser |
|
the content to parse |
|
length of content (must be >0) |
|
the base URI to use or NULL |
|
the model to use |
Returns : |
non 0 on failure |
librdf_stream * librdf_parser_parse_iostream_as_stream (librdf_parser *parser,raptor_iostream *iostream,librdf_uri *base_uri);
Parse an iostream of content to a librdf_stream of statements.
|
the parser |
|
the iostream to parse |
|
the base URI to use or NULL |
Returns : |
librdf_stream of statements or NULL |
int librdf_parser_parse_iostream_into_model (librdf_parser *parser,raptor_iostream *iostream,librdf_uri *base_uri,librdf_model *model);
Parse a iostream of content into an librdf_model.
|
the parser |
|
the content to parse |
|
the base URI to use or NULL |
|
the model to use |
Returns : |
non 0 on failure |
#define LIBRDF_PARSER_FEATURE_ERROR_COUNT "http://feature.librdf.org/parser-error-count"
Parser feature URI string for getting the error count of the last parse.
#define LIBRDF_PARSER_FEATURE_WARNING_COUNT "http://feature.librdf.org/parser-warning-count"
Parser feature URI string for getting the warning count of the last parse.
librdf_node * librdf_parser_get_feature (librdf_parser *parser,librdf_uri *feature);
Get the value of a parser feature.
|
librdf_parser object |
|
librdf_Uuri feature property |
Returns : |
new librdf_node feature value or NULL if no such feature exists or the value is empty. |
int librdf_parser_set_feature (librdf_parser *parser,librdf_uri *feature,librdf_node *value);
Set the value of a parser feature.
|
librdf_parser object |
|
librdf_uri feature property |
|
librdf_node feature property value |
Returns : |
non 0 on failure (negative if no such feature) |
char * librdf_parser_get_accept_header (librdf_parser *parser);
Get an HTTP Accept value for the parser.
The returned string must be freed by the caller such as with
raptor_free_memory().
|
parser |
Returns : |
a new Accept: header string or NULL on failure |
int librdf_parser_get_namespaces_seen_count
(librdf_parser *parser);
Get the number of namespaces seen during parsing
|
librdf_parser object |
Returns : |
uri or NULL if no such namespace uri |
const char * librdf_parser_get_namespaces_seen_prefix (librdf_parser *parser,int offset);
Get the prefix of namespaces seen during parsing
|
librdf_parser object |
|
index into list of namespaces |
Returns : |
prefix or NULL if no such namespace prefix |
librdf_uri * librdf_parser_get_namespaces_seen_uri (librdf_parser *parser,int offset);
Get the uri of namespaces seen during parsing
|
librdf_parser object |
|
index into list of namespaces |
Returns : |
uri or NULL if no such namespace uri |
librdf_uri_filter_func librdf_parser_get_uri_filter (librdf_parser *parser,void **user_data_p);
Get the current URI filter function for retrieval during parsing.
|
librdf_parser object |
|
Pointer to user data to return |
Returns : |
current URI filter function |
void librdf_parser_set_uri_filter (librdf_parser *parser,librdf_uri_filter_func filter,void *user_data);
Set URI filter function for retrieval during parsing.
|
librdf_parser object |
|
URI filter function |
|
User data to pass to filter function |