Top | ![]() |
![]() |
![]() |
![]() |
#define | LIBRDF_STORAGE_INTERFACE_VERSION |
#define | LIBRDF_STORAGE_MAX_INTERFACE_VERSION |
#define | LIBRDF_STORAGE_MIN_INTERFACE_VERSION |
typedef | librdf_storage |
typedef | librdf_storage_factory |
typedef | librdf_storage_instance |
int librdf_storage_register_factory (librdf_world *world
,const char *name
,const char *label
,void (*factory) (librdf_storage_factory*)
);
Register a storage factory.
Registration will fail if any of the parameters or NULL, if the factory API version is out of the known range or if out of memory.
int librdf_storage_enumerate (librdf_world *world
,const unsigned int counter
,const char **name
,const char **label
);
Get information on storages.
librdf_storage * librdf_new_storage (librdf_world *world
,const char *storage_name
,const char *name
,const char *options_string
);
Constructor - create a new librdf_storage object.
The options are encoded as described in librdf_hash_from_string()
and can be NULL if none are required.
librdf_storage * librdf_new_storage_with_options (librdf_world *world
,const char *storage_name
,const char *name
,librdf_hash *options
);
Constructor - create a new librdf_storage object.
The options can be NULL if none are required.
world |
redland world object |
|
storage_name |
the storage factory name |
|
name |
an identifier for the storage |
|
options |
librdf_hash of options to use |
librdf_storage *
librdf_new_storage_from_storage (librdf_storage *old_storage
);
Copy constructor - create a new librdf_storage object from an existing one
Should create a new storage in the same context as the existing one as appropriate for the storage. For example, in a RDBMS storage it would be a new database, or in on disk it would be a new set of files. This will mean automatically generating a new identifier for the storage, maybe based on the existing storage identifier.
librdf_storage * librdf_new_storage_from_factory (librdf_world *world
,librdf_storage_factory *factory
,const char *name
,librdf_hash *options
);
Constructor - create a new librdf_storage object.
If the options are present, they become owned by the storage and should no longer be used.
world |
redland world object |
|
factory |
the factory to use to construct the storage |
|
name |
name to use for storage |
|
options |
librdf_hash of options to initialise storage |
void
librdf_free_storage (librdf_storage *storage
);
Destructor - destroy a librdf_storage object.
int librdf_storage_open (librdf_storage *storage
,librdf_model *model
);
Start a model / storage association.
This is ended with librdf_storage_close()
int
librdf_storage_close (librdf_storage *storage
);
End a model / storage association.
int
librdf_storage_size (librdf_storage *storage
);
Get the number of statements stored.
int librdf_storage_add_statement (librdf_storage *storage
,librdf_statement *statement
);
Add a statement to a storage.
The passed-in statement is copied when added to the store, not shared with the store.
If the statement already exists in the store, it is not added unless Redland contexts are being used.
Enforces that the statement is legal for RDF - URI or blank subject, URI predicate and URI or blank or literal object (i.e. anything).
int librdf_storage_add_statements (librdf_storage *storage
,librdf_stream *statement_stream
);
Add a stream of statements to the storage.
If any of the statements already exists in the store, they are not added unless Redland contexts are being used.
int librdf_storage_remove_statement (librdf_storage *storage
,librdf_statement *statement
);
Remove a statement from the storage.
int librdf_storage_contains_statement (librdf_storage *storage
,librdf_statement *statement
);
Test if a given statement is present in the storage.
librdf_stream *
librdf_storage_serialise (librdf_storage *storage
);
Serialise the storage as a librdf_stream of statemetns.
librdf_stream * librdf_storage_find_statements (librdf_storage *storage
,librdf_statement *statement
);
Search the storage for matching statements.
Searches the storage for a (partial) statement as described in
librdf_statement_match()
and returns a librdf_stream of
matching librdf_statement objects.
librdf_stream * librdf_storage_find_statements_with_options (librdf_storage *storage
,librdf_statement *statement
,librdf_node *context_node
,librdf_hash *options
);
Search the storage for matching statements with match options.
Searches the storage for a (partial) statement as described in
librdf_statement_match()
and returns a librdf_stream of
matching librdf_statement objects.
If options is given then the match is made according to the given options. If options is NULL, this is equivalent to librdf_storage_find_statements_in_context.
storage |
librdf_storage object |
|
statement |
librdf_statement partial statement to find |
|
context_node |
librdf_node context node or NULL. |
|
options |
librdf_hash of matching options or NULL |
librdf_iterator * librdf_storage_get_sources (librdf_storage *storage
,librdf_node *arc
,librdf_node *target
);
Return the sources (subjects) of arc in an RDF graph given arc (predicate) and target (object).
Searches the storage for arcs matching the given arc and target and returns a list of the source librdf_node objects as an iterator
librdf_iterator * librdf_storage_get_arcs (librdf_storage *storage
,librdf_node *source
,librdf_node *target
);
Return the arcs (predicates) of an arc in an RDF graph given source (subject) and target (object).
Searches the storage for arcs matching the given source and target and returns a list of the arc librdf_node objects as an iterator
librdf_iterator * librdf_storage_get_targets (librdf_storage *storage
,librdf_node *source
,librdf_node *arc
);
Return the targets (objects) of an arc in an RDF graph given source (subject) and arc (predicate).
Searches the storage for targets matching the given source and arc and returns a list of the source librdf_node objects as an iterator
librdf_iterator * librdf_storage_get_arcs_in (librdf_storage *storage
,librdf_node *node
);
Return the properties pointing to the given resource.
librdf_iterator * librdf_storage_get_arcs_out (librdf_storage *storage
,librdf_node *node
);
Return the properties pointing from the given resource.
int librdf_storage_has_arc_in (librdf_storage *storage
,librdf_node *node
,librdf_node *property
);
Check if a node has a given property pointing to it.
storage |
librdf_storage object |
|
node |
librdf_node resource node |
|
property |
librdf_node property node |
int librdf_storage_has_arc_out (librdf_storage *storage
,librdf_node *node
,librdf_node *property
);
Check if a node has a given property pointing from it.
storage |
librdf_storage object |
|
node |
librdf_node resource node |
|
property |
librdf_node property node |
int librdf_storage_context_add_statement (librdf_storage *storage
,librdf_node *context
,librdf_statement *statement
);
Add a statement to a storage in a context.
If context
is NULL, this is equivalent to librdf_storage_add_statement
storage |
librdf_storage object |
|
context |
librdf_node context node |
|
statement |
librdf_statement statement to add |
int librdf_storage_context_add_statements (librdf_storage *storage
,librdf_node *context
,librdf_stream *stream
);
Add statements to a storage with a context.
If context
is NULL, this is equivalent to librdf_storage_add_statements
storage |
librdf_storage object |
|
context |
librdf_node context |
|
stream |
librdf_stream stream object |
int librdf_storage_context_remove_statement (librdf_storage *storage
,librdf_node *context
,librdf_statement *statement
);
Remove a statement from a storage in a context.
If context
is NULL, this is equivalent to librdf_storage_remove_statement
storage |
librdf_storage object |
|
context |
librdf_node context node |
|
statement |
librdf_statement statement to remove |
int librdf_storage_context_remove_statements (librdf_storage *storage
,librdf_node *context
);
Remove statements from a storage with the given context.
librdf_stream * librdf_storage_context_as_stream (librdf_storage *storage
,librdf_node *context
);
List all statements in a storage context.
librdf_stream * librdf_storage_context_serialise (librdf_storage *storage
,librdf_node *context
);
librdf_storage_context_serialise
is deprecated and should not be used in newly-written code.
List all statements in a storage context (DEPRECATED).
DEPRECATED to reduce confusion with the librdf_serializer class. Please use librdf_storage_context_as_stream.
int librdf_storage_supports_query (librdf_storage *storage
,librdf_query *query
);
Check if a storage system supports a query language.
librdf_query_results * librdf_storage_query_execute (librdf_storage *storage
,librdf_query *query
);
Run the given query against the storage.
Not implemented.
int
librdf_storage_sync (librdf_storage *storage
);
Synchronise the storage to the storage implementation.
librdf_stream * librdf_storage_find_statements_in_context (librdf_storage *storage
,librdf_statement *statement
,librdf_node *context_node
);
Search the storage for matching statements in a given context.
Searches the storage for a (partial) statement as described in
librdf_statement_match()
in the given context and returns a
librdf_stream of matching librdf_statement objects. If
context is NULL, this is equivalent to librdf_storage_find_statements.
storage |
librdf_storage object |
|
statement |
librdf_statement partial statement to find |
|
context_node |
context librdf_node (or NULL) |
librdf_iterator *
librdf_storage_get_contexts (librdf_storage *storage
);
Return the list of contexts in the store.
Returns an iterator of librdf_node context nodes for each context in the store.
librdf_node * librdf_storage_get_feature (librdf_storage *storage
,librdf_uri *feature
);
Get the value of a storage feature.
int librdf_storage_set_feature (librdf_storage *storage
,librdf_uri *feature
,librdf_node *value
);
Set the value of a storage feature.
storage |
librdf_storage object |
|
feature |
librdf_uri feature property |
|
value |
librdf_node feature property value |
int
librdf_storage_transaction_commit (librdf_storage *storage
);
Commit a transaction.
void *
librdf_storage_transaction_get_handle (librdf_storage *storage
);
Get the current transaction handle.
int
librdf_storage_transaction_rollback (librdf_storage *storage
);
Rollback a transaction.
int
librdf_storage_transaction_start (librdf_storage *storage
);
Start a transaction
int librdf_storage_transaction_start_with_handle (librdf_storage *storage
,void *handle
);
Start a transaction using an existing external transaction object.
void
librdf_storage_add_reference (librdf_storage *storage
);
Increment storage reference count by one.
This function is intended to be internal to librdf storage modules.
void
librdf_storage_remove_reference (librdf_storage *storage
);
Decrement storage reference count by one and free the storage if reference count becomes zero.
This function is intended to be internal to librdf storage modules.
librdf_storage_instance
librdf_storage_get_instance (librdf_storage *storage
);
Get instance data for this storage
void librdf_storage_set_instance (librdf_storage *storage
,librdf_storage_instance instance
);
Set the instance data for this storage.
This function is intended for use by the 'init' method of storage
implementations to set instance data which can be retrived with
librdf_storage_get_instance()
and used in other methods of that
storage.
The instance is completely opaque to librdf, including allocation and deallocation.
librdf_world *
librdf_storage_get_world (librdf_storage *storage
);
Get the librdf_world object associated with this storage.
void
(*librdf_storage_module_register_function)
(librdf_world *world
);
Registration function for storage
A storage module must define and export a function named of this type with function name "librdf_storage_module_register_factory".
This function will be called by Redland and must call
librdf_storage_register_factory()
to register whatever storage
backends are implemented in the module.
#define LIBRDF_STORAGE_INTERFACE_VERSION LIBRDF_STORAGE_MAX_INTERFACE_VERSION
Default librdf storage module interface version.
#define LIBRDF_STORAGE_MAX_INTERFACE_VERSION 1
Newest supported librdf storage module interface version.
#define LIBRDF_STORAGE_MIN_INTERFACE_VERSION 1
Oldest support librdf storage module interface version.
typedef struct librdf_storage_factory_s librdf_storage_factory;
A Storage Factory
typedef void* librdf_storage_instance;
Opaque storage module instance handle.
For use with a storage module and the librdf_storage_get_instance()
and librdf_storage_set_instance()
functions. The instance handle
should be set in the librdf_storage_factory init factory method.