Top | ![]() |
![]() |
![]() |
![]() |
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.
const raptor_syntax_description * librdf_serializer_get_description (librdf_world *world
,unsigned int counter
);
Get serializer descriptive syntax information
int librdf_serializer_enumerate (librdf_world *world
,const unsigned int counter
,const char **name
,const char **label
);
librdf_serializer_enumerate
is deprecated and should not be used in newly-written code.
Get information on serializers.
Deprecated
: use librdf_serializer_get_description()
to return more information in a static structure.
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 .
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.
librdf_serializer * librdf_new_serializer_from_factory (librdf_world *world
,librdf_serializer_factory *factory
);
Constructor - create a new librdf_serializer object.
void
librdf_free_serializer (librdf_serializer *serializer
);
Destructor - destroys a librdf_serializer object.
int librdf_serializer_check_name (librdf_world *world
,const char *name
);
Check if a serializer name is known
int librdf_serializer_serialize_model (librdf_serializer *serializer
,FILE *handle
,librdf_uri *base_uri
,librdf_model *model
);
librdf_serializer_serialize_model
is deprecated and should not be used in newly-written code.
Deprecated
: Use librdf_serializer_serialize_model_to_file_handle()
Write a serialized librdf_model to a FILE*.
serializer |
the serializer |
|
handle |
file handle to serialize to |
|
base_uri |
the base URI to use (or NULL) |
|
model |
the librdf_model model to use |
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*.
serializer |
the serializer |
|
handle |
file handle to serialize to |
|
base_uri |
the base URI to use (or NULL) |
|
model |
the librdf_model model to use |
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.
serializer |
the serializer |
|
name |
filename to serialize to |
|
base_uri |
the base URI to use (or NULL) |
|
model |
the librdf_model model to use |
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()
.
serializer |
the serializer |
|
base_uri |
the base URI to use (or NULL) |
|
model |
the librdf_model model to use |
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()
.
serializer |
the serializer |
|
base_uri |
the base URI to use (or NULL) |
|
model |
the librdf_model model to use |
|
length_p |
pointer to store length or NULL |
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.
serializer |
the serializer |
|
base_uri |
the base URI to use (or NULL) |
|
model |
the librdf_model model to use |
|
iostr |
the raptor_iostream to write to |
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()
.
serializer |
the serializer |
|
base_uri |
the base URI to use (or NULL) |
|
stream |
the librdf_stream stream to use |
|
length_p |
pointer to store length or NULL |
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.
serializer |
the serializer |
|
name |
filename to serialize to |
|
base_uri |
the base URI to use (or NULL) |
|
stream |
the librdf_stream stream to use |
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*.
serializer |
the serializer |
|
handle |
file handle to serialize to |
|
base_uri |
the base URI to use (or NULL) |
|
stream |
the librdf_stream model to use |
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.
serializer |
the serializer |
|
base_uri |
the base URI to use (or NULL) |
|
stream |
the librdf_stream stream to use |
|
iostr |
the raptor_iostream to write to |
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.
serializer |
the serializer |
|
base_uri |
the base URI to use (or NULL) |
|
stream |
the librdf_stream stream to use |
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.
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.
librdf_node * librdf_serializer_get_feature (librdf_serializer *serializer
,librdf_uri *feature
);
Get the value of a serializer feature.
int librdf_serializer_set_feature (librdf_serializer *serializer
,librdf_uri *feature
,librdf_node *value
);
Set the value of a serializer feature.
int librdf_serializer_set_namespace (librdf_serializer *serializer
,librdf_uri *uri
,const char *prefix
);
Set a namespace URI/prefix mapping.