Bug 313035 - commit ead226c9571 makes newEntries/entriesRemoved not work for some queries
Summary: commit ead226c9571 makes newEntries/entriesRemoved not work for some queries
Status: RESOLVED FIXED
Alias: None
Product: nepomuk
Classification: Unmaintained
Component: queryservice (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Nepomuk Bugs Coordination
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-10 19:08 UTC by Marco Martin
Modified: 2013-01-23 13:03 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Martin 2013-01-10 19:08:50 UTC
After the commit commit ead226c9571 if a query is performed with a QueryServiceClient, the client won't emit newEntries/entriesRemoved after something has been done to add a new result or remove an old one.

Example of a query:
"<?xml version="1.0"?><query limit="0" offset="0" fullTextScoring="false" fullTextScoringOrder="desc" flags="NoResultRestrictions"><and><type uri="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Document"/><comparison property="http://www.semanticdesktop.org/ontologies/2007/08/15/nao#isRelated" comparator=":" inverted="true"><resource uri="nepomuk:/res/f1d47359-51b4-4cf5-a24d-82885ce8c171"/></comparison></and></query>"

that represents the sparql:

select distinct ?r where { { ?r a <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Bookmark> . <nepomuk:/res/f1d47359-51b4-4cf5-a24d-82885ce8c171> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#isRelated> ?r . } . }

The quey is done with the C++ api (since newEntries/entriesRemoved are not expected to work with sparql)


Reproducible: Always



Expected Results:  
when an isRelated is added between a resource and an activity resource, the newEntries should be emitted, if the isRelated property is removed, the entriesRemoved signal should be emitted

reverting nepomuk-core to 68dde513c437  (commite before ead226c9571) reliably solves the problem, going to ead226c9571 reliably makes the problem appear again
Comment 1 Vishesh Handa 2013-01-22 14:36:12 UTC
I cannot seem to reproduce this.

Here is the code that I used -

    Tag tag("KDE");
    Query::ResourceTypeTerm typeTerm( NFO::FileDataObject() );
    Query::ComparisonTerm term( NAO::hasTag(), Query::ResourceTerm(tag) );
    Query::Query query( typeTerm && term );

    Query::QueryServiceClient* client = new Query::QueryServiceClient( this );
    connect( client, SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)),
             this, SLOT(newEntries(QList<Nepomuk2::Query::Result>)) );
    connect( client, SIGNAL(entriesRemoved(QList<QUrl>)),
             this, SLOT(entriesRemoved(QList<QUrl>)) );
    connect( client, SIGNAL(resultCount(int)),
             this, SLOT(resultCount(int)) );

    client->query( query );

The resulting query -

<?xml version="1.0"?><query limit="0" offset="0" fullTextScoring="false" fullTextScoringOrder="desc" flags=""><and><type uri="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject"/><comparison property="http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasTag" comparator=":" inverted="false"><resource uri="nepomuk:/res/b2e38e46-9123-407a-8f7d-e34e95931e1d"/></comparison></and></query>

I added the KDE tag via Dolphin to a file, and remove the tag. Both times, the appropriate slot was called.

Could you possible create a small application which I can use to reproduce it?
Comment 2 Marco Martin 2013-01-22 19:41:13 UTC
i can confirm that it works with the above query
the query that gives me problems is:

"<?xml version=\"1.0\"?><query limit=\"0\" offset=\"0\" fullTextScoring=\"false\" fullTextScoringOrder=\"desc\" flags=\"NoResultRestrictions\"><and><type uri=\"http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject\"/><comparison property=\"http://www.semanticdesktop.org/ontologies/2007/08/15/nao#isRelated\" comparator=\":\" inverted=\"true\"><resource uri=\"nepomuk:/res/64e8b60e-361d-45ec-9582-e3c8dc8bec43\"/></comparison></and></query>"

i tried also to do an inverted query about tags, but that works as well

a simpler query on activities,

<?xml version="1.0"?><query limit="0" offset="0" fullTextScoring="false" fullTextScoringOrder="desc" flags=""><comparison property="http://www.semanticdesktop.org/ontologies/2007/08/15/nao#isRelated" comparator=":" inverted="true"><resource uri="nepomuk:/res/64e8b60e-361d-45ec-9582-e3c8dc8bec43"/></comparison></query>

seems to work correctly, noticing items that are linked/unlinked to an activity
Comment 3 Marco Martin 2013-01-22 19:45:46 UTC
another finding: in the query that doesn't work, if i remove the term in and
<type uri=\"http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject\"/> seems to fix it.
Comment 4 Marco Martin 2013-01-23 13:03:54 UTC
Git commit 9ece545a7d19905b8274873a6b23d4f43b144c33 by Marco Martin.
Committed on 23/01/2013 at 14:01.
Pushed by mart into branch 'KDE/4.10'.

don't add a type to the watcher

if we narrow down the types watched, when properties  that are catched by and inverted term change, they won't be signaled if the object where those properties belong is of the wrong type:
example: isRelated property for activities, if we do a query asking for items of type FileDataObject

M  +1    -2    services/storage/query/folder.cpp

http://commits.kde.org/nepomuk-core/9ece545a7d19905b8274873a6b23d4f43b144c33