Redland RDF Library Manual | ||||
---|---|---|---|---|
Top | Description |
void librdf_free_node (librdf_node *node
); librdf_node * librdf_new_node (librdf_world *world
); librdf_node * librdf_new_node_from_blank_identifier (librdf_world *world
,const unsigned char *identifier
); librdf_node * librdf_new_node_from_counted_blank_identifier (librdf_world *world
,const unsigned char *identifier
,size_t identifier_len
); librdf_node * librdf_new_node_from_counted_uri_string (librdf_world *world
,const unsigned char *uri_string
,size_t len
); librdf_node * librdf_new_node_from_literal (librdf_world *world
,const unsigned char *string
,const char *xml_language
,int is_wf_xml
); librdf_node * librdf_new_node_from_node (librdf_node *node
); 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
); 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
); librdf_node * librdf_new_node_from_typed_literal (librdf_world *world
,const unsigned char *value
,const char *xml_language
,librdf_uri *datatype_uri
); librdf_node * librdf_new_node_from_uri (librdf_world *world
,librdf_uri *uri
); librdf_node * librdf_new_node_from_uri_local_name (librdf_world *world
,librdf_uri *uri
,const unsigned char *local_name
); librdf_node * librdf_new_node_from_uri_string (librdf_world *world
,const unsigned char *uri_string
); typedef librdf_node; librdf_node * librdf_node_decode (librdf_world *world
,size_t *size_p
,unsigned char *buffer
,size_t length
); size_t librdf_node_encode (librdf_node *node
,unsigned char *buffer
,size_t length
); int librdf_node_equals (librdf_node *first_node
,librdf_node *second_node
); unsigned char * librdf_node_get_blank_identifier (librdf_node *node
); unsigned char * librdf_node_get_counted_blank_identifier (librdf_node *node
,size_t *len_p
); int librdf_node_get_li_ordinal (librdf_node *node
); unsigned char * librdf_node_get_literal_value (librdf_node *node
); unsigned char * librdf_node_get_literal_value_as_counted_string (librdf_node *node
,size_t *len_p
); char * librdf_node_get_literal_value_as_latin1 (librdf_node *node
); librdf_uri * librdf_node_get_literal_value_datatype_uri (librdf_node *node
); int librdf_node_get_literal_value_is_wf_xml (librdf_node *node
); char * librdf_node_get_literal_value_language (librdf_node *node
); librdf_node_type librdf_node_get_type (librdf_node *node
); librdf_uri * librdf_node_get_uri (librdf_node *node
); int librdf_node_is_blank (librdf_node *node
); int librdf_node_is_literal (librdf_node *node
); int librdf_node_is_resource (librdf_node *node
); librdf_iterator * librdf_node_new_static_node_iterator (librdf_world *world
,librdf_node **nodes
,int size
); void librdf_node_print (librdf_node *node
,FILE *fh
); librdf_iterator * librdf_node_static_iterator_create (librdf_node **nodes
,int size
); unsigned char * librdf_node_to_counted_string (librdf_node *node
,size_t *len_p
); unsigned char * librdf_node_to_string (librdf_node *node
); enum librdf_node_type; int librdf_node_write (librdf_node *node
,raptor_iostream *iostr
);
void librdf_free_node (librdf_node *node
);
Destructor - destroy an librdf_node object.
|
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.
|
redland world object |
Returns : |
a new librdf_node object or NULL on failure |
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.
|
redland world object |
|
UTF-8 encoded blank node identifier or NULL |
Returns : |
new librdf_node object or NULL on failure |
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.
|
redland world object |
|
UTF-8 encoded blank node identifier or NULL |
|
length of identifier
|
Returns : |
new librdf_node object or NULL on failure |
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.
|
redland world object |
|
string representing a URI |
|
length of string |
Returns : |
a new librdf_node object or NULL on failure |
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.
|
redland world object |
|
literal UTF-8 encoded string value |
|
literal XML language (or NULL, empty string) |
|
non 0 if literal is XML |
Returns : |
new librdf_node object or NULL on failure |
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 object to copy |
Returns : |
a new librdf_node object or NULL on failure |
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.
|
redland world object |
|
UTF-8 encoded string representing a URI |
|
source URI |
|
base URI |
Returns : |
a new librdf_node object or NULL on failure |
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.
|
redland world object |
|
literal UTF-8 encoded string value |
|
literal string value length |
|
literal XML language (or NULL, empty string) |
|
literal XML language length (not used if xml_language is NULL) |
|
URI of typed literal datatype or NULL |
Returns : |
new librdf_node object or NULL on failure |
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.
|
redland world object |
|
literal UTF-8 encoded string value |
|
literal XML language (or NULL, empty string) |
|
URI of typed literal datatype or NULL |
Returns : |
new librdf_node object or NULL on failure |
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.
|
redland world object |
|
librdf_uri object |
Returns : |
a new librdf_node object or NULL on failure |
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.
|
redland world object |
|
librdf_uri object |
|
local name to append to URI |
Returns : |
a new librdf_node object or NULL on failure |
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.
|
redland world object |
|
string representing a URI |
Returns : |
a new librdf_node object or NULL on failure |
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.
|
librdf_world |
|
pointer to bytes used or NULL |
|
the buffer to use |
|
buffer size |
Returns : |
new node or NULL on failure (bad encoding, allocation failure) |
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
|
the node to serialise |
|
the buffer to use |
|
buffer size |
Returns : |
the number of bytes written or 0 on failure. |
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.
|
first librdf_node node |
|
second librdf_node node |
Returns : |
non 0 if nodes are equal. 0 if not-equal or failure |
unsigned char * librdf_node_get_blank_identifier (librdf_node *node
);
Get the blank node identifier as a UTF-8 encoded string.
|
the node object |
Returns : |
the UTF-8 encoded blank node identifier value or NULL on failure |
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.
|
the node object |
|
pointer to variable to store length (or NULL) |
Returns : |
the UTF-8 encoded blank node identifier value or NULL on failure |
int librdf_node_get_li_ordinal (librdf_node *node
);
Get the node li object ordinal value.
|
the node object |
Returns : |
the li ordinal value or < 1 on failure |
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.
|
the node object |
Returns : |
the UTF-8 encoded literal string or NULL if node is not a literal |
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.
|
the node object |
|
pointer to location to store the string length (or NULL) |
Returns : |
the UTF-8 encoded literal string or NULL if node is not a literal |
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).
|
the node object |
Returns : |
the Latin-1 literal string or NULL if node is not a literal |
librdf_uri * librdf_node_get_literal_value_datatype_uri
(librdf_node *node
);
Get the typed literal datatype URI of the literal node.
|
the node object |
Returns : |
shared URI of the datatyped literal or NULL if the node is not a literal, or has no datatype URI |
int librdf_node_get_literal_value_is_wf_xml
(librdf_node *node
);
Get the XML well-formness property of the node.
|
the node object |
Returns : |
0 if the XML literal is NOT well formed XML content, or the node is not a literal |
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.
|
the node object |
Returns : |
the XML language string or NULL if node is not a literal or there is no XML language defined. |
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.
|
the node object |
Returns : |
the node type |
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.
|
the node object |
Returns : |
URI object or NULL if node has no URI. |
int librdf_node_is_blank (librdf_node *node
);
Check node is a blank nodeID.
|
the node object |
Returns : |
non-zero if the node is a blank nodeID |
int librdf_node_is_literal (librdf_node *node
);
Check node is a literal.
|
the node object |
Returns : |
non-zero if the node is a literal |
int librdf_node_is_resource (librdf_node *node
);
Check node is a resource.
|
the node object |
Returns : |
non-zero if the node is a resource (URI) |
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.
|
world object |
|
static array of librdf_node objects |
|
size of array |
Returns : |
a librdf_iterator serialization of the nodes or NULL on failure |
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.
|
the node |
|
file handle |
librdf_iterator * librdf_node_static_iterator_create (librdf_node **nodes
,int size
);
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()
|
static array of librdf_node objects |
|
size of array |
Returns : |
NULL |
unsigned char * librdf_node_to_counted_string (librdf_node *node
,size_t *len_p
);
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.
|
the node object |
|
pointer to location to store length |
Returns : |
a string value representing the node or NULL on failure |
unsigned char * librdf_node_to_string (librdf_node *node
);
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.
|
the node object |
Returns : |
a string value representing the node or NULL on failure |
typedef enum { LIBRDF_NODE_TYPE_UNKNOWN = RAPTOR_TERM_TYPE_UNKNOWN, LIBRDF_NODE_TYPE_RESOURCE = RAPTOR_TERM_TYPE_URI, LIBRDF_NODE_TYPE_LITERAL = RAPTOR_TERM_TYPE_LITERAL, LIBRDF_NODE_TYPE_BLANK = RAPTOR_TERM_TYPE_BLANK, LIBRDF_NODE_TYPE_LAST = LIBRDF_NODE_TYPE_BLANK } librdf_node_type;
Type of a redland node.
Better to check this with functions librdf_node_is_resource()
,
librdf_node_is_literal()
or librdf_node_is_blank()
.
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.
|
the node |
|
iostream to write to |
Returns : |
non-0 on failure |
Navigation: Redland Home Page