## section-serializer

section-serializer

## Functions

flickcurl_serializer * | flickcurl_new_serializer ()
void | flickcurl_free_serializer ()
int | flickcurl_serialize_photo ()

## Types and Values

typedef | flickcurl_serializer
| flickcurl_serializer_factory
enum | flickcurl_term_type

## Description

## Functions

### 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

#### Parameters

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

#### Parameters

serializer | serializer object |

### flickcurl_serialize_photo ()

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

Serialize photo description to RDF triples

#### Parameters

fcs | flickcurl serializer object |
photo | photo object |

#### Returns

non-0 on failure

## Types and Values

### 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.

#### Members

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

### enum flickcurl_term_type

Triple part types

These are the same enumeration values as used by Raptor V2 raptor_term_type enumeration and Raptor V1 raptor_identifier_type enumeration.

#### Members

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