Top | ![]() |
![]() |
![]() |
![]() |
void
librdf_free_node (librdf_node *node
);
Destructor - destroy an librdf_node object.
librdf_node *
librdf_new_node (librdf_world *world
);
Constructor - create a new librdf_node object with a private identifier.
Calls librdf_new_node_from_blank_identifier(world, NULL) to construct a new redland blank node identifier and make a new librdf_node object for it.
librdf_node * librdf_new_node_from_blank_identifier (librdf_world *world
,const unsigned char *identifier
);
Constructor - create a new blank node librdf_node object from a blank node identifier.
If no identifier
string is given (NULL) this creates a new
internal identifier and uses it.
librdf_node * librdf_new_node_from_counted_blank_identifier (librdf_world *world
,const unsigned char *identifier
,size_t identifier_len
);
Constructor - create a new blank node librdf_node object from a blank node counted length identifier.
If no identifier
string is given (NULL) this creates a new
internal identifier and uses it.
librdf_node * librdf_new_node_from_counted_uri_string (librdf_world *world
,const unsigned char *uri_string
,size_t len
);
Constructor - create a new librdf_node object from a counted URI string.
librdf_node * librdf_new_node_from_literal (librdf_world *world
,const unsigned char *string
,const char *xml_language
,int is_wf_xml
);
Constructor - create a new literal librdf_node object.
0.9.12: xml_space argument deleted
An xml_language
cannot be used when is_wf_xml
is non-0. If both
are given, NULL is returned. If xml_language
is the empty string,
it is the equivalent to NULL.
librdf_node *
librdf_new_node_from_node (librdf_node *node
);
Copy constructor - create a new librdf_node object from an existing librdf_node object.
librdf_node * librdf_new_node_from_normalised_uri_string (librdf_world *world
,const unsigned char *uri_string
,librdf_uri *source_uri
,librdf_uri *base_uri
);
Constructor - create a new librdf_node object from a UTF-8 encoded URI string normalised to a new base URI.
librdf_node * librdf_new_node_from_typed_counted_literal (librdf_world *world
,const unsigned char *value
,size_t value_len
,const char *xml_language
,size_t xml_language_len
,librdf_uri *datatype_uri
);
Constructor - create a new typed literal librdf_node object.
Takes copies of the passed in value
, datatype_uri
and xml_language
.
Only one of xml_language
or datatype_uri
may be given. If both
are given, NULL is returned. If xml_language
is the empty string,
it is the equivalent to NULL.
world |
redland world object |
|
value |
literal UTF-8 encoded string value |
|
value_len |
literal string value length |
|
xml_language |
literal XML language (or NULL, empty string) |
|
xml_language_len |
literal XML language length (not used if |
|
datatype_uri |
URI of typed literal datatype or NULL |
librdf_node * librdf_new_node_from_typed_literal (librdf_world *world
,const unsigned char *value
,const char *xml_language
,librdf_uri *datatype_uri
);
Constructor - create a new typed literal librdf_node object.
Only one of xml_language
or datatype_uri
may be given. If both
are given, NULL is returned. If xml_language
is the empty string,
it is the equivalent to NULL.
librdf_node * librdf_new_node_from_uri (librdf_world *world
,librdf_uri *uri
);
Constructor - create a new resource librdf_node object with a given URI.
librdf_node * librdf_new_node_from_uri_local_name (librdf_world *world
,librdf_uri *uri
,const unsigned char *local_name
);
Constructor - create a new resource librdf_node object with a given URI and local name.
librdf_node * librdf_new_node_from_uri_string (librdf_world *world
,const unsigned char *uri_string
);
Constructor - create a new librdf_node object from a URI string.
librdf_node * librdf_node_decode (librdf_world *world
,size_t *size_p
,unsigned char *buffer
,size_t length
);
Deserialise a node from a buffer.
Decodes the serialised node (as created by librdf_node_encode()
)
from the given buffer.
size_t librdf_node_encode (librdf_node *node
,unsigned char *buffer
,size_t length
);
Serialise a node into a buffer.
Encodes the given node in the buffer, which must be of sufficient size. If buffer is NULL, no work is done but the size of buffer required is returned.
If the node cannot be encoded due to restrictions of the encoding format, a redland error is generated
int librdf_node_equals (librdf_node *first_node
,librdf_node *second_node
);
Compare two librdf_node objects for equality.
Note - for literal nodes, XML language, XML space and well-formness are presently ignored in the comparison.
unsigned char *
librdf_node_get_blank_identifier (librdf_node *node
);
Get the blank node identifier as a UTF-8 encoded string.
unsigned char * librdf_node_get_counted_blank_identifier (librdf_node *node
,size_t *len_p
);
Get the blank node identifier as a counted UTF-8 encoded string.
int
librdf_node_get_li_ordinal (librdf_node *node
);
Get the node li object ordinal value.
unsigned char *
librdf_node_get_literal_value (librdf_node *node
);
Get the literal value of the node as a UTF-8 encoded string.
Returns a pointer to the UTF-8 encoded literal value held by the node, it must be copied if it is wanted to be used by the caller.
unsigned char * librdf_node_get_literal_value_as_counted_string (librdf_node *node
,size_t *len_p
);
Get the literal value of the node as a counted UTF-8 encoded string.
Returns a pointer to the UTF-8 encoded literal string value held by the node, it must be copied if it is wanted to be used by the caller.
char *
librdf_node_get_literal_value_as_latin1
(librdf_node *node
);
Get the string literal value of the node as ISO Latin-1.
Returns a newly allocated string containing the conversion of the node literal value held by the node into ISO Latin-1. Discards characters outside the U+0000 to U+00FF range (inclusive).
librdf_uri *
librdf_node_get_literal_value_datatype_uri
(librdf_node *node
);
Get the typed literal datatype URI of the literal node.
int
librdf_node_get_literal_value_is_wf_xml
(librdf_node *node
);
Get the XML well-formness property of the node.
char *
librdf_node_get_literal_value_language
(librdf_node *node
);
Get the XML language of the node.
Returns a pointer to the literal language value held by the node, it must be copied if it is wanted to be used by the caller. Language strings are ASCII, not UTF-8 encoded Unicode.
librdf_node_type
librdf_node_get_type (librdf_node *node
);
Get the type of the node.
See also librdf_node_is_resource()
, librdf_node_is_literal()
and
librdf_node_is_blank()
for testing individual types.
librdf_uri *
librdf_node_get_uri (librdf_node *node
);
Get the URI for a node object.
Returns a pointer to the URI object held by the node, it must be copied if it is wanted to be used by the caller.
int
librdf_node_is_resource (librdf_node *node
);
Check node is a resource.
librdf_iterator * librdf_node_new_static_node_iterator (librdf_world *world
,librdf_node **nodes
,int size
);
Create an iterator over an array of nodes.
This creates an iterator for an existing static array of librdf_node objects. It is mostly intended for testing iterator code.
void librdf_node_print (librdf_node *node
,FILE *fh
);
Pretty print the node to a file descriptor.
This method is for debugging and the format of the output should not be relied on.
librdf_iterator * librdf_node_static_iterator_create (librdf_node **nodes
,int size
);
librdf_node_static_iterator_create
is deprecated and should not be used in newly-written code.
Create an iterator over an array of nodes (ALWAYS FAILS)
This legacy method used to create an iterator for an existing static array of librdf_node objects. It was intended for testing iterator code.
deprecated
: always returns NULL. Use
librdf_node_new_static_node_iterator()
unsigned char * librdf_node_to_counted_string (librdf_node *node
,size_t *len_p
);
librdf_node_to_counted_string
is deprecated and should not be used in newly-written code.
Format the node as a counted string in a debugging format.
Note a new string is allocated which must be freed by the caller.
Deprecated
: Use librdf_node_write()
to write to raptor_iostream
which can be made to write to a string. Use a librdf_serializer
to write proper syntax formats.
unsigned char *
librdf_node_to_string (librdf_node *node
);
librdf_node_to_string
is deprecated and should not be used in newly-written code.
Format the node as a string in a debugging format.
Note a new string is allocated which must be freed by the caller.
Deprecated
: Use librdf_node_write()
to write to raptor_iostream
which can be made to write to a string. Use a librdf_serializer
to write proper syntax formats.
int librdf_node_write (librdf_node *node
,raptor_iostream *iostr
);
Write the node to an iostream in N-Triples format.
This method can be used to write a node in a relatively readable format. To write more compact formats use a serializer to pick a syntax and serialize triples to it.
Type of a redland node.
Better to check this with functions librdf_node_is_resource()
,
librdf_node_is_literal()
or librdf_node_is_blank()
.