Hi Jörg, That actually pretty much the same scenario why I did rewrite large parts of the feeders. I'm surprised that you didn't face any problems with the old approach. With the new approach Resources should be finally merged properly, meaning it also doesn't matter if your resource was created before the feeder indexed it first. For this to work however you will need to make use of the new data management service (DMS) in nepomuk. Unfortunately the Nepomuk::Resource api has not been ported to the DMS yet, but once this is done the resource will be automatically merged based on the nie:url property.
So it is a new regression in Nepomuk::Resources, not a bug though. You can already use the SimpleResource api now (currently located in kde-runtime/nepomuk/services/storage/lib/datamanagement.h) using SimpleResource and SimpleResourceGraph. For reference, here is how I get access to the PIMO:Thing of an akonadi item and add a tag to the thing: Nepomuk::SimpleResourceGraph graph; Nepomuk::SimpleResource resource; resource.setProperty( Nepomuk::Vocabulary::NIE::url(), QUrl(item.url()) ); graph << resource; Nepomuk::SimpleResource thing; thing.addType(Nepomuk::Vocabulary::PIMO::Thing()); thing.addProperty(Nepomuk::Vocabulary::PIMO::groundingOccurrence(), resource.uri()); thing.addProperty(Soprano::Vocabulary::NAO::hasTag(), tag.uri()); graph << tag << thing; graph.save(); user generated content should usually go to the pimo:thing and not the akonadi resource directly, therefore the pimo:thing. Note there is currently a bug in nepomuk which prevents the new feeders from working as expected. Cheers, Christian On Wednesday, November 09, 2011 3:55 PM, "Jörg Ehrichs" <[email protected]> wrote: > Hi everyone, > > I've come across a small problem while integrating Akonadi/Nepomuk in > my program. > > I have this scenario: > * I have a new contact (read from a bibtex file) and create a new > Akonadi item from it. > * I need to connect immediately a nepomuk resource for this Contact to > my publication ontology > * The Akonadi feeder adds its own content to the same nepomuk resource > later to allow edition of the contact via kaddressbook > > Before 4.7.3 (or 4.7.2) I could create the item via the Akonad > ItemCreateJob and create a new Nepomuk::Resource and force its > resource URI to "akonadi:?item=1234" > this resource could be connected to my publication ontology and > Akonadi used exactly the same resource for its feeding operation. > > Now in 4.7.3 if I create a Nepomuk:Resource via > Nepomuk::Resource(QString("akonadi:?item=1234")) or > Nepomuk::Resource(job->item().url())) (as explained in the > akonadicontactfeeder) a new resource with a random resource URI is > created that has a property of NIE:url linking to the real akonadi > resource. > > That's somewhat bad, as this means I duplicate each Contact in the > Nepomuk storage and changes done via kaddressbook have no effect for > the resources used in my program. > > Now the question. Is there a new bug in the Nepomuk::Resource part (I > guess it has todo with the recent QUrl discussion and its changes in > Qt 4.8) or is this a regression in the akonadifeeder and has to be > fixed there somehow? > > Regrads > Joerg > _______________________________________________ > Nepomuk mailing list > [email protected] > https://mail.kde.org/mailman/listinfo/nepomuk > _______________________________________________ Nepomuk mailing list [email protected] https://mail.kde.org/mailman/listinfo/nepomuk
