<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Liberation Sans'; font-size:8pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Hello all,</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">given the following query:</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">ComparisonTerm accountTerm(Nepomuk::Vocabulary::NCO::hasIMAccount(), ResourceTerm(mePersonContact));</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">        accountTerm.setInverted(true);</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0; font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">        ComparisonTerm nopcTerm(Nepomuk::Vocabulary::NCO::hasIMAccount(),</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">                                ResourceTypeTerm(Nepomuk::Vocabulary::NCO::PersonContact()));</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">        nopcTerm.setInverted(true);</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">        OrTerm condterm(accountTerm, NegationTerm::negateTerm(nopcTerm));</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0; font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">        // Match the ID</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">        ComparisonTerm pathTerm(Nepomuk::Vocabulary::Telepathy::accountIdentifier(),</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">                                LiteralTerm(m_path), Nepomuk::Query::ComparisonTerm::Equal);</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0; font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">        Query query(AndTerm(condterm, pathTerm,</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">                            ResourceTypeTerm(Nepomuk::Vocabulary::NCO::IMAccount())));</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0; font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">query.toSparqlQuery gives:</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0; font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Courier New,Courier,monospace'; font-size:medium; color:#333333;">&quot;select distinct ?r where { { { &lt;nepomuk:/res/5dcd4fcd-6305-4b1d-b085-6ff52971ebc8&gt; &lt;http://www.semanticdesktop.org/ontologies/2007/03/22/nco#hasIMAccount&gt; ?r . } UNION { OPTIONAL { ?v2 &lt;http://www.semanticdesktop.org/ontologies/2007/03/22/nco#hasIMAccount&gt; ?v1 . ?v2 a ?v3 . ?v3 &lt;http://www.w3.org/2000/01/rdf-schema#subClassOf&gt; &lt;http://www.semanticdesktop.org/ontologies/2007/03/22/nco#PersonContact&gt; . FILTER(?v1=?r) . } . FILTER(!BOUND(?v1)) . } . ?r &lt;http://nepomuk.kde.org/ontologies/2009/06/20/telepathy#accountIdentifier&gt; &quot;/my/account/path&quot;^^&lt;http://www.w3.org/2001/XMLSchema#string&gt; . ?r a ?v4 . ?v4 &lt;http://www.w3.org/2000/01/rdf-schema#subClassOf&gt; &lt;http://www.semanticdesktop.org/ontologies/2007/03/22/nco#IMAccount&gt; . } . }&quot;</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0; font-family:'Courier New,Courier,monospace'; font-size:medium; color:#333333;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'verdana,arial,helvetica,sans-serif'; font-size:medium; color:#000000;">After some thinking, we came to the conclusion that it should be FILTER(!BOUND(?v2)) instead of FILTER(!BOUND(?v1)). Is it possible that NegationTerm ignores the inversion of the comparison term?</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0; font-family:'Courier New,Courier,monospace'; font-size:medium; color:#333333;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">-- </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">-------------------</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Dario Freddi</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">KDE Developer</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">GPG Key Signature: 511A9A3B</p></body></html>