Redland RDF Library Manual | ||||
---|---|---|---|---|
Top | Description |
typedef librdf_serializer; typedef librdf_serializer_factory; const raptor_syntax_description * librdf_serializer_get_description (librdf_world *world
,unsigned int counter
); int librdf_serializer_enumerate (librdf_world *world
,const unsigned int counter
,const char **name
,const char **label
); void librdf_serializer_register_factory (librdf_world *world
,const char *name
,const char *label
,const char *mime_type
,const unsigned char *uri_string
,void (*factory) (librdf_serializer_factory*)
); librdf_serializer * librdf_new_serializer (librdf_world *world
,const char *name
,const char *mime_type
,librdf_uri *type_uri
); librdf_serializer * librdf_new_serializer_from_factory (librdf_world *world
,librdf_serializer_factory *factory
); void librdf_free_serializer (librdf_serializer *serializer
); int librdf_serializer_check_name (librdf_world *world
,const char *name
); int librdf_serializer_serialize_model (librdf_serializer *serializer
,FILE *handle
,librdf_uri *base_uri
,librdf_model *model
); int librdf_serializer_serialize_model_to_file_handle (librdf_serializer *serializer
,FILE *handle
,librdf_uri *base_uri
,librdf_model *model
); int librdf_serializer_serialize_model_to_file (librdf_serializer *serializer
,const char *name
,librdf_uri *base_uri
,librdf_model *model
); unsigned char * librdf_serializer_serialize_model_to_string (librdf_serializer *serializer
,librdf_uri *base_uri
,librdf_model *model
); unsigned char * librdf_serializer_serialize_model_to_counted_string (librdf_serializer *serializer
,librdf_uri *base_uri
,librdf_model *model
,size_t *length_p
); int librdf_serializer_serialize_model_to_iostream (librdf_serializer *serializer
,librdf_uri *base_uri
,librdf_model *model
,raptor_iostream *iostr
); unsigned char * librdf_serializer_serialize_stream_to_counted_string (librdf_serializer *serializer
,librdf_uri *base_uri
,librdf_stream *stream
,size_t *length_p
); int librdf_serializer_serialize_stream_to_file (librdf_serializer *serializer
,const char *name
,librdf_uri *base_uri
,librdf_stream *stream
); int librdf_serializer_serialize_stream_to_file_handle (librdf_serializer *serializer
,FILE *handle
,librdf_uri *base_uri
,librdf_stream *stream
); int librdf_serializer_serialize_stream_to_iostream (librdf_serializer *serializer
,librdf_uri *base_uri
,librdf_stream *stream
,raptor_iostream *iostr
); unsigned char * librdf_serializer_serialize_stream_to_string (librdf_serializer *serializer
,librdf_uri *base_uri
,librdf_stream *stream
); void librdf_serializer_set_error (librdf_serializer *serializer
,void *user_data
,void (*error_fn) (void *user_data, const char *msg, ...)
); void librdf_serializer_set_warning (librdf_serializer *serializer
,void *user_data
,void (*warning_fn) (void *user_data, const char *msg, ...)
); librdf_node * librdf_serializer_get_feature (librdf_serializer *serializer
,librdf_uri *feature
); int librdf_serializer_set_feature (librdf_serializer *serializer
,librdf_uri *feature
,librdf_node *value
); int librdf_serializer_set_namespace (librdf_serializer *serializer
,librdf_uri *uri
,const char *prefix
);
Provides class to create serializers to turn RDF graphs into syntax in either files or strings. Serializer 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_serializer_factory_s librdf_serializer_factory;
Redland serializer factory class.
const raptor_syntax_description * librdf_serializer_get_description (librdf_world *world
,unsigned int counter
);
Get serializer descriptive syntax information
|
world object |
|
index into the list of serializers |
Returns : |
description or NULL if counter is out of range |
int librdf_serializer_enumerate (librdf_world *world
,const unsigned int counter
,const char **name
,const char **label
);
Get information on serializers.
Deprecated
: use librdf_serializer_get_description()
to return more information in a static structure.
|
redland world object |
|
index into the list of serializers |
|
pointer to store the name of the serializer (or NULL) |
|
pointer to store syntax readable label (or NULL) |
Returns : |
non 0 on failure of if counter is out of range |
void librdf_serializer_register_factory (librdf_world *world
,const char *name
,const char *label
,const char *mime_type
,const unsigned char *uri_string
,void (*factory) (librdf_serializer_factory*)
);
Register a serializer factory .
|
redland world object |
|
the name of the serializer |
|
the label of the serializer (optional) |
|
MIME type of the syntax (optional) |
|
URI of the syntax (optional) |
|
function to be called to register the factor parameters |
librdf_serializer * librdf_new_serializer (librdf_world *world
,const char *name
,const char *mime_type
,librdf_uri *type_uri
);
Constructor - create a new librdf_serializer object.
|
redland world object |
|
the serializer 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_serializer object or NULL |
librdf_serializer * librdf_new_serializer_from_factory (librdf_world *world
,librdf_serializer_factory *factory
);
Constructor - create a new librdf_serializer object.
|
redland world object |
|
the serializer factory to use to create this serializer |
Returns : |
new librdf_serializer object or NULL |
void librdf_free_serializer (librdf_serializer *serializer
);
Destructor - destroys a librdf_serializer object.
|
the serializer |
int librdf_serializer_check_name (librdf_world *world
,const char *name
);
Check if a serializer name is known
|
redland world object |
|
name of serializer |
Returns : |
non 0 if name is a known serializer |
int librdf_serializer_serialize_model (librdf_serializer *serializer
,FILE *handle
,librdf_uri *base_uri
,librdf_model *model
);
Deprecated
: Use librdf_serializer_serialize_model_to_file_handle()
Write a serialized librdf_model to a FILE*.
|
the serializer |
|
file handle to serialize to |
|
the base URI to use (or NULL) |
|
the librdf_model model to use |
Returns : |
non 0 on failure |
int librdf_serializer_serialize_model_to_file_handle (librdf_serializer *serializer
,FILE *handle
,librdf_uri *base_uri
,librdf_model *model
);
Write a serialized librdf_model to a FILE*.
|
the serializer |
|
file handle to serialize to |
|
the base URI to use (or NULL) |
|
the librdf_model model to use |
Returns : |
non 0 on failure |
int librdf_serializer_serialize_model_to_file (librdf_serializer *serializer
,const char *name
,librdf_uri *base_uri
,librdf_model *model
);
Write a serialized librdf_model to a file.
|
the serializer |
|
filename to serialize to |
|
the base URI to use (or NULL) |
|
the librdf_model model to use |
Returns : |
non 0 on failure |
unsigned char * librdf_serializer_serialize_model_to_string (librdf_serializer *serializer
,librdf_uri *base_uri
,librdf_model *model
);
Write a serialized librdf_model to a string.
The returned string must be freed by the caller using librdf_free_memory()
.
|
the serializer |
|
the base URI to use (or NULL) |
|
the librdf_model model to use |
Returns : |
NULL on failure |
unsigned char * librdf_serializer_serialize_model_to_counted_string (librdf_serializer *serializer
,librdf_uri *base_uri
,librdf_model *model
,size_t *length_p
);
Write a serialized librdf_model to a counted string.
The returned string must be freed by the caller using librdf_free_memory()
.
|
the serializer |
|
the base URI to use (or NULL) |
|
the librdf_model model to use |
|
pointer to store length or NULL |
Returns : |
non 0 on failure |
int librdf_serializer_serialize_model_to_iostream (librdf_serializer *serializer
,librdf_uri *base_uri
,librdf_model *model
,raptor_iostream *iostr
);
Write a serialized librdf_model to a raptor_iostream. This function takes ownership of the iostream and frees it.
|
the serializer |
|
the base URI to use (or NULL) |
|
the librdf_model model to use |
|
the raptor_iostream to write to |
Returns : |
non-0 on failure |
unsigned char * librdf_serializer_serialize_stream_to_counted_string (librdf_serializer *serializer
,librdf_uri *base_uri
,librdf_stream *stream
,size_t *length_p
);
Write a librdf_stream to a counted string.
Caller should free the string with librdf_free_memory()
.
|
the serializer |
|
the base URI to use (or NULL) |
|
the librdf_stream stream to use |
|
pointer to store length or NULL |
Returns : |
stream as string or NULL on failure |
int librdf_serializer_serialize_stream_to_file (librdf_serializer *serializer
,const char *name
,librdf_uri *base_uri
,librdf_stream *stream
);
Write a librdf_stream to a file.
|
the serializer |
|
filename to serialize to |
|
the base URI to use (or NULL) |
|
the librdf_stream stream to use |
Returns : |
non 0 on failure |
int librdf_serializer_serialize_stream_to_file_handle (librdf_serializer *serializer
,FILE *handle
,librdf_uri *base_uri
,librdf_stream *stream
);
Write a librdf_stream to a FILE*.
|
the serializer |
|
file handle to serialize to |
|
the base URI to use (or NULL) |
|
the librdf_stream model to use |
Returns : |
non 0 on failure |
int librdf_serializer_serialize_stream_to_iostream (librdf_serializer *serializer
,librdf_uri *base_uri
,librdf_stream *stream
,raptor_iostream *iostr
);
Write a librdf_stream to a raptor_iostream. This function takes ownership of the iostream and frees it.
|
the serializer |
|
the base URI to use (or NULL) |
|
the librdf_stream stream to use |
|
the raptor_iostream to write to |
Returns : |
non-0 on failure |
unsigned char * librdf_serializer_serialize_stream_to_string (librdf_serializer *serializer
,librdf_uri *base_uri
,librdf_stream *stream
);
Write a librdf_stream to a string.
|
the serializer |
|
the base URI to use (or NULL) |
|
the librdf_stream stream to use |
Returns : |
NULL on failure |
void librdf_serializer_set_error (librdf_serializer *serializer
,void *user_data
,void (*error_fn) (void *user_data, const char *msg, ...)
);
Deprecated
: Does nothing
Set the serializer error handling function.
|
the serializer |
|
user data to pass to function |
|
pointer to the function |
void librdf_serializer_set_warning (librdf_serializer *serializer
,void *user_data
,void (*warning_fn) (void *user_data, const char *msg, ...)
);
Deprecated
: Does nothing
Set the serializer warning handling function.
|
the serializer |
|
user data to pass to function |
|
pointer to the function |
librdf_node * librdf_serializer_get_feature (librdf_serializer *serializer
,librdf_uri *feature
);
Get the value of a serializer feature.
|
serializer object |
|
URI of feature |
Returns : |
the value of the feature or NULL if no such feature exists or the value is empty. |
int librdf_serializer_set_feature (librdf_serializer *serializer
,librdf_uri *feature
,librdf_node *value
);
Set the value of a serializer feature.
|
serializer object |
|
URI of feature |
|
value to set |
Returns : |
non 0 on failure (negative if no such feature) |
int librdf_serializer_set_namespace (librdf_serializer *serializer
,librdf_uri *uri
,const char *prefix
);
Set a namespace URI/prefix mapping.
|
serializer object |
|
URI of namespace or NULL |
|
prefix to use or NULL |
Returns : |
non 0 on failure |