Serializer

## Serializer Serializer — Serialize a photo to RDF Triples. |

## Synopsis

    typedef             flickcurl_serializer;
                        flickcurl_serializer_factory;
    flickcurl_serializer* flickcurl_new_serializer          (flickcurl *fc,
                                                             void *data,
                                                             flickcurl_serializer_factory *factory);
    void                flickcurl_free_serializer           (flickcurl_serializer *serializer);
    int                 flickcurl_serialize_photo           (flickcurl_serializer *fcs,
                                                             flickcurl_photo *photo);
    enum                flickcurl_term_type;

## Description

Serialize a photo to RDF Triples.

## Details

### flickcurl_serializer

    typedef struct flickcurl_serializer_s flickcurl_serializer;

Serializer from Photo and metadata to RDF triples

### flickcurl_serializer_factory

    typedef struct {
      int version;
      void (*emit_namespace)(void* user_data, const char* prefix, size_t prefix_len, const char* uri, size_t uri_len);
      void (*emit_triple)(void* user_data,
                          const char* subject, int subject_type,
                          const char* predicate_nspace, const char* predicate_name,
                          const char *object, int object_type,
                          const char *datatype_uri);
      void (*emit_finish)(void* user_data);
    } flickcurl_serializer_factory;

Triples serializer factory

API version 1 is all that is supported.

int `version`; | API version
`emit_namespace` () | (V1) emit namespace callback
`emit_triple` () | (V1) emit a triple
`emit_finish` () | (V1) finish emitting

### flickcurl_new_serializer ()

    flickcurl_serializer* flickcurl_new_serializer          (flickcurl *fc,
                                                             void *data,
                                                             flickcurl_serializer_factory *factory);

Create a new triples serializer for generating a RDF triples representation of a Flickr photo.

The factory must contain the methods and the correct factory API version as described in flickcurl_serializer_factory

`fc` : | flickcurl object
`data` : | user data for factory methods
`factory` : | triples serializer factory
Returns : | a new serializer object or NULL on failure

### flickcurl_free_serializer ()

    void                flickcurl_free_serializer           (flickcurl_serializer *serializer);

Destructor for triples serializer object

`serializer` : | serializer object

### flickcurl_serialize_photo ()

    int                 flickcurl_serialize_photo           (flickcurl_serializer *fcs,
                                                             flickcurl_photo *photo);

Serialize photo description to RDF triples

`fcs` : | flickcurl serializer object
`photo` : | photo object
Returns : | non-0 on failure

### enum flickcurl_term_type

    typedef enum {
      FLICKCURL_TERM_TYPE_RESOURCE = 1,
      FLICKCURL_TERM_TYPE_BLANK    = 2,
      FLICKCURL_TERM_TYPE_LITERAL  = 5
    } flickcurl_term_type;

Triple part types

These are the same as raptor_identifier_type values.

`FLICKCURL_TERM_TYPE_RESOURCE` | resource/URI term
`FLICKCURL_TERM_TYPE_BLANK` | blank node/anonymous term
`FLICKCURL_TERM_TYPE_LITERAL` | literal term