• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDE Support
  • Sitemap
  • Contact Us
 

soprano

Soprano::Serializer

Soprano::Serializer Class Reference

Soprano::Serializer defines the interface for a Soprano RDF serializer plugin. More...

#include <Soprano/Serializer>

Inheritance diagram for Soprano::Serializer:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~Serializer ()
void addPrefix (const QString &qname, const QUrl &uri) const
void clearPrefixes () const
QHash< QString, QUrl > prefixes () const
virtual bool serialize (StatementIterator it, QTextStream &stream, RdfSerialization serialization, const QString &userSerialization=QString()) const =0
virtual RdfSerializations supportedSerializations () const =0
virtual QStringList supportedUserSerializations () const
bool supportsSerialization (RdfSerialization s, const QString &userSerialization=QString()) const

Protected Member Functions

 Serializer (const QString &name)

Detailed Description

Soprano::Serializer defines the interface for a Soprano RDF serializer plugin.

Each serializer plugin may support multiple RDF serializations (supportedSerializations()).

Usage

Using a Serializer is straightforward. One starts by getting a plugin that supports the requested RDF data serialization:

 Soprano::Serializer* s = Soprano::PluginManager::instance()->discoverSerializerForSerialization( Soprano::SerializationRdfXml );

Then serializing RDF data is done in a single method call which writes the serialized data to a QTextStream:

 QTextStream stream( stdout );
 s->serialize( model->listStatements(), stream, Soprano::SerializationRdfXml );
See also:
Writing Soprano Plugins
Author:
Sebastian Trueg <trueg@kde.org>

Definition at line 68 of file serializer.h.


Constructor & Destructor Documentation

virtual Soprano::Serializer::~Serializer (  )  [virtual]
Soprano::Serializer::Serializer ( const QString &  name  )  [protected]

Member Function Documentation

void Soprano::Serializer::addPrefix ( const QString &  qname,
const QUrl &  uri 
) const

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.

Since:
2.3
void Soprano::Serializer::clearPrefixes (  )  const

Clear all prefixes set via addPrefix.

Method is const for historical reasons.

Since:
2.3
QHash<QString, QUrl> Soprano::Serializer::prefixes (  )  const

Retrieve all prefixes set via addPrefix.

Returns:
a QHash containing of the prefixe qnames and their URIs.
Since:
2.3
virtual bool Soprano::Serializer::serialize ( StatementIterator  it,
QTextStream &  stream,
RdfSerialization  serialization,
const QString &  userSerialization = QString() 
) const [pure virtual]

Serialize a list of statements.

Parameters:
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.
Returns:
true if the serialization was successful, false otherwise.
virtual RdfSerializations Soprano::Serializer::supportedSerializations (  )  const [pure virtual]

The serialiazation types supported by this serializer.

Returns:
A combination of Soprano::RdfSerialization types. If the list contains Soprano::SerializationUser the serializer supports additional RDF serialiazations not officially supported by Soprano.
virtual QStringList Soprano::Serializer::supportedUserSerializations (  )  const [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.

Returns:
A list of supported user RDF serializations.
bool Soprano::Serializer::supportsSerialization ( RdfSerialization  s,
const QString &  userSerialization = QString() 
) const

Check if a plugin supports a specific serialization.

Parameters:
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.
Returns:
true if the serializer is able to parse RDF data encoded in serialization s, false otherwise.

The documentation for this class was generated from the following file:
  • serializer.h

soprano

Skip menu "soprano"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE Support

Skip menu "KDE Support"
  • akonadi
  • Decibel
  • grantlee
  • kdewin
  • phonon
  •     Backend
  • polkit-qt
  • qca
  • qimageblitz
  • soprano
  • strigi
  •     searchclient
  •     streamanalyzer
  •     streams
Generated for KDE Support by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal