Exemple #1
0
void NoteItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
    QStyle* style = KApplication::style();
    style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter);

    QRect rect = option.rect;
    rect.adjust( m_margin, m_margin, -m_margin, -m_margin );

    Nepomuk2::Resource res = index.data( Nepomuk2::Utils::SimpleResourceModel::ResourceRole ).value<Nepomuk2::Resource>();

    QString plainTextContent = res.property( NIE::plainTextContent() ).toString();
    QDateTime creationDate = res.property( NAO::created() ).toDateTime();

    //TODO: Find a way to convert this date into "4 hours ago" format
    QString dateString = creationDate.toLocalTime().toString();

    painter->save();
    QFont f = painter->font();
    f.setBold( true );
    painter->setFont( f );
    style->drawItemText( painter, rect, Qt::AlignLeft | Qt::AlignTop, option.palette, true, dateString );
    painter->restore();

    rect.setY( rect.y() + QFontMetrics(f).height()/* + m_margin */);

    //
    // Draw the excerpt
    //
    QTextDocument textDocument;
    textDocument.setTextWidth( rect.width() );

    QFont font = textDocument.defaultFont();
    font.setItalic( true );
    textDocument.setDefaultFont( font );

    QFontMetrics fm( font );
    int numLines = rect.height() / fm.height();
    int charPerLine = rect.width() / fm.averageCharWidth();

    int l = (numLines-2) * charPerLine; // one line less for ending, and one line for padding
    QString text;
    // FIXME: There may be a case where some part of the text gets repeated before and after the ...
    if( l < plainTextContent.length() ) {
        text = plainTextContent.left( l );
        text += QLatin1String(" .... ");
        text += plainTextContent.right( charPerLine-10 );
    }
    else {
        text = plainTextContent;
    }

    textDocument.setPlainText( text.simplified() );

    painter->save();
    painter->translate( rect.topLeft() );
    textDocument.drawContents( painter );
    painter->restore();
}
void Nepomuk2::SubtitleLoader::load()
{
    kDebug() << "Video File : " << m_videoUrl;
    kDebug() << "Subtitle File : " << m_subtitleUrl;
    SrtParser parser( m_subtitleUrl );

    Nepomuk2::Resource videoRes( m_videoUrl );
    if( !videoRes.exists() ) {
        kDebug() << "Doesn't exist";
        videoRes.addTag( Nepomuk2::Tag("Big Bang") );
    }
    kDebug() << "Is File : " << videoRes.isFile();
    kDebug() << "Resource uri: " << videoRes.uri();
    kDebug() << "File url : " << videoRes.toFile().url();

    foreach( const Subtitle & sub, parser.toList() ) {
        Nepomuk2::Resource res;
        res.addType( NSBO::Subtitle() );
        res.addProperty( NSBO::startTime(), Variant( sub.start ) );
        res.addProperty( NSBO::endTime(), Variant( sub.end ) );
        res.addProperty( NSBO::subtitleFor(), videoRes.uri() );
        kDebug() << res.property( NSBO::subtitleFor() );
        res.addProperty( NIE::plainTextContent(), Variant( sub.text ) );
        kDebug() << sub.num << " Adding - " << sub.text;

        //if( sub.text.contains("Penny") )
        //    kDebug() << sub.start;
    }
}
Exemple #3
0
void ChapterEdit::setupLabel()
{
    Nepomuk2::Resource chapter = resource().property(NBIB::referencedPart()).toResource();
    // creates a string in the form
    // "1. Introduction" or just "Introduction"
    QString showString;
    QString title = chapter.property(NIE::title()).toString();
    QString number = chapter.property(NBIB::chapterNumber()).toString();

    showString.append(title);

    if(!number.isEmpty()) {
        showString.prepend(number + QLatin1String(". "));
    }

    setLabelText(showString);
}
void DocumentPreviewTab::setResource(Nepomuk2::Resource & resource)
{
    m_resource = resource;
    ui->urlSelector->clear();
    if(m_part) {
        m_part->closeUrl();
    }

    QString specificUrl;
    if(resource.isValid()) {

        specificUrl = resource.property(Nepomuk2::Vocabulary::NIE::url()).toString();
        if(!specificUrl.isEmpty()) {
            resource = resource.property(Nepomuk2::Vocabulary::NBIB::publishedAs()).toResource();
            m_resource = resource;
        }

        QList<Nepomuk2::Resource> fileList;

        if(resource.hasType(Nepomuk2::Vocabulary::NBIB::Reference())) {
            Nepomuk2::Resource publication = resource.property(Nepomuk2::Vocabulary::NBIB::publication()).toResource();
            fileList = publication.property(Nepomuk2::Vocabulary::NBIB::isPublicationOf()).toResourceList();
            fileList.append( publication.property(Nepomuk2::Vocabulary::NIE::links()).toResourceList() );
        }
        else if(resource.hasType(Nepomuk2::Vocabulary::NBIB::Publication())) {
            fileList = resource.property(Nepomuk2::Vocabulary::NBIB::isPublicationOf()).toResourceList();
            fileList.append( resource.property(Nepomuk2::Vocabulary::NIE::links()).toResourceList() );
        }
        else {
            fileList.append(resource);
        }

        // add all DataObjects to the preview
        foreach(const Nepomuk2::Resource & r, fileList) {
            KUrl url = KUrl(r.property(Nepomuk2::Vocabulary::NIE::url()).toString());
            KIcon icon;
            QString mimetype;

            if( r.hasType(Nepomuk2::Vocabulary::NFO::Website())// || r.hasType(Nepomuk2::Vocabulary::NFO::WebDataObject())
                || url.scheme() == QLatin1String("http")) {

                QString favIcon = KMimeType::favIconForUrl(url);
                if(favIcon.isEmpty()) {
                    favIcon = QLatin1String("text-html");
                }

                icon = KIcon(favIcon);
                mimetype = QLatin1String("text/html");
            }
            else {
                KMimeType::Ptr mimeTypePtr = KMimeType::findByUrl(url);

                icon = KIcon(mimeTypePtr->iconName());
                mimetype = mimeTypePtr->name();
            }

            ui->urlSelector->addItem(icon,url.url(),QVariant(mimetype));
        }
Exemple #5
0
void VolumeNumberEdit::setupLabel()
{
    QString string;

    // four different cases must be checked here
    Nepomuk2::Resource issueResource;

    // I. resource() is an article, with an attached Collection, from a Series
    if(resource().hasType(NBIB::Article())) {
        issueResource = resource().property(NBIB::collection()).toResource();
    }
    // II. resource() is a Legislation
    // the number in this case is for the nbib:Bill
    // while the volume if for the nbib:CodeOfLaw
    else if(resource().hasType(NBIB::Legislation())) {
        if(propertyUrl() == NBIB::volume()) {
            issueResource = resource().property(NBIB::codeOfLaw()).toResource();
        }
    }
    // III. the number in this case is for the case not the courtreporter
    else if(resource().hasType(NBIB::LegalCaseDocument())) {
        if(propertyUrl() == NBIB::volume()) {
            issueResource = resource().property(NBIB::courtReporter()).toResource();
        }
    }
    // IV. resource() is an Collection, from a Series
    else if(resource().hasType(NBIB::Collection())) {
        issueResource = resource();
    }

    if(issueResource.isValid()) {
        // propertyUrl either leads to the issue number or volume number, see publicationwidget for the selection
        string = issueResource.property(propertyUrl()).toString();
    }
    else {
        // if no issue is attached, show issue/volume from publication instead
        string = resource().property(propertyUrl()).toString();
    }

    setLabelText(string);
}
QString MetadataUpdater::urlForResource(const Nepomuk2::Resource &resource) const
{
    return resource.property(Nepomuk2::Vocabulary::NIE::url()).toUrl().toString();
}
QString MetadataUpdater::mimetypeForResource(const Nepomuk2::Resource& resource) const
{
    const QString mime = resource.property(Nepomuk2::Vocabulary::NIE::mimeType()).toString();
    return mime;
}
Exemple #8
0
void OntologyUpdater::start()
{
    QApplication::processEvents();
    Soprano::Model *m_mainModel;
    bool m_nepomukInited = Utilities::nepomukInited();
    if (m_nepomukInited) {
        m_mainModel = Nepomuk2::ResourceManager::instance()->mainModel();
    } else {
        return;
    }
    
    m_stopUpdate = false;
    
    MediaVocabulary mediaVocabulary;
    
    //Update audio
    QString queryPrefix = QString("PREFIX xesam: <%1> "
                    "PREFIX rdf: <%2> "
                    "PREFIX xls: <%3> "
                    "PREFIX nmm: <http://www.semanticdesktop.org/ontologies/nmm#> "
                    "PREFIX nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#> "
                    "PREFIX nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> ")
                    .arg(Soprano::Vocabulary::Xesam::xesamNamespace().toString())
                    .arg(Soprano::Vocabulary::RDF::rdfNamespace().toString())
                    .arg(Soprano::Vocabulary::XMLSchema::xsdNamespace().toString());
    QString queryStr = queryPrefix + QString("SELECT ?r "
                       "WHERE { {?r rdf:type <http://www.semanticdesktop.org/ontologies/nfo#Audio>} "
                       "UNION "
                       "{?r rdf:type <http://www.semanticdesktop.org/ontologies/nmm#MusicPiece>} "
                       "UNION "
                       "{?r rdf:type <http://www.semanticdesktop.org/ontologies/nmm#DigitalRadio>} "
                       "UNION "
                       "{?r rdf:type <http://www.semanticdesktop.org/ontologies/nmm#MusicAlbum>} "
                       "UNION "
                       "{?r rdf:type <%1>} "
                       "UNION "
                       "{?r rdf:type <%2>} "
                       "UNION "
                       "{?r rdf:type <%3>} }")
                       .arg(mediaVocabulary.typeAudio().toString())
                       .arg(mediaVocabulary.typeAudioMusic().toString())
                       .arg(mediaVocabulary.typeMediaStream().toString());
    
    Soprano::QueryResultIterator it = m_mainModel->executeQuery(queryStr, Soprano::Query::QueryLanguageSparql);
    emit infoMessage(i18n("<b>Updating audio types and properties</b><br>0 items updated..."));
    QApplication::processEvents();
    int i = 0;
    while( it.next() && !m_stopUpdate) {
        QApplication::processEvents();
        i++;
        Nepomuk2::Resource resource = Nepomuk2::Resource(it.binding("r").uri());
        //Update types
        QUrl type = QUrl("http://www.semanticdesktop.org/ontologies/nfo#Audio");
        if (resource.hasType(type)) {
            removeType(resource, type);
            if (!resource.hasType(mediaVocabulary.typeAudio())) {
                resource.addType(mediaVocabulary.typeAudio());
            }
        }
        type = QUrl("http://www.semanticdesktop.org/ontologies/nmm#MusicPiece");
        if (resource.hasType(type)) {
            removeType(resource, type);
            if (!resource.hasType(mediaVocabulary.typeAudioMusic())) {
                resource.addType(mediaVocabulary.typeAudioMusic());
            }
            //Update properties
            QUrl property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#musicAlbum");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.musicAlbum(), value);
            }
            property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#trackNumber");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.musicTrackNumber(), value);
            }
        }
        type = QUrl("http://www.semanticdesktop.org/ontologies/nmm#DigitalRadio");
        if (resource.hasType(type)) {
            removeType(resource, type);
            if (!resource.hasType(mediaVocabulary.typeMediaStream())) {
                resource.addType(mediaVocabulary.typeMediaStream());
            }
        }
        type = QUrl("http://www.semanticdesktop.org/ontologies/nmm#MusicAlbum");
        if (resource.hasType(type)) {
            removeType(resource, type);
            if (!resource.hasType(mediaVocabulary.typeMusicAlbum())) {
                resource.addType(mediaVocabulary.typeMusicAlbum());
            }
        }
        
        //Update common properties
        QUrl property = QUrl("http://www.semanticdesktop.org/ontologies/nfo#duration");
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            resource.removeProperty(property);
            resource.setProperty(mediaVocabulary.duration(), value);
        }
        property = Nepomuk2::Vocabulary::NMM::artwork();
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            resource.removeProperty(property);
            resource.setProperty(mediaVocabulary.artwork(), value);
        }
        property = Nepomuk2::Vocabulary::NIE::hasLogicalPart();
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            if (value.toResource().hasType(Nepomuk2::Vocabulary::NFO::Image())) {
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.artwork(), value);
            }
        }
        property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#genre");
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            resource.removeProperty(property);
            resource.setProperty(mediaVocabulary.genre(), value);
        }
        property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#releaseDate");
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            resource.removeProperty(property);
            resource.setProperty(mediaVocabulary.releaseDate(), value);
        }
        property = Soprano::Vocabulary::Xesam::useCount();
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            resource.removeProperty(property);
            resource.setProperty(mediaVocabulary.playCount(), value);
        }
        property = Soprano::Vocabulary::Xesam::lastUsed();
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            resource.removeProperty(property);
            resource.setProperty(mediaVocabulary.lastPlayed(), value);
        }
        emit infoMessage(i18n("<b>Updating audio types and properties</b><br>%1 audio items done...", i));
        QApplication::processEvents();
    }


    //Update video
    queryStr = queryPrefix + QString("SELECT ?r "
                       "WHERE { {?r rdf:type <http://www.semanticdesktop.org/ontologies/nfo#Video>} "
                       "UNION "
                       "{?r rdf:type <http://www.semanticdesktop.org/ontologies/nmm#Movie>} "
                       "UNION "
                       "{?r rdf:type <http://www.semanticdesktop.org/ontologies/nmm#TVShow>} "
                       "UNION "
                       "{?r rdf:type <http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#TVSeries>} "
                       "UNION "
                       "{?r rdf:type <%1>} "
                       "UNION "
                       "{?r rdf:type <%2>} "
                       "UNION "
                       "{?r rdf:type <%3>} }")
                       .arg(mediaVocabulary.typeVideo().toString())
                       .arg(mediaVocabulary.typeVideoMovie().toString())
                       .arg(mediaVocabulary.typeVideoTVShow().toString());

    
    it = m_mainModel->executeQuery(queryStr, Soprano::Query::QueryLanguageSparql);
    emit infoMessage(i18n("<b>Updating audio types and properties</b><br>0 items updated..."));
    QApplication::processEvents();
    i = 0;
    while( it.next() && !m_stopUpdate) {
        QApplication::processEvents();
        i++;
        Nepomuk2::Resource resource = Nepomuk2::Resource(it.binding("r").uri());
        //Update types
        QUrl type = QUrl("http://www.semanticdesktop.org/ontologies/nfo#Video");
        if (resource.hasType(type)) {
            removeType(resource, type);
            if (!resource.hasType(mediaVocabulary.typeVideo())) {
                resource.addType(mediaVocabulary.typeVideo());
            }
        }
        type = QUrl("http://www.semanticdesktop.org/ontologies/nmm#Movie");
        if (resource.hasType(type)) {
            removeType(resource, type);
            if (!resource.hasType(mediaVocabulary.typeVideoMovie())) {
                resource.addType(mediaVocabulary.typeVideoMovie());
            }
            //Update properties
            QUrl property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#synopsis");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoSynopsis(), value);
            }
            property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#writer");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoWriter(), value);
            }
            property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#actor");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoActor(), value);
            }
            property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#director");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoDirector(), value);
            }
            property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#producer");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoProducer(), value);
            }
        }
        type = QUrl("http://www.semanticdesktop.org/ontologies/nmm#TVShow");
        if (resource.hasType(type)) {
            removeType(resource, type);
            if (!resource.hasType(mediaVocabulary.typeVideoTVShow())) {
                resource.addType(mediaVocabulary.typeVideoTVShow());
            }
            //Update properties
            QUrl property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#series");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoSeries(), value);
            }
            property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#synopsis");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoSynopsis(), value);
            }
            property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#season");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoSeason(), value);
            }
            property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#episodeNumber");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoEpisodeNumber(), value);
            }
            property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#writer");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoWriter(), value);
            }
            property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#actor");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoActor(), value);
            }
            property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#director");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoDirector(), value);
            }
            property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#producer");
            if (resource.hasProperty(property)) {
                Nepomuk2::Variant value = resource.property(property);
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.videoProducer(), value);
            }
        }
        type = QUrl("http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#TVSeries");
        if (resource.hasType(type)) {
            removeType(resource, type);
            if (!resource.hasType(mediaVocabulary.typeTVSeries())) {
                resource.addType(mediaVocabulary.typeTVSeries());
            }
        }
        
        //Update common properties
        QUrl property = QUrl("http://www.semanticdesktop.org/ontologies/nfo#duration");
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            resource.removeProperty(property);
            resource.setProperty(mediaVocabulary.duration(), value);
        }
        property = Nepomuk2::Vocabulary::NMM::artwork();
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            resource.removeProperty(property);
            resource.setProperty(mediaVocabulary.artwork(), value);
        }
        property = Nepomuk2::Vocabulary::NIE::hasLogicalPart();
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            if (value.toResource().hasType(Nepomuk2::Vocabulary::NFO::Image())) {
                resource.removeProperty(property);
                resource.setProperty(mediaVocabulary.artwork(), value);
            }
        }
        property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#genre");
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            resource.removeProperty(property);
            resource.setProperty(mediaVocabulary.genre(), value);
        }
        property = QUrl("http://www.semanticdesktop.org/ontologies/nmm#releaseDate");
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            resource.removeProperty(property);
            resource.setProperty(mediaVocabulary.releaseDate(), value);
        }
        property = Soprano::Vocabulary::Xesam::useCount();
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            resource.removeProperty(property);
            resource.setProperty(mediaVocabulary.playCount(), value);
        }
        property = Soprano::Vocabulary::Xesam::lastUsed();
        if (resource.hasProperty(property)) {
            Nepomuk2::Variant value = resource.property(property);
            resource.removeProperty(property);
            resource.setProperty(mediaVocabulary.lastPlayed(), value);
        }
        
        emit infoMessage(i18n("<b>Updating video types and properties</b><br>%1 video items done...", i));
        QApplication::processEvents();
    }


    //Fix screwed up properties
    MediaQuery query;
    QStringList bindings;
    bindings.append(mediaVocabulary.mediaResourceBinding());
    bindings.append(mediaVocabulary.ratingBinding());
    query.select(bindings, MediaQuery::Distinct);
    query.startWhere();
    query.addCondition(mediaVocabulary.hasTypeAnyAudio(MediaQuery::Required));
    query.addCondition(mediaVocabulary.hasRating(MediaQuery::Required, 10, MediaQuery::GreaterThan));
    query.endWhere();
    it = m_mainModel->executeQuery(query.query(), Soprano::Query::QueryLanguageSparql);
    emit infoMessage(i18n("<b>Updating audio types and properties</b><br>0 items updated..."));
    QApplication::processEvents();
    i = 0;
    while( it.next() && !m_stopUpdate) {
        QApplication::processEvents();
        i++;
        Nepomuk2::Resource resource = Nepomuk2::Resource(it.binding("r").uri());
        QUrl property = QUrl("http://www.semanticdesktop.org/ontologies/2007/08/15/nao#numericRating");
        if (resource.hasProperty(property)) {
            int rating = resource.property(property).toInt();
            if (rating > 10) {
                resource.removeProperty(property);
            }
        }
        emit infoMessage(i18n("<b>Cleaning up erroneous audio properties</b><br>%1 audio items done...", i));
        QApplication::processEvents();
    }

    MediaQuery query1;
    bindings.clear();
    bindings.append(mediaVocabulary.mediaResourceBinding());
    bindings.append(mediaVocabulary.ratingBinding());
    query1.select(bindings, MediaQuery::Distinct);
    query1.startWhere();
    query1.addCondition(mediaVocabulary.hasTypeAnyVideo(MediaQuery::Required));
    query1.addCondition(mediaVocabulary.hasRating(MediaQuery::Required, 10, MediaQuery::GreaterThan));
    query1.endWhere();
    it = m_mainModel->executeQuery(query.query(), Soprano::Query::QueryLanguageSparql);
    emit infoMessage(i18n("<b>Updating audio types and properties</b><br>0 items updated..."));
    QApplication::processEvents();
    i = 0;
    while( it.next() && !m_stopUpdate) {
        QApplication::processEvents();
        i++;
        Nepomuk2::Resource resource = Nepomuk2::Resource(it.binding("r").uri());
        QUrl property = QUrl("http://www.semanticdesktop.org/ontologies/2007/08/15/nao#numericRating");
        if (resource.hasProperty(property)) {
            int rating = resource.property(property).toInt();
            if (rating > 10) {
                resource.removeProperty(property);
            }
        }
        emit infoMessage(i18n("<b>Cleaning up erroneous video properties</b><br>%1 video items done...", i));
        QApplication::processEvents();
    }

    if (!m_stopUpdate) {
        emit infoMessage(i18n("<b>Update complete.</b>"));
    } else {
        emit infoMessage(i18n("<b>Update stopped.</b>"));
    }
    emit done();
}