Top | ![]() |
![]() |
![]() |
![]() |
An object representing an RDF Triple of three RDF terms (librdf_node). Triples can be created, accessed, destroyed and en/decoded into a binary form for use in storage.
librdf_statement *
librdf_new_statement (librdf_world *world
);
Constructor - create a new empty librdf_statement.
librdf_statement *
librdf_new_statement_from_statement (librdf_statement *statement
);
Copy constructor - create a new librdf_statement from an existing librdf_statement. Creates a deep copy - changes to original statement nodes are not reflected in the copy.
librdf_statement *
librdf_new_statement_from_statement2 (librdf_statement *statement
);
Copy constructor - create a new librdf_statement from an existing librdf_statement. Creates a shallow copy - changes to original statement nodes are reflected in the copy.
librdf_statement * librdf_new_statement_from_nodes (librdf_world *world
,librdf_node *subject
,librdf_node *predicate
,librdf_node *object
);
Constructor - create a new librdf_statement from existing librdf_node objects.
The node objects become owned by the new statement (or freed on error).
void librdf_statement_init (librdf_world *world
,librdf_statement *statement
);
Initialise a statically declared librdf_statement.
This MUST be called on a statically declared librdf_statement to initialise it properly. It is the responsibility of the user of the statically allocated librdf_statement to deal with deallocation of any statement parts (subject, predicate, object).
void
librdf_statement_clear (librdf_statement *statement
);
Empty a librdf_statement of nodes.
void
librdf_free_statement (librdf_statement *statement
);
Destructor - destroy a librdf_statement.
librdf_node *
librdf_statement_get_subject (librdf_statement *statement
);
Get the statement subject.
This method returns a SHARED pointer to the subject which must be copied by the caller if needed.
void librdf_statement_set_subject (librdf_statement *statement
,librdf_node *node
);
Set the statement subject.
The subject passed in becomes owned by the statement object and must not be used by the caller after this call.
librdf_node *
librdf_statement_get_predicate (librdf_statement *statement
);
Get the statement predicate.
This method returns a SHARED pointer to the predicate which must be copied by the caller if needed.
void librdf_statement_set_predicate (librdf_statement *statement
,librdf_node *node
);
Set the statement predicate.
The predicate passed in becomes owned by the statement object and must not be used by the caller after this call.
librdf_node *
librdf_statement_get_object (librdf_statement *statement
);
Get the statement object.
This method returns a SHARED pointer to the object which must be copied by the caller if needed.
void librdf_statement_set_object (librdf_statement *statement
,librdf_node *node
);
Set the statement object.
The object passed in becomes owned by the statement object and must not be used by the caller after this call.
int
librdf_statement_is_complete (librdf_statement *statement
);
Check if statement is a complete and legal RDF triple.
Checks that all subject, predicate, object fields are present and they have the allowed node types.
unsigned char *
librdf_statement_to_string (librdf_statement *statement
);
librdf_statement_to_string
is deprecated and should not be used in newly-written code.
Format the librdf_statement as a string.
Formats the statement as a newly allocate string that must be freed by the caller.
Deprecated
: Use librdf_statement_write()
to write to
raptor_iostream which can be made to write to a string. Use a
librdf_serializer to write proper syntax formats.
void librdf_statement_print (librdf_statement *statement
,FILE *fh
);
Pretty print the statement to a file descriptor.
This method is for debugging and the format of the output should not be relied on.
int librdf_statement_equals (librdf_statement *statement1
,librdf_statement *statement2
);
Check if two statements are equal.
int librdf_statement_match (librdf_statement *statement
,librdf_statement *partial_statement
);
Match a statement against a 'partial' statement.
A partial statement is where some parts of the statement -
subject, predicate or object can be empty (NULL).
Empty parts match against any value, parts with values
must match exactly. Node matching is done via librdf_node_equals()
size_t librdf_statement_encode (librdf_statement *statement
,unsigned char *buffer
,size_t length
);
librdf_statement_encode
is deprecated and should not be used in newly-written code.
Serialise a statement into a buffer.
Encodes the given statement 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.
Deprecated
: Use librdf_statement_encode2()
size_t librdf_statement_encode2 (librdf_world *world
,librdf_statement *statement
,unsigned char *buffer
,size_t length
);
Serialise a statement into a buffer.
Encodes the given statement 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.
size_t librdf_statement_encode_parts (librdf_statement *statement
,librdf_node *context_node
,unsigned char *buffer
,size_t length
,librdf_statement_part fields
);
librdf_statement_encode_parts
is deprecated and should not be used in newly-written code.
Serialise parts of a statement into a buffer.
Encodes the given statement 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.
The fields values are or-ed combinations of: LIBRDF_STATEMENT_SUBJECT LIBRDF_STATEMENT_PREDICATE LIBRDF_STATEMENT_OBJECT or LIBRDF_STATEMENT_ALL for subject,prdicate,object fields
If context_node is given, it is encoded also
Deprecated
: This will no longer be a public API
statement |
statement to serialise |
|
context_node |
librdf_node context node (can be NULL) |
|
buffer |
the buffer to use |
|
length |
buffer size |
|
fields |
fields to encode |
size_t librdf_statement_encode_parts2 (librdf_world *world
,librdf_statement *statement
,librdf_node *context_node
,unsigned char *buffer
,size_t length
,librdf_statement_part fields
);
Serialise parts of a statement into a buffer.
Encodes the given statement 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.
The fields values are or-ed combinations of: LIBRDF_STATEMENT_SUBJECT LIBRDF_STATEMENT_PREDICATE LIBRDF_STATEMENT_OBJECT or LIBRDF_STATEMENT_ALL for subject,prdicate,object fields
If context_node is given, it is encoded also
world |
redland world object |
|
statement |
statement to serialise |
|
context_node |
librdf_node context node (can be NULL) |
|
buffer |
the buffer to use |
|
length |
buffer size |
|
fields |
fields to encode |
size_t librdf_statement_decode (librdf_statement *statement
,unsigned char *buffer
,size_t length
);
librdf_statement_decode
is deprecated and should not be used in newly-written code.
Decodes a statement from a buffer. (ALWAYS FAILS)
Used to decode the serialised statement as created by
librdf_statement_encode()
from the given buffer.
Deprecated
: Replaced by librdf_statement_decode2()
which works.
size_t librdf_statement_decode2 (librdf_world *world
,librdf_statement *statement
,librdf_node **context_node
,unsigned char *buffer
,size_t length
);
Decodes a statement + context node from a buffer.
Decodes the serialised statement (as created by librdf_statement_encode()
)
from the given buffer. If a context node is found and context_node is
not NULL, a pointer to the new librdf_node is stored in *context_node.
world |
redland world |
|
statement |
the statement to deserialise into |
|
context_node |
pointer to librdf_node context_node to deserialise into |
|
buffer |
the buffer to use |
|
length |
buffer size |
size_t librdf_statement_decode_parts (librdf_statement *statement
,librdf_node **context_node
,unsigned char *buffer
,size_t length
);
librdf_statement_decode_parts
is deprecated and should not be used in newly-written code.
Decodes a statement + context node from a buffer. (ALWAYS FAILS)
Used to decode the serialised statement as created by
librdf_statement_encode()
from the given buffer.
Deprecated
: Replaced by librdf_statement_decode2()
which works.
statement |
the statement to deserialise into |
|
context_node |
pointer to librdf_node context_node to deserialise into |
|
buffer |
the buffer to use |
|
length |
buffer size |
int librdf_statement_write (librdf_statement *statement
,raptor_iostream *iostr
);
Write the statement to an iostream
This method is for debugging and the format of the output should not be relied on.
Flags that are or-ed to indicate statement parts.
Used in fields arguments to methods such as the public
librdf_statement_encode_parts()
librdf_statement_decode_parts()
librdf_new_stream_from_node_iterator()
.