Redland RDF Application Framework API Reference Manual

Dave Beckett

University of Bristol
Institute for Learning and Research Technology (ILRT)

Table of Contents
Introduction to Objects in C
RDF World
RDF World Class
librdf_new_world --  Creates a new Redland execution environment
librdf_free_world --  Terminate the library
librdf_world_init_mutex --  Create the world mutex
librdf_world_open --  Open an environment
librdf_world_set_error --  Set the world error handling function
librdf_world_set_warning --  Set the world warning handling function
librdf_world_set_logger --  Set the world log handling function
librdf_world_set_digest --  Set the default digest name
librdf_world_get_feature --  get the value of a world feature
librdf_world_set_feature --  set the value of a world feature
librdf_init_world --  Initialise the library (DEPRECATED)
librdf_destroy_world --  Terminate the library (DEPRECATED)
RDF Model
RDF Model Class
librdf_init_model --  Initialise librdf_model class
librdf_finish_model --  Terminate librdf_model class
librdf_model_register_factory --  Register a model factory
librdf_get_model_factory --  Get a model factory by name
librdf_new_model --  Constructor - create a new storage librdf_model object
librdf_new_model_with_options --  Constructor - Create a new librdf_model with storage
librdf_new_model_from_model --  Copy constructor - create a new librdf_model from an existing one
librdf_free_model --  Destructor - Destroy a librdf_model object
librdf_model_size --  get the number of statements in the model
librdf_model_add_statement --  Add a statement to the model
librdf_model_add_statements --  Add a stream of statements to the model
librdf_model_add --  Create and add a new statement about a resource to the model
librdf_model_add_typed_literal_statement --  Create and add a new statement about a typed literal to the model
librdf_model_add_string_literal_statement --  Create and add a new statement about a literal to the model
librdf_model_remove_statement --  Remove a known statement from the model
librdf_model_contains_statement --  Check for a statement in the model
librdf_model_as_stream --  list the model contents as a stream of statements
librdf_model_serialise --  serialise the entire model as a stream (DEPRECATED)
librdf_model_find_statements --  find matching statements in the model
librdf_model_get_sources --  return the sources (subjects) of arc in an RDF graph given arc (predicate) and target (object)
librdf_model_get_arcs --  return the arcs (predicates) of an arc in an RDF graph given source (subject) and target (object)
librdf_model_get_targets --  return the targets (objects) of an arc in an RDF graph given source (subject) and arc (predicate)
librdf_model_get_source --  return one source (subject) of arc in an RDF graph given arc (predicate) and target (object)
librdf_model_get_arc --  return one arc (predicate) of an arc in an RDF graph given source (subject) and target (object)
librdf_model_get_target --  return one target (object) of an arc in an RDF graph given source (subject) and arc (predicate)
librdf_model_add_submodel --  add a sub-model to the model
librdf_model_remove_submodel --  remove a sub-model from the model
librdf_model_get_arcs_in --  return the properties pointing to the given resource
librdf_model_get_arcs_out --  return the properties pointing from the given resource
librdf_model_has_arc_in --  check if a node has a given property pointing to it
librdf_model_has_arc_out --  check if a node has a given property pointing from it
librdf_model_print --  print the model
librdf_model_context_add_statement --  Add a statement to a model with a context
librdf_model_context_add_statements --  Add statements to a model with a context
librdf_model_context_remove_statement --  Remove a statement from a model in a context
librdf_model_context_remove_statements --  Remove statements from a model with the given context
librdf_model_context_as_stream --  list all statements in a model context
librdf_model_context_serialize --  List all statements in a model context
librdf_model_query_execute --  Execute a query against the model
librdf_model_sync --  Synchronise the model to the model implementation
librdf_model_get_storage --  return the storage of this model
librdf_model_find_statements_in_context --  search the model for matching statements in a given context
librdf_model_get_contexts --  return the list of contexts in the graph
librdf_model_get_feature --  get the value of a graph feature
librdf_model_set_feature --  set the value of a graph feature
librdf_model_find_statements_with_options --  search the model for matching statements with match options
librdf_model_load --  Load content from a URI into the model
librdf_model_to_counted_string --  Write serialized model to a string
librdf_model_to_string --  Write serialized model to a string
librdf_model_contains_context --  Check for a context in the model
RDF Statement / Assertion / Triple
RDF Statement Class
librdf_init_statement --  Initialise the librdf_statement module
librdf_finish_statement --  Terminate the librdf_statement module
librdf_new_statement --  Constructor - create a new empty librdf_statement
librdf_new_statement_from_statement --  Copy constructor - create a new librdf_statement from an existing librdf_statement
librdf_new_statement_from_nodes --  Constructor - create a new librdf_statement from existing librdf_node objects
librdf_statement_init --  initialise a statically declared librdf_statement
librdf_statement_clear --  empty a librdf_statement of nodes
librdf_free_statement --  Destructor - destroy a librdf_statement
librdf_statement_get_subject --  Get the statement subject
librdf_statement_set_subject --  Set the statement subject
librdf_statement_get_predicate --  Get the statement predicate
librdf_statement_set_predicate --  Set the statement predicate
librdf_statement_get_object --  Get the statement object
librdf_statement_set_object --  Set the statement object
librdf_statement_is_complete --  Check if statement has all subject, predicate, object fields present
librdf_statement_to_string --  Format the librdf_statement as a string
librdf_statement_print --  pretty print the statement to a file descriptor
librdf_statement_equals --  Check if two statements are equal
librdf_statement_match --  Match a statement against a 'partial' statement
librdf_statement_encode --  Serialise a statement into a buffer
librdf_statement_encode_parts --  Serialise parts of a statement into a buffer
librdf_statement_decode --  Decodes a statement from a buffer
librdf_statement_decode_parts --  Decodes a statement + context node from a buffer
RDF Resource / Predicate / Literal
RDF Node Class
librdf_init_node --  Initialise the node module.
librdf_finish_node --  Terminate the librdf_node module
librdf_new_node --  Constructor - create a new librdf_node object with a private identifier
librdf_new_node_from_uri_string --  Constructor - create a new librdf_node object from a URI string
librdf_new_node_from_uri --  Constructor - create a new resource librdf_node object with a given URI
librdf_new_node_from_uri_local_name --  Constructor - create a new resource librdf_node object with a given URI and local name
librdf_new_node_from_normalised_uri_string --  Constructor - create a new librdf_node object from a URI string normalised to a new base URI
librdf_new_node_from_literal --  Constructor - create a new literal librdf_node object
librdf_new_node_from_typed_literal --  Constructor - create a new typed literal librdf_node object
librdf_new_node_from_blank_identifier --  Constructor - create a new literal librdf_node object from a blank node identifier
librdf_new_node_from_node --  Copy constructor - create a new librdf_node object from an existing librdf_node object
librdf_free_node --  Destructor - destroy an librdf_node object
librdf_node_get_uri --  Get the URI for a node object
librdf_node_get_type --  Get the type of the node
librdf_node_get_literal_value --  Get the string literal value of the node
librdf_node_get_literal_value_as_counted_string --  Get the string literal value of the node as a counted string
librdf_node_get_literal_value_as_latin1 --  Get the string literal value of the node as ISO Latin-1
librdf_node_get_literal_value_language --  Get the XML language of the node
librdf_node_get_literal_value_is_wf_xml --  Get the XML well-formness property of the node
librdf_node_get_literal_value_datatype_uri --  Get the typed literal datatype URI of the literal node
librdf_node_get_li_ordinal --  Get the node li object ordinal value
librdf_node_get_blank_identifier --  Get the blank node identifier
librdf_node_is_resource --  Check node is a resource
librdf_node_is_literal --  Check node is a literal
librdf_node_is_blank --  Check node is a blank nodeID
librdf_node_to_string --  Format the node as a string
librdf_node_to_counted_string --  Format the node as a counted string
librdf_node_print --  pretty print the node to a file descriptor
librdf_node_get_digest --  Get a digest representing a librdf_node
librdf_node_equals --  Compare two librdf_node objects for equality
librdf_node_encode --  Serialise a node into a buffer
librdf_node_decode --  Deserialise a node from a buffer
librdf_node_static_iterator_create --  Create an iterator over an array of nodes
RDF Parsers
RDF Parser Class
librdf_parser_register_factory --  Register a parser factory
librdf_get_parser_factory --  Get a parser factory by name
librdf_new_parser --  Constructor - create a new librdf_parser object
librdf_new_parser_from_factory --  Constructor - create a new librdf_parser object
librdf_free_parser --  Destructor - destroys a librdf_parser object
librdf_parser_parse_as_stream --  Parse a URI to a librdf_stream of statements
librdf_parser_parse_into_model --  Parse a URI of content into an librdf_model
librdf_parser_parse_string_as_stream --  Parse a string of content to a librdf_stream of statements
librdf_parser_parse_string_into_model --  Parse a string of content into an librdf_model
librdf_parser_parse_counted_string_as_stream --  Parse a counted string of content to a librdf_stream of statements
librdf_parser_parse_counted_string_into_model --  Parse a counted string of content into an librdf_model
librdf_init_parser --  Initialise the librdf_parser class
librdf_finish_parser --  Terminate the librdf_parser class
librdf_parser_set_error --  Set the parser error handling function
librdf_parser_set_warning --  Set the parser warning handling function
librdf_parser_get_feature --  get the value of a parser feature
librdf_parser_set_feature --  set the value of a parser feature
Schema Concepts
Content Digests
Digest Class
librdf_digest_register_factory --  Register a hash factory
librdf_get_digest_factory --  get a digest factory
librdf_new_digest --  Constructor - create a new librdf_digest object
librdf_new_digest_from_factory --  Constructor - create a new librdf_digest object
librdf_free_digest --  Destructor- destroy a librdf_digest object
librdf_digest_init --  (Re)initialise the librdf_digest object
librdf_digest_update --  Add more data to the librdf_digest object
librdf_digest_final --  Finish the digesting of data
librdf_digest_get_digest --  Get the calculated digested value.
librdf_digest_to_string --  Get a string representation of the digest object
librdf_digest_print --  Print the digest to a FILE handle
librdf_init_digest --  Initialise the librdf_digest class
librdf_finish_digest --  Terminate the librdf_digest class
Hashes
Hash Class
librdf_init_hash --  Initialise the librdf_hash module
librdf_finish_hash --  Terminate the librdf_hash module
librdf_new_hash_datum --  Constructor - Create a new hash datum object
librdf_free_hash_datum --  Destructor - destroy a hash datum object
librdf_hash_register_factory --  Register a hash factory
librdf_get_hash_factory --  Get a hash factory by name
librdf_new_hash --  Constructor - create a new librdf_hash object
librdf_new_hash_from_factory --  Constructor - create a new librdf_hash object from a factory
librdf_new_hash_from_hash --  Copy Constructor - create a new librdf_hash object from an existing one
librdf_free_hash --  Destructor - destroy a librdf_hash object
librdf_hash_open --  Start a hash association
librdf_hash_close --  End a hash association
librdf_hash_values_count --  Get the number of values in the hash
librdf_hash_get --  Retrieve one value from hash for a given key as string
librdf_hash_get_one --  Retrieve one value from hash for a given key
librdf_hash_get_all --  Retrieve all values from hash for a given key
librdf_hash_get_del --  Retrieve one value from hash for a given key as string and remove all values with that key
librdf_hash_put --  Insert key/value pairs into the hash according to flags
librdf_hash_exists --  Check if a given key/value is in the hash
librdf_hash_delete --  Delete a key/value pair from the hash
librdf_hash_delete_all --  Delete a key and all values from the hash
librdf_hash_keys --  Get the hash keys
librdf_hash_sync --  Flush any cached information to disk if appropriate
librdf_hash_get_fd --  Get the file descriptor for the hash
librdf_hash_print --  pretty print the hash to a file descriptor
librdf_hash_print_keys --  pretty print the keys to a file descriptor
librdf_hash_print_values --  pretty print the values of one key to a file descriptor
librdf_hash_from_string --  Initialise a hash from a string
librdf_hash_from_array_of_strings --  Initialise a hash from an array of strings
librdf_hash_get_as_boolean --  lookup a hash key and decode value as a boolean
librdf_hash_get_as_long --  lookup a hash key and decode value as a long
librdf_hash_put_strings --  Insert key/value pairs into the hash as strings
RDF Query
RDF Query Class
librdf_init_query --  Initialise the librdf_query module
librdf_finish_query --  Terminate the librdf_query module
librdf_query_register_factory --  Register a query factory
librdf_get_query_factory --  Get a query factory by name
librdf_new_query --  Constructor - create a new librdf_query object
librdf_new_query_from_query --  Copy constructor - create a new librdf_query object from an existing one
librdf_new_query_from_factory --  Constructor - create a new librdf_query object
librdf_free_query --  Destructor - destroy a librdf_query object
librdf_query_execute --  Run the query on a model
RDF QueryResults
RDF QueryResults Class
librdf_query_results_get_count --  Get number of bindings so far
librdf_query_results_next --  Move to the next result
librdf_query_results_finished --  Find out if binding results are exhausted
librdf_query_results_get_bindings --  Get all binding names, values for current result
librdf_query_results_get_binding_value --  Get one binding value for the current result
librdf_query_results_get_binding_name --  Get binding name for the current result
librdf_query_results_get_binding_value_by_name --  Get one binding value for a given name in the current result
librdf_query_results_get_bindings_count --  Get the number of bound variables in the result
librdf_free_query_results --  Destructor - destroy a librdf_query_results object
librdf_query_results_to_counted_string --  Turn a query results into a string
librdf_query_results_to_string --  Turn a query results into a string
librdf_query_results_to_file_handle --  Write a query results to a FILE*
librdf_query_results_to_file --  Write a query results to a file
librdf_query_results_is_bindings --  test if librdf_query_results is variable bindings format
librdf_query_results_is_boolean --  test if librdf_query_results is boolean format
librdf_query_results_is_graph --  test if librdf_query_results is RDF graph format
librdf_query_results_get_boolean --  Get boolean query result
librdf_query_results_as_stream --  Get RDF graph query result
RDF Serializer
RDF Serializer Class
librdf_serializer_register_factory --  Register a serializer factory
librdf_get_serializer_factory --  Get a serializer factory by name
librdf_new_serializer --  Constructor - create a new librdf_serializer object
librdf_new_serializer_from_factory --  Constructor - create a new librdf_serializer object
librdf_free_serializer --  Destructor - destroys a librdf_serializer object
librdf_serializer_serialize_model --  Write a serialized librdf_mode to a FILE*
librdf_serializer_serialize_model_to_file_handle --  Write a serialized librdf_model to a FILE*
librdf_serializer_serialize_model_to_file --  Write a serialized librdf_model to a file
librdf_serializer_serialize_model_to_counted_string --  Write a serialized librdf_model to a counted string
librdf_serializer_serialize_model_to_string --  Write a serialized librdf_model to a string
librdf_init_serializer --  Initialise the librdf_serializer class
librdf_finish_serializer --  Terminate the librdf_serializer class
librdf_serializer_set_error --  Set the serializer error handling function
librdf_serializer_set_warning --  Set the serializer warning handling function
librdf_serializer_get_feature --  Get the value of a serializer feature
librdf_serializer_set_feature --  Set the value of a serializer feature
librdf_serializer_set_namespace --  Set a namespace URI/prefix mapping
RDF Model Storage
RDF Model Storage Class
librdf_init_storage --  Initialise the librdf_storage module
librdf_finish_storage --  Terminate the librdf_storage module
librdf_storage_register_factory --  Register a storage factory
librdf_get_storage_factory --  Get a storage factory by name
librdf_storage_enumerate --  Get information on storages
librdf_new_storage --  Constructor - create a new librdf_storage object
librdf_new_storage_with_options --  Constructor - create a new librdf_storage object
librdf_new_storage_from_storage --  Copy constructor - create a new librdf_storage object from an existing one
librdf_new_storage_from_factory --  Constructor - create a new librdf_storage object
librdf_free_storage --  Destructor - destroy a librdf_storage object
librdf_storage_open --  Start a model / storage association
librdf_storage_close --  End a model / storage association
librdf_storage_size --  Get the number of statements stored
librdf_storage_add_statement --  Add a statement to a storage
librdf_storage_add_statements --  Add a stream of statements to the storage
librdf_storage_remove_statement --  Remove a statement from the storage
librdf_storage_contains_statement --  Test if a given statement is present in the storage
librdf_storage_serialise --  Serialise the storage as a librdf_stream of statemetns
librdf_storage_find_statements --  search the storage for matching statements
librdf_storage_get_sources --  return the sources (subjects) of arc in an RDF graph given arc (predicate) and target (object)
librdf_storage_get_arcs --  return the arcs (predicates) of an arc in an RDF graph given source (subject) and target (object)
librdf_storage_get_targets --  return the targets (objects) of an arc in an RDF graph given source (subject) and arc (predicate)
librdf_storage_get_arcs_in --  return the properties pointing to the given resource
librdf_storage_get_arcs_out --  return the properties pointing from the given resource
librdf_storage_has_arc_in --  check if a node has a given property pointing to it
librdf_storage_has_arc_out --  check if a node has a given property pointing from it
librdf_storage_context_add_statement --  Add a statement to a storage in a context
librdf_storage_context_add_statements --  Add statements to a storage with a context
librdf_storage_context_remove_statement --  Remove a statement from a storage in a context
librdf_storage_context_remove_statements --  Remove statements from a storage with the given context
librdf_storage_context_as_stream --  List all statements in a storage context
librdf_storage_context_serialise --  List all statements in a storage context (DEPRECATED)
librdf_storage_find_statements_in_context --  search the storage for matching statements in a given context
librdf_storage_get_contexts --  return the list of contexts in the store
librdf_storage_get_feature --  get the value of a storage feature
librdf_storage_set_feature --  set the value of a storage feature
librdf_storage_find_statements_with_options --  search the storage for matching statements with match options
Streams - Sequences of Statements
RDF Statement Stream Class
librdf_new_stream --  Constructor - create a new librdf_stream
librdf_free_stream --  Destructor - destroy an libdf_stream object
librdf_stream_end --  Test if the stream has ended
librdf_stream_next --  Move to the next librdf_statement in the stream
librdf_stream_get_object --  Get the current librdf_statement in the stream
librdf_stream_get_context --  Get the context of the current object on the stream
librdf_stream_add_map --  Add a librdf_stream mapping function
librdf_new_stream_from_node_iterator --  Constructor - create a new librdf_stream from an iterator of nodes
librdf_stream_print --  print the stream
Data Iterators
Iterator Class
librdf_new_iterator --  Constructor - create a new librdf_iterator object
librdf_free_iterator --  Destructor - destroy a librdf_iterator object
librdf_iterator_have_elements --  Test if the iterator has finished
librdf_iterator_end --  Test if the iterator has finished
librdf_iterator_next --  Move to the next iterator element
librdf_iterator_get_object --  Get the current object from the iterator
librdf_iterator_get_context --  Get the context of the current object on the iterator
librdf_iterator_get_key --  Get the key of the current object on the iterator
librdf_iterator_get_value --  Get the value of the current object on the iterator
librdf_iterator_add_map --  Add a librdf_iterator mapping function
URIs
URI Class
librdf_init_uri --  Initialise the librdf_uri class
librdf_finish_uri --  Terminate the librdf_uri class
librdf_new_uri --  Constructor - create a new librdf_uri object from a URI string
librdf_new_uri_from_uri --  Copy constructor - create a new librdf_uri object from an existing librdf_uri object
librdf_new_uri_from_uri_local_name --  Copy constructor - create a new librdf_uri object from an existing librdf_uri object and a local name
librdf_new_uri_normalised_to_base --  Constructor - create a new librdf_uri object from a URI string stripped of the source URI, made relative to the base URI
librdf_new_uri_relative_to_base --  Constructor - create a new librdf_uri object from a URI string relative to a base URI
librdf_new_uri_from_filename --  Constructor - create a new librdf_uri object from a filename
librdf_free_uri --  Destructor - destroy a librdf_uri object
librdf_uri_as_string --  Get a pointer to the string representation of the URI
librdf_uri_as_counted_string --  Get a pointer to the string representation of the URI with length
librdf_uri_get_digest --  Get a digest for the URI
librdf_uri_print --  Print the URI to the given file handle
librdf_uri_to_string --  Format the URI as a string
librdf_uri_to_counted_string --  Format the URI as a counted string
librdf_uri_equals --  Compare two librdf_uri objects for equality
librdf_uri_is_file_uri --  Test if a URI points to a filename
librdf_uri_to_filename --  Return pointer to filename of URI
UTF-8
UTF8 Class
librdf_unicode_char_to_utf8 --  Convert a Unicode character to UTF-8 encoding
librdf_utf8_to_unicode_char --  Convert an UTF-8 encoded buffer to a Unicode character
librdf_utf8_to_latin1 --  Convert a UTF-8 string to ISO Latin-1
librdf_latin1_to_utf8 --  Convert an ISO Latin-1 encoded string to UTF-8
librdf_utf8_print --  Print a UTF-8 string to a stream
Heuristics
Heuristic functions
librdf_heuristic_is_blank_node --  try to guess if an node string is a blank node identifier
librdf_heuristic_get_blank_node --  get a blank node identifier from a node string
librdf_heuristic_object_is_literal --  try to guess if an object string is a literal or a resource
librdf_heuristic_gen_name --  Generate a new name from an existing name