#include <Soprano/Parser>
Public Member Functions | |
virtual | ~Parser () |
virtual RdfSerializations | supportedSerializations () const =0 |
virtual QStringList | supportedUserSerializations () const |
bool | supportsSerialization (RdfSerialization s, const QString &userSerialization=QString()) const |
virtual StatementIterator | parseFile (const QString &filename, const QUrl &baseUri, RdfSerialization serialization, const QString &userSerialization=QString()) const |
virtual StatementIterator | parseString (const QString &data, const QUrl &baseUri, RdfSerialization serialization, const QString &userSerialization=QString()) const |
virtual StatementIterator | parseStream (QTextStream &stream, const QUrl &baseUri, RdfSerialization serialization, const QString &userSerialization=QString()) const =0 |
Protected Member Functions | |
Parser (const QString &name) |
Each parser plugin may support multiple RDF serializations (supportedSerializations()).
Soprano::Parser* p = Soprano::PluginManager::instance()->discoverParserForSerialization( Soprano::SerializationRdfXml );
Then parsing RDF data is done in a single method call resulting in a StatementIterator over the resulting graph (since parsers may support multiple serializations one always needs to provide the serialization type unless a parser plugin support autodetection).
Soprano::StatementIterator it = p->parseFile( "myrdffile.rdf", Soprano::SerializationRdfXml );
Definition at line 69 of file parser.h.
virtual Soprano::Parser::~Parser | ( | ) | [virtual] |
Soprano::Parser::Parser | ( | const QString & | name | ) | [protected] |
virtual RdfSerializations Soprano::Parser::supportedSerializations | ( | ) | const [pure virtual] |
The serialiazation types supported by this parser.
virtual QStringList Soprano::Parser::supportedUserSerializations | ( | ) | const [virtual] |
A parser 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::Parser::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 Parser interface with new RDF serializations that are not officially supported by Soprano. |
true
if the parser is able to parse RDF data encoded in serialization s, false
otherwise. virtual StatementIterator Soprano::Parser::parseFile | ( | const QString & | filename, | |
const QUrl & | baseUri, | |||
RdfSerialization | serialization, | |||
const QString & | userSerialization = QString() | |||
) | const [virtual] |
Parse an RDF model which has been serialized in a file, using the supplied baseURI to resolve any relative URI references.
The default implementation simply calls parseStream() on an opened QFile instance.
filename | The name (path) of the file to parse | |
baseUri | The base URI to be used for relative references. | |
serialization | The serialization used in the file. | |
userSerialization | If serialization is set to Soprano::SerializationUser this parameter specifies the serialization to use. It allows the extension of the Soprano Parser interface with new RDF serializations that are not officially supported by Soprano. |
virtual StatementIterator Soprano::Parser::parseString | ( | const QString & | data, | |
const QUrl & | baseUri, | |||
RdfSerialization | serialization, | |||
const QString & | userSerialization = QString() | |||
) | const [virtual] |
Parse an RDF model which has been serialized into a string, using the supplied baseURI to resolve any relative URI references.
The default implementation simply calls parseStream().
data | The serialized RDF string. | |
baseUri | The base URI to be used for relative references. | |
serialization | The serialization used for the string data. | |
userSerialization | If serialization is set to Soprano::SerializationUser this parameter specifies the serialization to use. It allows the extension of the Soprano Parser interface with new RDF serializations that are not officially supported by Soprano. |
virtual StatementIterator Soprano::Parser::parseStream | ( | QTextStream & | stream, | |
const QUrl & | baseUri, | |||
RdfSerialization | serialization, | |||
const QString & | userSerialization = QString() | |||
) | const [pure virtual] |
Read a serialized RDF model from a test stream, using the supplied baseURI to resolve any relative URI references.
stream | The text stream to read the serialized RDF data from. | |
baseUri | The base URI to be used for relative references. | |
serialization | The serialization used for the string data from the stream. | |
userSerialization | If serialization is set to Soprano::SerializationUser this parameter specifies the serialization to use. It allows the extension of the Soprano Parser interface with new RDF serializations that are not officially supported by Soprano. |