Triples

## Triples Triples — RDF Triples |

## Functions

raptor_term * | raptor_new_term_from_blank ()
raptor_term * | raptor_new_term_from_counted_blank ()
raptor_term * | raptor_new_term_from_literal ()
raptor_term * | raptor_new_term_from_counted_literal ()
raptor_term * | raptor_new_term_from_counted_uri_string ()
raptor_term * | raptor_new_term_from_uri ()
raptor_term * | raptor_new_term_from_uri_string ()
raptor_term * | raptor_new_term_from_counted_string ()
raptor_term * | raptor_term_copy ()
int | raptor_term_compare ()
int | raptor_term_equals ()
void | raptor_free_term ()
unsigned char * | raptor_term_to_counted_string ()
unsigned char * | raptor_term_to_string ()
int | raptor_term_ntriples_write ()
unsigned char * | raptor_term_to_turtle_counted_string ()
unsigned char * | raptor_term_to_turtle_string ()
int | raptor_term_turtle_write ()
raptor_statement * | raptor_new_statement ()
raptor_statement * | raptor_new_statement_from_nodes ()
void | raptor_free_statement ()
raptor_statement * | raptor_statement_copy ()
int | raptor_statement_compare ()
int | raptor_statement_equals ()
void | raptor_statement_init ()
void | raptor_statement_clear ()
int | raptor_statement_print ()
int | raptor_statement_print_as_ntriples ()
int | raptor_statement_ntriples_write ()

## Types and Values

enum | raptor_term_type
| raptor_term
| raptor_term_value
| raptor_term_blank_value
| raptor_term_literal_value
| raptor_statement

## Description

Representation of RDF statements inside Raptor. They are a 3 or 4-tuple of raptor_term which cover the RDF terms of URI (`RAPTOR_TERM_TYPE_URI`), Literal (`RAPTOR_TERM_TYPE_LITERAL`) and Blank Node (`RAPTOR_TERM_TYPE_BLANK`).

## Functions

### raptor_new_term_from_blank ()

    raptor_term *
    raptor_new_term_from_blank (raptor_world *world,
                                const unsigned char *blank);

#### Returns

### raptor_new_term_from_counted_blank ()

    raptor_term *
    raptor_new_term_from_counted_blank (raptor_world *world,
                                        const unsigned char *blank,
                                        size_t length);

#### Returns

### raptor_new_term_from_literal ()

    raptor_term *
    raptor_new_term_from_literal (raptor_world *world,
                                  const unsigned char *literal,
                                  raptor_uri *datatype,
                                  const unsigned char *language);

#### Returns

### raptor_new_term_from_counted_literal ()

    raptor_term *
    raptor_new_term_from_counted_literal (raptor_world *world,
                                          const unsigned char *literal,
                                          size_t literal_len,
                                          raptor_uri *datatype,
                                          const unsigned char *language,
                                          unsigned char language_len);

#### Returns

### raptor_new_term_from_counted_uri_string ()

    raptor_term *
    raptor_new_term_from_counted_uri_string
                                   (raptor_world *world,
                                    const unsigned char *uri_string,
                                    size_t length);

#### Returns

### raptor_new_term_from_uri ()

    raptor_term *
    raptor_new_term_from_uri (raptor_world *world,
                              raptor_uri *uri);

#### Returns

### raptor_new_term_from_uri_string ()

    raptor_term *
    raptor_new_term_from_uri_string (raptor_world *world,
                                     const unsigned char *uri_string);

#### Returns

### raptor_new_term_from_counted_string ()

    raptor_term *
    raptor_new_term_from_counted_string (raptor_world *world,
                                         unsigned char *string,
                                         size_t length);

#### Returns

### raptor_term_copy ()

    raptor_term *
    raptor_term_copy (raptor_term *term);

#### Returns

### raptor_term_compare ()

    int
    raptor_term_compare (const raptor_term *t1,
                         const raptor_term *t2);

#### Returns

### raptor_term_equals ()

    int
    raptor_term_equals (raptor_term *t1,
                        raptor_term *t2);

#### Returns

### raptor_free_term ()

    void
    raptor_free_term (raptor_term *term);

### raptor_term_to_counted_string ()

    unsigned char *
    raptor_term_to_counted_string (raptor_term *term,
                                   size_t *len_p);

#### Returns

### raptor_term_to_string ()

    unsigned char *
    raptor_term_to_string (raptor_term *term);

#### Returns

### raptor_term_ntriples_write ()

    int
    raptor_term_ntriples_write (const raptor_term *term,
                                raptor_iostream *iostr);

`raptor_term_ntriples_write` is deprecated and should not be used in newly-written code.

#### Returns

### raptor_term_to_turtle_counted_string ()

    unsigned char *
    raptor_term_to_turtle_counted_string (raptor_term *term,
                                          raptor_namespace_stack *nstack,
                                          raptor_uri *base_uri,
                                          size_t *len_p);

