Top |
raptor_term * raptor_new_term_from_blank (raptor_world *world
,const unsigned char *blank
);
Constructor - create a new blank node statement term from a UTF-8 encoded blank node ID
Takes a copy of the passed in blank
If blank
is NULL or an empty string, creates a new internal
identifier and uses it. This will use the handler set with
raptor_world_set_generate_bnodeid_parameters()
raptor_term * raptor_new_term_from_counted_blank (raptor_world *world
,const unsigned char *blank
,size_t length
);
Constructor - create a new blank node statement term from a counted UTF-8 encoded blank node ID
Takes a copy of the passed in blank
If blank
is NULL, creates a new internal identifier and uses it.
This will use the handler set with
raptor_world_set_generate_bnodeid_parameters()
Note: The blank
need not be NULL terminated - a NULL will be
added to the copied string used.
raptor_term * raptor_new_term_from_literal (raptor_world *world
,const unsigned char *literal
,raptor_uri *datatype
,const unsigned char *language
);
Constructor - create a new literal statement term
Takes copies of the passed in literal
, datatype
, language
Only one of language
or datatype
may be given. If both are
given, NULL is returned. If language
is the empty string, it is
the equivalent to NULL.
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
);
Constructor - create a new literal statement term from a counted UTF-8 encoded literal string
Takes copies of the passed in literal
, datatype
, language
Only one of language
or datatype
may be given. If both are
given, NULL is returned. If language
is the empty string, it is
the equivalent to NULL.
Note: The literal
need not be NULL terminated - a NULL will be
added to the copied string used.
raptor_term * raptor_new_term_from_counted_uri_string (raptor_world *world
,const char *uri_string
,size_t length
);
Constructor - create a new URI statement term from a UTF-8 encoded Unicode string
Note: The uri_string
need not be NULL terminated - a NULL will be
added to the copied string used.
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
raptor_term * raptor_new_term_from_uri_string (raptor_world *world
,const char *uri_string
);
Constructor - create a new URI statement term from a UTF-8 encoded Unicode string
raptor_term * raptor_new_term_from_counted_string (raptor_world *world
,unsigned char *string
,size_t length
);
Constructor - create a new term from a Turtle / N-Triples format string in UTF-8
See also raptor_term_to_counted_string()
and raptor_term_to_string()
raptor_term *
raptor_term_copy (raptor_term *term
);
Copy constructor - get a copy of a statement term
int raptor_term_compare (const raptor_term *t1
,const raptor_term *t2
);
Compare a pair of raptor_term
If types are different, the raptor_term_type order is used.
Resource and datatype URIs are compared with raptor_uri_compare()
,
blank nodes and literals with strcmp()
. If one literal has no
language, it is earlier than one with a language. If one literal
has no datatype, it is earlier than one with a datatype.
int raptor_term_equals (raptor_term *t1
,raptor_term *t2
);
Compare a pair of raptor_term for equality
void
raptor_free_term (raptor_term *term
);
Destructor - destroy a raptor_term object.
unsigned char * raptor_term_to_counted_string (raptor_term *term
,size_t *len_p
);
Turns a 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.
See also raptor_new_term_from_counted_string()
to reverse this.
See also raptor_term_to_turtle_string()
to write as Turtle which
will include Turtle syntax such as 'true' for booleans and """quoting"""
unsigned char *
raptor_term_to_string (raptor_term *term
);
Turns a raptor term 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
See also raptor_new_term_from_counted_string()
to reverse this.
See also raptor_term_to_turtle_string()
to write as Turtle which
will include Turtle syntax such as 'true' for booleans and """quoting"""
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.
Write a raptor_term formatted in N-Triples format to a raptor_iostream
Deprecated
: Use raptor_term_escaped_write()
that allows
configuring format detail flags.
unsigned char * raptor_term_to_turtle_counted_string (raptor_term *term
,raptor_namespace_stack *nstack
,raptor_uri *base_uri
,size_t *len_p
);
Convert raptor_term to a string. Caller has responsibility to free the string.
Note: This creates and destroys several internal objects for each call so for more efficient writing, create a turtle serializer.
See also raptor_term_to_counted_string()
which writes in simpler
N-Triples with no Turtle abbreviated forms, and is quicker.
unsigned char * raptor_term_to_turtle_string (raptor_term *term
,raptor_namespace_stack *nstack
,raptor_uri *base_uri
);
Convert raptor_term to a string. Caller has responsibility to free the string.
See also raptor_term_to_counted_string()
which writes in simpler
N-Triples with no Turtle abbreviated forms, and is quicker.
int raptor_term_turtle_write (raptor_iostream *iostr
,raptor_term *term
,raptor_namespace_stack *nstack
,raptor_uri *base_uri
);
Write raptor_term to a stream in turtle syntax (using QNames).
Note: This creates and destroys several internal objects for each call so for more efficient writing, create a turtle serializer.
raptor_statement *
raptor_new_statement (raptor_world *world
);
Constructor - create a new raptor_statement.
raptor_statement * raptor_new_statement_from_nodes (raptor_world *world
,raptor_term *subject
,raptor_term *predicate
,raptor_term *object
,raptor_term *graph
);
Constructor - create a new raptor_statement from a set of terms
The subject
, predicate
, object
and graph
become owned by the statement.
raptor_statement *
raptor_statement_copy (raptor_statement *statement
);
Copy a raptor_statement.
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.
int raptor_statement_equals (const raptor_statement *s1
,const raptor_statement *s2
);
Compare a pair of raptor_statement for equality
void raptor_statement_init (raptor_statement *statement
,raptor_world *world
);
Initialize a static raptor_statement.
void
raptor_statement_clear (raptor_statement *statement
);
Empty a raptor_statement of terms.
int raptor_statement_print (const raptor_statement *statement
,FILE *stream
);
Print a raptor_statement to a stream.
int raptor_statement_print_as_ntriples (const raptor_statement *statement
,FILE *stream
);
Print a raptor_statement in N-Triples form.
int raptor_statement_ntriples_write (const raptor_statement *statement
,raptor_iostream *iostr
,int write_graph_term
);
Write a raptor_statement formatted in N-Triples or N-Quads format to a raptor_iostream
Type of term in a raptor_statement
Node type 3 is unused but exists to preserve numeric compatibility with librdf_node_type values.
typedef struct { raptor_world* world; int usage; raptor_term_type type; raptor_term_value value; } raptor_term;
An RDF statement term
raptor_world * |
world |
|
usage reference count (if >0) |
||
raptor_term_type |
term type |
|
raptor_term_value |
term values per type |
Term value - this typedef exists solely for use in raptor_term
raptor_uri * |
uri value when term type is RAPTOR_TERM_TYPE_URI |
|
raptor_term_literal_value |
literal value when term type is RAPTOR_TERM_TYPE_LITERAL |
|
raptor_term_blank_value |
blank value when term type is RAPTOR_TERM_TYPE_BLANK |
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
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.
literal string |
||
length of string |
||
raptor_uri * |
datatype URI (or NULL) |
|
literal language (or NULL) |
||
length of language |
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 pointer |
|
usage count |
||
raptor_term * |
statement subject |
|
raptor_term * |
statement predicate |
|
raptor_term * |
statement object |
|
raptor_term * |
statement graph name (or NULL if not present) |