[Nepomuk] notes deleted by Nepomuk

Sebastian Trueg trueg at kde.org
Wed Feb 17 15:37:50 CET 2010


PierreL wrote:
> HI,
> 
> Our application creates a new note by doing the following below. Why does Nepomuk issue "delete from ..." as soon as our appl start? In <= 4.3.5 using sesame2 as backend this never happened with the same code.

The only reason you now see the delete calls is that the virtuoso
backend is a bit more verbose than the sesame2 one. The commands are the
same. After all updating a property via RDF means deleting and then
inserting.

> void MainWindow::newNote()
> {
>     QString uri = Nepomuk::ResourceManager::instance()->generateUniqueUri();
>     Note n = Note(uri);

Using QString is discouraged. Use QUrl instead.

>     m_model->insertRows(0, 1);
>     m_model->setData(m_model->index(0, 0, QModelIndex()), uri, Qt::EditRole);
>     ui->view->setCurrentIndex(m_proxyModel->mapFromSource(m_model->index(0, 0, QModelIndex())));
> }
> 
> 
> Note::Note(const QString &uriOrName)
>     : Nepomuk::Thing(uriOrName, Nepomuk::Vocabulary::PIMO::Note())
> {
>     if (!isValid()) {
>         QDateTime now = QDateTime::currentDateTime().toTimeSpec(Qt::LocalTime);
>         setCreated(now);
>         setLastModified(now);
>     }

This is not really necessary as Resource already sets both nao:created
and nao:lastModified.


Cheers,
Sebastian


More information about the Nepomuk mailing list