#### Returns

### raptor_term_to_turtle_string ()

    unsigned char *
    raptor_term_to_turtle_string (raptor_term *term,
                                  raptor_namespace_stack *nstack,
                                  raptor_uri *base_uri);

#### Returns

### raptor_term_turtle_write ()

    int
    raptor_term_turtle_write (raptor_iostream *iostr,
                              raptor_term *term,
                              raptor_namespace_stack *nstack,
                              raptor_uri *base_uri);

#### Returns

### raptor_new_statement ()

    raptor_statement *
    raptor_new_statement (raptor_world *world);

#### Returns

### raptor_new_statement_from_nodes ()

    raptor_statement *
    raptor_new_statement_from_nodes (raptor_world *world,
                                     raptor_term *subject,
                                     raptor_term *predicate,
                                     raptor_term *object,
                                     raptor_term *graph);

#### Returns

### raptor_free_statement ()

    void
    raptor_free_statement (raptor_statement *statement);

### raptor_statement_copy ()

    raptor_statement *
    raptor_statement_copy (raptor_statement *statement);

#### Returns

### raptor_statement_compare ()

    int
    raptor_statement_compare (const raptor_statement *s1,
                              const raptor_statement *s2);

#### Returns

### raptor_statement_equals ()

    int
    raptor_statement_equals (const raptor_statement *s1,
                             const raptor_statement *s2);

#### Returns

### raptor_statement_init ()

    void
    raptor_statement_init (raptor_statement *statement,
                           raptor_world *world);

### raptor_statement_clear ()

    void
    raptor_statement_clear (raptor_statement *statement);

### raptor_statement_print ()

    int
    raptor_statement_print (const raptor_statement *statement,
                            FILE *stream);

#### Returns

### raptor_statement_print_as_ntriples ()

    int
    raptor_statement_print_as_ntriples (const raptor_statement *statement,
                                        FILE *stream);

#### Returns

### raptor_statement_ntriples_write ()

    int
    raptor_statement_ntriples_write (const raptor_statement *statement,
                                     raptor_iostream *iostr,
                                     int write_graph_term);

#### Returns

## Types and Values

### enum raptor_term_type

Type of term in a raptor_statement

Node type 3 is unused but exists to preserve numeric compatibility with librdf_node_type values.

#### Members

RAPTOR_TERM_TYPE_UNKNOWN | Internal |
RAPTOR_TERM_TYPE_URI | RDF URI |
RAPTOR_TERM_TYPE_LITERAL | RDF literal |
RAPTOR_TERM_TYPE_BLANK | RDF blank node |

### raptor_term

    typedef struct {
      raptor_world* world;

      int usage;

      raptor_term_type type;

      raptor_term_value value;
    } raptor_term;

An RDF statement term

#### Members

raptor_world *`world`; | world |
int `usage`; | usage reference count (if >0) |
raptor_term_type `type`; | term type |
raptor_term_value `value`; | term values per type |

### raptor_term_value

Term value - this typedef exists solely for use in raptor_term

#### Members

raptor_uri *`uri`; | uri value when term type is RAPTOR_TERM_TYPE_URI |
raptor_term_literal_value `literal`; | literal value when term type is RAPTOR_TERM_TYPE_LITERAL |
raptor_term_blank_value `blank`; | blank value when term type is RAPTOR_TERM_TYPE_BLANK |

### raptor_term_blank_value

    typedef struct {
      unsigned char *string;
      unsigned int string_len;
    } raptor_term_blank_value;

Blank term value - this typedef exists solely for use in raptor_term

#### Members

unsigned char *`string`; | literal string |
unsigned int `string_len`; | length of string |

### raptor_term_literal_value

    typedef struct {
      unsigned char *string;
      unsigned int string_len;

      raptor_uri *datatype;

      unsigned char *language;
      unsigned char language_len;
    } raptor_term_literal_value;

Literal term value - this typedef exists solely for use in raptor_term

Either `datatype` or `language` may be non-NULL but not both.

#### Members

unsigned char *`string`; | literal string |
unsigned int `string_len`; | length of string |
raptor_uri *`datatype`; | datatype URI (or NULL) |
unsigned char *`language`; | literal language (or NULL) |
unsigned char `language_len`; | length of language |

### raptor_statement

    typedef struct {
      raptor_world* world;
      int usage;
      raptor_term* subject;
      raptor_term* predicate;
      raptor_term* object;
      raptor_term* graph;
    } raptor_statement;

An RDF triple with optional graph name (quad)

See raptor_term for a description of how the fields may be used. As returned by a parser statement_handler.

#### Members

raptor_world *`world`; | world pointer |
int `usage`; | usage count |
raptor_term *`subject`; | statement subject |
raptor_term *`predicate`; | statement predicate |
raptor_term *`object`; | statement object |
raptor_term *`graph`; | statement graph name (or NULL if not present) |