|
Soprano
2.9.2
|
Soprano::Serializer defines the interface for a Soprano RDF serializer plugin. More...
#include <Soprano/Serializer>
Inheritance diagram for Soprano::Serializer:Public Member Functions | |
| virtual | ~Serializer () |
| virtual RdfSerializations | supportedSerializations () const =0 |
| virtual QStringList | supportedUserSerializations () const |
| bool | supportsSerialization (RdfSerialization s, const QString &userSerialization=QString()) const |
| virtual bool | serialize (StatementIterator it, QTextStream &stream, RdfSerialization serialization, const QString &userSerialization=QString()) const =0 |
| void | addPrefix (const QString &qname, const QUrl &uri) const |
| void | clearPrefixes () const |
| QHash< QString, QUrl > | prefixes () const |
Public Member Functions inherited from Soprano::Plugin | |
| virtual | ~Plugin () |
| QString | pluginName () const |
| virtual bool | isAvailable () const |
Public Member Functions inherited from Soprano::Error::ErrorCache | |
| virtual | ~ErrorCache () |
| virtual Error | lastError () const |
Protected Member Functions | |
| Serializer (const QString &name) | |
Protected Member Functions inherited from Soprano::Plugin | |
| Plugin (const QString &name) | |
Protected Member Functions inherited from Soprano::Error::ErrorCache | |
| ErrorCache () | |
| void | clearError () const |
| void | setError (const Error &) const |
| void | setError (const QString &errorMessage, int code=ErrorUnknown) const |
Soprano::Serializer defines the interface for a Soprano RDF serializer plugin.
Each serializer plugin may support multiple RDF serializations (supportedSerializations()).
Using a Serializer is straightforward. One starts by getting a plugin that supports the requested RDF data serialization:
Then serializing RDF data is done in a single method call which writes the serialized data to a QTextStream:
Definition at line 68 of file serializer.h.
|
virtual |
|
protected |
|
pure virtual |
The serialiazation types supported by this serializer.
|
virtual |
A serializer can support additional RDF serializations that are not defined in Soprano::RdfSerialization. In that case supportedSerializations() has to include Soprano::SerializationUser.
The default implementation returns an empty list.
| bool Soprano::Serializer::supportsSerialization | ( | RdfSerialization | s, |
| const QString & | userSerialization = QString() |
||
| ) | const |
Check if a plugin supports a specific serialization.
| s | The requested serialization. |
| userSerialization | If serialization is set to Soprano::SerializationUser this parameter specifies the requested serialization. It allows the extension of the Soprano Serializer interface with new RDF serializations that are not officially supported by Soprano. |
true if the serializer is able to parse RDF data encoded in serialization s, false otherwise.
|
pure virtual |
Serialize a list of statements.
| it | An iterator containing the statements to be serialized. |
| stream | The stream the serialized data should be written to. |
| serialization | The encoding to be used. |
| userSerialization | If serialization is set to Soprano::SerializationUser this parameter specifies the serialization to use. It allows the extension of the Soprano Serializer interface with new RDF serializations that are not officially supported by Soprano. |
true if the serialization was successful, false otherwise. Add a prefix to be used by the serializer.
Be aware that serializer instances are reused. Thus, it is highly recommended to clear prefixes after using the Serializer. A future version of Soprano will have a revised Serializer API which handles this issue more effective.
Method is const for historical reasons.
| void Soprano::Serializer::clearPrefixes | ( | ) | const |
Clear all prefixes set via addPrefix.
Method is const for historical reasons.
Retrieve all prefixes set via addPrefix.
1.8.5