Triples

Triples — RDF Triples

Synopsis

enum                raptor_genid_type;
enum                raptor_term_type;
raptor_term*        raptor_new_term_from_blank          (raptor_world *world,
                                                         unsigned char *blank);
raptor_term*        raptor_new_term_from_literal        (raptor_world *world,
                                                         unsigned char *literal,
                                                         raptor_uri *datatype,
                                                         unsigned char *language);
raptor_term*        raptor_new_term_from_uri            (raptor_world *world,
                                                         raptor_uri *uri);
raptor_term*        raptor_term_copy                    (raptor_term *term);
void                raptor_free_term                    (raptor_term *term);
unsigned char*      raptor_term_as_counted_string       (raptor_term *term,
                                                         size_t *len_p);
unsigned char*      raptor_term_as_string               (raptor_term *term);
int                 raptor_term_ntriples_write          (const raptor_term *term,
                                                         raptor_iostream *iostr);
                    raptor_statement;
int                 raptor_statement_compare            (const raptor_statement *s1,
                                                         const raptor_statement *s2);
void                raptor_statement_init               (raptor_statement *statement,
                                                         raptor_world *world);
void                raptor_free_statement               (raptor_statement *statement);
int                 raptor_statement_print              (const raptor_statement *statement,
                                                         FILE *stream);
int                 raptor_statement_print_as_ntriples  (const raptor_statement *statement,
                                                         FILE *stream);
int                 raptor_statement_ntriples_write     (const raptor_statement *statement,
                                                         raptor_iostream *iostr);

Description

Representation of RDF triples inside Raptor. They are a sequence of three raptor_identifier which cover the RDF terms of URI (RAPTOR_IDENTIFIER_TYPE_RESOURCE), Literal (RAPTOR_IDENTIFIER_TYPE_LITERAL) and Blank Node (RAPTOR_IDENTIFIER_TYPE_ANONYMOUS). Some other raptor_identifer_type forms exist but are deprecated.

Details

enum raptor_genid_type

typedef enum {
  RAPTOR_GENID_TYPE_BNODEID,
  RAPTOR_GENID_TYPE_BAGID
} raptor_genid_type;

Intended type for a generated identifier asked for by the handler registered with raptor_parser_set_generate_id_handler().

RAPTOR_GENID_TYPE_BNODEID

Generated ID is for a blank node

RAPTOR_GENID_TYPE_BAGID

Generated ID is for rdf:bagID

enum raptor_term_type

typedef enum {
  RAPTOR_TERM_TYPE_UNKNOWN,
  RAPTOR_TERM_TYPE_URI,
  RAPTOR_TERM_TYPE_BLANK,
  RAPTOR_TERM_TYPE_LITERAL
} raptor_term_type;

Type of term in a raptor_statement

RAPTOR_TERM_TYPE_UNKNOWN

Internal

RAPTOR_TERM_TYPE_URI

RDF URI

RAPTOR_TERM_TYPE_BLANK

RDF blank node

RAPTOR_TERM_TYPE_LITERAL

RDF literal

raptor_new_term_from_blank ()

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

Constructor - create a new blank node statement term

Takes a copy of the passed in blank

world :

raptor world

blank :

blank node identifier

Returns :

new term or NULL on failure

raptor_new_term_from_literal ()

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

Constructor - create a new literal statement term

Takes copies of the passed in literal, datatype, language

world :

raptor world

literal :

literal data

datatype :

literal datatype URI (or NULL)

language :

literal language (or NULL)

Returns :

new term or NULL on failure

raptor_new_term_from_uri ()

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

Constructor - create a new URI statement term

Takes a copy (reference) of the passed in uri

world :

raptor world

uri :

uri

Returns :

new term or NULL on failure

raptor_term_copy ()

raptor_term*        raptor_term_copy                    (raptor_term *term);

Copy constructor - get a copy of a statement term

term :

raptor term

Returns :

new term object or NULL on failure

raptor_free_term ()

void                raptor_free_term                    (raptor_term *term);

Destructor - destroy a raptor_term object.

term :

raptor_term object

raptor_term_as_counted_string ()

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

Turns part of raptor term into a N-Triples format counted string.

Turns the given term into an N-Triples escaped string using all the escapes as defined in http://www.w3.org/TR/rdf-testcases/ntriples

This function uses raptor_term_ntriples_write() to write to an raptor_iostream which is the prefered way to write formatted output.

term :

raptor_term

len_p :

Pointer to location to store length of new string (if not NULL)

Returns :

the new string or NULL on failure. The length of the new string is returned in *len_p if len_p is not NULL.

raptor_term_as_string ()

unsigned char*      raptor_term_as_string               (raptor_term *term);

Turns part of raptor statement into a N-Triples format string.

Turns the given term into an N-Triples escaped string using all the escapes as defined in http://www.w3.org/TR/rdf-testcases/ntriples

term :

raptor_term

Returns :

the new string or NULL on failure.

raptor_term_ntriples_write ()

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

Write a raptor_term formatted in N-Triples format to a raptor_iostream

term :

term to write

iostr :

raptor iostream

Returns :

non-0 on failure

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.

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)

raptor_statement_compare ()

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

Compare a pair of raptor_statement

Uses raptor_term_compare() to check ordering between subjects, predicates and objects of statements.

s1 :

first statement

s2 :

second statement

Returns :

<0 if s1 is before s2, 0 if equal, >0 if s1 is after s2

raptor_statement_init ()

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

Initialize a static raptor_statement.

statement :

statement to initialize

world :

raptor world

raptor_free_statement ()

void                raptor_free_statement               (raptor_statement *statement);

Destructor

statement :

statement

raptor_statement_print ()

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

Print a raptor_statement to a stream.

statement :

raptor_statement object to print

stream :

FILE* stream

Returns :

non-0 on failure

raptor_statement_print_as_ntriples ()

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

Print a raptor_statement in N-Triples form.

statement :

raptor_statement to print

stream :

FILE* stream

Returns :

non-0 on failure

raptor_statement_ntriples_write ()

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

Write a raptor_statement formatted in N-Triples format to a raptor_iostream

statement :

statement to write

iostr :

raptor iostream

Returns :

non-0 on failure


Navigation: Redland Home Page

Copyright 2000-2010 Dave Beckett