Example #1
0
void moviemanager::queryTag(QString userTag)
{
    //This module is not working
    //get help from pnh for debugging
    //pnh code
    Nepomuk::Tag myTag;
    myTag.setLabel(userTag);
    QString query
       = QString("select distinct ?r where { ?r %1 %2 . ?r a %3 }")
         .arg( Soprano::Node::resourceToN3(Soprano::Vocabulary::NAO::hasTag()) )
         .arg( Soprano::Node::resourceToN3(myTag.resourceUri()) )
         .arg( Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NFO::Video()) );

    QList<Nepomuk::Resource> myResourceList;
    Soprano::Model *model = Nepomuk::ResourceManager::instance()->mainModel();

    Soprano::QueryResultIterator it = model->executeQuery( query, Soprano::Query::QueryLanguageSparql );
    while( it.next() ) {
        qDebug() << "looping";
       myResourceList << Nepomuk::Resource( it.binding( "r" ).uri() );
    }

    Q_FOREACH (const Nepomuk::Resource& r, myResourceList)
    {
        mainMovieList->addItem(r.property(Nepomuk::Vocabulary::NFO::fileName()).toString());
        //if(r.tags().contains(new Nepomuk:Tag("video"))) newList.append(r)
    }
Example #2
0
void Nepomuk::TagAnnotation::doCreate( Nepomuk::Resource resource )
{
    kDebug() << "tagging" << resource.resourceUri() << "with" << d->m_tag;
    Nepomuk::Tag tag;
    if( d->m_tagUri.isValid() )
        tag = d->m_tagUri;
    else
        tag = d->m_tag;
    if ( tag.label().isEmpty() &&
         !tag.identifiers().isEmpty() ) {
        tag.setLabel( d->m_tag );
    }
    resource.addTag( tag );
    emitFinished();
}