~smartboyhw/ubuntu/raring/calligra/2.6.0-0ubuntu1

« back to all changes in this revision

Viewing changes to libs/kotext/KoTextRdfCore.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-10-23 21:09:16 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20121023210916-m82w6zxnxhaxz7va
Tags: 1:2.5.90-0ubuntu1
* New upstream alpha release (LP: #1070436)
  - Add libkactivities-dev and libopenimageio-dev to build-depends
  - Add kubuntu_build_calligraactive.diff to build calligraactive by default
  - Add package for calligraauthor and move files that are shared between
    calligrawords and calligraauthor to calligrawords-common
* Document the patches
* Remove numbers from patches so they follow the same naming scheme as
  the rest of our patches.
* calligra-data breaks replaces krita-data (<< 1:2.5.3) (LP: #1071686)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <QFile>
25
25
using namespace Soprano;
26
26
 
27
 
bool KoTextRdfCore::saveRdf(Soprano::Model *model, Soprano::StatementIterator triples, KoStore *store, KoXmlWriter *manifestWriter, const QString &fileName)
 
27
bool KoTextRdfCore::saveRdf( QSharedPointer<Soprano::Model> model, Soprano::StatementIterator triples, KoStore *store, KoXmlWriter *manifestWriter, const QString &fileName)
28
28
{
29
29
    bool ok = false;
30
30
 
59
59
    return ok;
60
60
}
61
61
 
62
 
bool KoTextRdfCore::createAndSaveManifest(const Soprano::Model *docmodel, const QMap<QString, QString> &idmap, KoStore *store, KoXmlWriter *manifestWriter)
 
62
bool KoTextRdfCore::createAndSaveManifest(QSharedPointer<Soprano::Model> docmodel, const QMap<QString, QString> &idmap, KoStore *store, KoXmlWriter *manifestWriter)
63
63
{
64
 
    Soprano::Model *tmpmodel(Soprano::createModel());
 
64
    QSharedPointer<Soprano::Model> tmpmodel(Soprano::createModel());
65
65
    QMap<QString, QString>::const_iterator iditer = idmap.constBegin();
66
66
    QMap<QString, QString>::const_iterator idend = idmap.constEnd();
67
67
    for (; iditer != idend; ++iditer) {
100
100
    // save tmpmodel as manifest.rdf in C+P ODF file.
101
101
    Soprano::StatementIterator triples = tmpmodel->listStatements();
102
102
    bool ret = saveRdf(tmpmodel, triples, store, manifestWriter, "manifest.rdf");
103
 
    if (tmpmodel) {
104
 
        delete tmpmodel;
105
 
    }
106
103
    return ret;
107
104
}
108
105
 
109
 
bool KoTextRdfCore::loadManifest(KoStore *store, Soprano::Model *model)
 
106
bool KoTextRdfCore::loadManifest(KoStore *store, QSharedPointer<Soprano::Model> model)
110
107
{
111
108
    bool ok = true;
112
109
    QString fileName = "manifest.rdf";
142
139
    return ok;
143
140
}
144
141
 
145
 
void KoTextRdfCore::dumpModel(const QString &msg, Soprano::Model *m)
 
142
void KoTextRdfCore::dumpModel(const QString &msg, QSharedPointer<Soprano::Model> m)
146
143
{
147
144
#ifndef NDEBUG
148
145
    QList<Soprano::Statement> allStatements = m->listStatements().allElements();
156
153
#endif
157
154
}
158
155
 
159
 
QList<Soprano::Statement> KoTextRdfCore::loadList(Soprano::Model *model, Soprano::Node ListHeadSubject)
 
156
QList<Soprano::Statement> KoTextRdfCore::loadList(QSharedPointer<Soprano::Model> model, Soprano::Node ListHeadSubject)
160
157
{
161
158
    Node rdfNil = Node::createResourceNode(QUrl("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"));
162
159
    Node rdfFirst = Node::createResourceNode(QUrl("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"));
181
178
    return ret;
182
179
}
183
180
 
184
 
static void removeList(Soprano::Model *model, Soprano::Node ListHeadSubject)
 
181
static void removeList(QSharedPointer<Soprano::Model> model, Soprano::Node ListHeadSubject)
185
182
{
186
183
    Node rdfNil = Node::createResourceNode(QUrl("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"));
187
184
    Node rdfFirst = Node::createResourceNode(QUrl("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"));
200
197
    model->removeAllStatements(ListHeadSubject, rdfRest, Node());
201
198
}
202
199
 
203
 
void KoTextRdfCore::saveList(Soprano::Model *model, Soprano::Node ListHeadSubject, QList<Soprano::Node> &dataBNodeList, Soprano::Node context)
 
200
void KoTextRdfCore::saveList(QSharedPointer<Soprano::Model> model, Soprano::Node ListHeadSubject, QList<Soprano::Node> &dataBNodeList, Soprano::Node context)
204
201
{
205
202
    Node rdfNil = Node::createResourceNode(QUrl("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"));
206
203
    Node rdfFirst = Node::createResourceNode(QUrl("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"));
233
230
    model->addStatement(listBNode, rdfRest, rdfNil, context);
234
231
}
235
232
 
236
 
void KoTextRdfCore::removeStatementsIfTheyExist(Soprano::Model *m, const QList<Soprano::Statement> &removeList)
 
233
void KoTextRdfCore::removeStatementsIfTheyExist( QSharedPointer<Soprano::Model> m, const QList<Soprano::Statement> &removeList)
237
234
{
238
235
    foreach (Soprano::Statement s, removeList) {
239
236
        StatementIterator it = m->listStatements(s.subject(), s.predicate(), s.object(), s.context());
245
242
    }
246
243
}
247
244
 
248
 
Soprano::Node KoTextRdfCore::getObject(Soprano::Model *model, Soprano::Node s, Soprano::Node p)
 
245
Soprano::Node KoTextRdfCore::getObject(QSharedPointer<Soprano::Model> model, Soprano::Node s, Soprano::Node p)
249
246
{
250
247
    QList<Statement> all;
251
248
    all = model->listStatements(s, p, Node()).allElements();
262
259
    return t.readAll();
263
260
}
264
261
 
265
 
QString KoTextRdfCore::getProperty(Soprano::Model *m, Soprano::Node subj, Soprano::Node pred, const QString &defval)
 
262
QString KoTextRdfCore::getProperty(QSharedPointer<Soprano::Model> m, Soprano::Node subj, Soprano::Node pred, const QString &defval)
266
263
{
267
264
    StatementIterator it = m->listStatements(subj, pred, Node());
268
265
    QList<Statement> allStatements = it.allElements();