Raptor RDF Syntax Parsing and Serializing Library Manual | ||||
---|---|---|---|---|
Top | Description |
enum raptor_genid_type; enum raptor_identifier_type; raptor_identifier; raptor_identifier* raptor_new_identifier (raptor_identifier_type type, raptor_uri *uri, raptor_uri_source uri_source, unsigned char *id, unsigned char *literal, raptor_uri *literal_datatype, unsigned char *literal_language); int raptor_copy_identifier (raptor_identifier *dest, raptor_identifier *src); void raptor_free_identifier (raptor_identifier *identifier); raptor_statement; int raptor_statement_compare (const raptor_statement *s1, const raptor_statement *s2); void raptor_print_statement (const raptor_statement *statement, FILE *stream); void raptor_print_statement_as_ntriples (const raptor_statement *statement, FILE *stream); void raptor_print_statement_detailed (const raptor_statement *statement, int detailed, FILE *stream); unsigned char* raptor_statement_part_as_counted_string (const void *term, raptor_identifier_type type, raptor_uri *literal_datatype, unsigned char *literal_language, size_t *len_p); unsigned char* raptor_statement_part_as_string (const void *term, raptor_identifier_type type, raptor_uri *literal_datatype, unsigned char *literal_language);
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.
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_set_generate_id_handler()
.
typedef enum { RAPTOR_IDENTIFIER_TYPE_UNKNOWN, RAPTOR_IDENTIFIER_TYPE_RESOURCE, RAPTOR_IDENTIFIER_TYPE_ANONYMOUS, RAPTOR_IDENTIFIER_TYPE_PREDICATE, RAPTOR_IDENTIFIER_TYPE_ORDINAL, RAPTOR_IDENTIFIER_TYPE_LITERAL, RAPTOR_IDENTIFIER_TYPE_XML_LITERAL } raptor_identifier_type;
Type of identifier in a raptor_statement
Internal | |
Resource URI (e.g. rdf:about )
|
|
_:foo N-Triples, or generated
|
|
predicate URI. WARNING: Will not be generated in in Raptor 1.4.9 or newer. Instead a RAPTOR_IDENTIFIER_TYPE_RESOURCE will be returned. | |
rdf:li , rdf:_ n. No longer generated in any parser in Raptor 1.4.10+, instead a RAPTOR_IDENTIFIER_TYPE_RESOURCE is returned.
|
|
regular literal | |
rdf:parseType="Literal" . No longer generated by any parser in Raptor 1.4.8+, instead a RAPTOR_IDENTIFIER_TYPE_LITERAL is returned with a datatype of rdf:XMLLiteral .
|
typedef struct { raptor_identifier_type type; raptor_uri *uri; raptor_uri_source uri_source; const unsigned char *id; int ordinal; int is_malloced; const unsigned char *literal; raptor_uri *literal_datatype; const unsigned char *literal_language; raptor_world *world; } raptor_identifier;
Raptor RDF term identifier.
raptor_identifier_type |
Type of identifier |
raptor_uri * |
URI of identifier for types RAPTOR_IDENTIFIER_TYPE_RESOURCE and
RAPTOR_IDENTIFIER_TYPE_PREDICATE
|
where the identifier (URI or blank node) came from | |
integer ordinal for type RAPTOR_IDENTIFIER_TYPE_ORDINAL
|
|
internal | |
raptor_uri * |
RDF literal datatype URI for types
RAPTOR_IDENTIFIER_TYPE_LITERAL and RAPTOR_IDENTIFIER_TYPE_XML_LITERAL
|
raptor_world * |
raptor_world object |
raptor_identifier* raptor_new_identifier (raptor_identifier_type type, raptor_uri *uri, raptor_uri_source uri_source, unsigned char *id, unsigned char *literal, raptor_uri *literal_datatype, unsigned char *literal_language);
Constructor - create a raptor_identifier.
Constructs a new identifier copying the URI, ID fields. SHARED means raptor_new_identifier owns this argument after calling.
raptor_init()
MUST have been called before calling this function.
Use raptor_new_identifier_v2()
if using raptor_world APIs.
|
raptor_identifier_type of identifier |
|
raptor_uri of identifier (if relevant) (SHARED) |
|
raptor_uri_source of URI (if relevant) |
|
string for ID or genid (if relevant) (SHARED) |
|
string for literal (SHARED) |
|
raptor_uri of identifier (SHARED) |
|
literal language (SHARED) |
Returns : |
a new raptor_identifier object or NULL on failure |
int raptor_copy_identifier (raptor_identifier *dest, raptor_identifier *src);
Copy raptor_identifiers.
|
destination raptor_identifier (previously created) |
|
source raptor_identifier |
Returns : |
Non 0 on failure |
void raptor_free_identifier (raptor_identifier *identifier);
Destructor - destroy a raptor_identifier object.
|
raptor_identifier object |
typedef struct { const void *subject; raptor_identifier_type subject_type; const void *predicate; raptor_identifier_type predicate_type; const void *object; raptor_identifier_type object_type; raptor_uri *object_literal_datatype; const unsigned char *object_literal_language; } raptor_statement;
An RDF triple
See raptor_identifier for a description of how the fields may be used. As returned by a parser statement_handler.
See also raptor_statement_v2.
triple subject data | |
raptor_identifier_type |
triple subject type |
triple predicate data | |
raptor_identifier_type |
triple predicate type |
triple object literal string | |
raptor_identifier_type |
triple object type |
raptor_uri * |
triple object literal datatype URI (or NULL) |
int raptor_statement_compare (const raptor_statement *s1, const raptor_statement *s2);
Compare a pair of raptor_statement
If types are different, the raptor_identifier_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.
raptor_init()
MUST have been called before calling this function.
Use raptor_statement_compare_v2()
if using raptor_world APIs.
|
first statement |
|
second statement |
Returns : |
<0 if s1 is before s2, 0 if equal, >0 if s1 is after s2 |
void raptor_print_statement (const raptor_statement *statement, FILE *stream);
Print a raptor_statement to a stream.
raptor_init()
MUST have been called before calling this function.
Use raptor_print_statement_v2()
if using raptor_world APIs.
|
raptor_statement object to print |
|
FILE* stream |
void raptor_print_statement_as_ntriples (const raptor_statement *statement, FILE *stream);
Print a raptor_statement in N-Triples form.
raptor_init()
MUST have been called before calling this function.
Use raptor_print_statement_as_ntriples_v2()
if using raptor_world APIs.
|
raptor_statement to print |
|
FILE* stream |
void raptor_print_statement_detailed (const raptor_statement *statement, int detailed, FILE *stream);
raptor_print_statement_detailed
is deprecated and should not be used in newly-written code.
Print a raptor_statement to a stream in a detailed fashion.
raptor_init()
MUST have been called before calling this function.
deprecated
: an internal function, do not use.
No current difference from calling raptor_print_statement()
.
|
raptor_statement object to print |
|
unused |
|
FILE* stream |
unsigned char* raptor_statement_part_as_counted_string (const void *term, raptor_identifier_type type, raptor_uri *literal_datatype, unsigned char *literal_language, size_t *len_p);
Turns part of raptor statement 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
The part (subject, predicate, object) of the raptor_statement is
typically passed in as term
, the part type (subject_type,
predicate_type, object_type) is passed in as type
. When the part
is a literal, the literal_datatype
and literal_language
fields
are set, otherwise NULL (usually object_datatype,
object_literal_language).
raptor_init()
MUST have been called before calling this function.
Use raptor_statement_part_as_counted_string_v2()
if using raptor_world APIs.
|
raptor_statement part (subject, predicate, object) |
|
raptor_statement part type |
|
raptor_statement part datatype |
|
raptor_statement part language |
|
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.
|
unsigned char* raptor_statement_part_as_string (const void *term, raptor_identifier_type type, raptor_uri *literal_datatype, unsigned char *literal_language);
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
The part (subject, predicate, object) of the raptor_statement is
typically passed in as term
, the part type (subject_type,
predicate_type, object_type) is passed in as type
. When the part
is a literal, the literal_datatype
and literal_language
fields
are set, otherwise NULL (usually object_datatype,
object_literal_language).
raptor_init()
MUST have been called before calling this function.
Use raptor_statement_part_as_string_v2()
if using raptor_world APIs.
|
raptor_statement part (subject, predicate, object) |
|
raptor_statement part type |
|
raptor_statement part datatype |
|
raptor_statement part language |
Returns : |
the new string or NULL on failure. |