[Nepomuk] Re: Need help in solving an error occurred while dealing with Nepmuk

Vishesh Handa handa.vish at gmail.com
Fri Jul 8 12:21:34 CEST 2011


Hey Sri

A couple of things -
1.) Use Nepomuk::Tag( tagNameAsAString );
not Nepomuk::Tag tag("resourceTerm"); and tag.setLabel( tagname );

2.) A simple Nepomuk::File( url ), will do fine.
You don't need to do Nepomuk::Resource( url ).toFile() as Nepomuk::File is a
subclass of Resource

I tried out your code and it runs perfectly ( as I said on IRC ), the
problem is from where you call the code. And just to prove that your code
does work, I've created a scratch repo kde:scratch/vhanda/nepomuk-for-sri
You can try it out over there.

I think there are some threading issues, your debug output says :
QObject::startTimer:
QTimer can only be used with threads started with QThread

PS: A mailing list is the correct place to ask question. Not a blog post.

2011/7/8 శ్రీ కాంత్ తియ్యగూర <srikanth.tulasiram at gmail.com>

> Hi all,
>
>          I am using Nepomuk for implementing it as a backend tool for krita
> application. Here, I need to store (filenames,tags) as pairs and I want to
> call this function in the destructor, so that at the end I can store the key
> and value pairs. And below is the code I used and got the error.
>
> I already asked this in my blog but again asking here thinking that I can
> get better answer here. . . Sorry, if this mail causes you trouble :(
>
> This is the *code* :
>
> void KoResourceTagging::writeNepomukRepo()
>
> {
>
>   qDebug() << ” I am in ;”;
>
>   QStringList resourceNames = m_tagRepo.uniqueKeys();
>
>   qDebug() << “Resource Names List : ” << resourceNames;
>
>   foreach(QString resourceName, resourceNames) {
>
>      qDebug() << ” Resource name : ” << resourceName ;
>
>      KUrl kurl(resourceName);
>
>      qDebug() << ” Kurl : ” << kurl.url();
>
>       Nepomuk::File resourceFile = Nepomuk::Resource(kurl).toFile();
>
>       qDebug() << “Resource File Created : ” << resourceFile.url().url();
>
>       QStringList tagNameList = m_tagRepo.values(resourceName);
>
>       qDebug() << ” Tag names : ” << tagNameList;
>
>       foreach(QString tagName, tagNameList) {
>
>             Nepomuk::Tag tag( “ResourceTag” );
>
>             tag.setLabel(tagName);
>
>             qDebug() << “Tag Created “;
>
>             resourceFile.addTag( tag );
>
>             qDebug() << “Resources tagged “;
>
>       }
>
>   }
>
> }
>
> And the *output* for this is
>
> ###
>
> # This one is the output of brush resourceServer when it called
> writeNepomukRepo()
>
> ###
>
> I am in ;
>
> Resource Names List :
> (“/home/legend/krita-build/inst/share/apps/krita/brushes/A-eroded-cercle-anim.gih”,
> “/home/legend/krita-build/inst/share/apps/krita/brushes/A-wall-texture.gih”)
>
> Resource name :
> “/home/legend/krita-build/inst/share/apps/krita/brushes/A-eroded-cercle-anim.gih”
>
> Kurl :
>file:///home/legend/krita-build/inst/share/apps/krita/brushes/A-eroded-cercle-anim.gih”
>
> Resource File Created :
>file:///home/legend/krita-build/inst/share/apps/krita/brushes/A-eroded-cercle-anim.gih”
>
> Tag names : (“a”)
>
> QObject::startTimer: QTimer can only be used with threads started with
> QThread
>
> Tag Created
>
> Resources tagged
>
> Resource name :
> “/home/legend/krita-build/inst/share/apps/krita/brushes/A-wall-texture.gih”
>
> Kurl :
>file:///home/legend/krita-build/inst/share/apps/krita/brushes/A-wall-texture.gih”
>
> Resource File Created :
>file:///home/legend/krita-build/inst/share/apps/krita/brushes/A-wall-texture.gih”
>
> Tag names : (“bricks”)
>
> Tag Created
>
> Resources tagged
>
> ###
>
> # This one is the output of pattern resourceServer. It ends with this
> error.
>
> ###
>
> I am in ;
>
> Resource Names List :
> (“/home/legend/krita-build/inst/share/apps/krita/patterns/choc_swirl.pat”,
> “/home/legend/krita-build/inst/share/apps/krita/patterns/java.pat”,
> “/home/legend/krita-build/inst/share/apps/krita/patterns/wood4.pat”)
>
> Resource name :
> “/home/legend/krita-build/inst/share/apps/krita/patterns/choc_swirl.pat”
>
> Kurl :
>file:///home/legend/krita-build/inst/share/apps/krita/patterns/choc_swirl.pat”
>
> Fatal Error: Accessed global static ‘Nepomuk::ResourceManagerHelper
> *instanceHelper()’ after destruction. Defined at
> ../../nepomuk/core/resourcemanager.cpp:310
>
> Aborted.
>
>
>
> Regards
> Srikanth Tiyyagura
>
>
>
> _______________________________________________
> Nepomuk mailing list
> Nepomuk at kde.org
> https://mail.kde.org/mailman/listinfo/nepomuk
>
>


-- 
Vishesh Handa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/nepomuk/attachments/20110708/016cfc92/attachment.htm 


More information about the Nepomuk mailing list