[Nepomuk] Issues with NegationTerm+ComparisonTerm::setInverted
Dario Freddi
drf54321 at gmail.com
Tue May 18 15:06:04 CEST 2010
Hello all,
given the following query:
ComparisonTerm accountTerm(Nepomuk::Vocabulary::NCO::hasIMAccount(),
ResourceTerm(mePersonContact));
accountTerm.setInverted(true);
ComparisonTerm nopcTerm(Nepomuk::Vocabulary::NCO::hasIMAccount(),
ResourceTypeTerm(Nepomuk::Vocabulary::NCO::PersonContact()));
nopcTerm.setInverted(true);
OrTerm condterm(accountTerm, NegationTerm::negateTerm(nopcTerm));
// Match the ID
ComparisonTerm
pathTerm(Nepomuk::Vocabulary::Telepathy::accountIdentifier(),
LiteralTerm(m_path),
Nepomuk::Query::ComparisonTerm::Equal);
Query query(AndTerm(condterm, pathTerm,
ResourceTypeTerm(Nepomuk::Vocabulary::NCO::IMAccount())));
query.toSparqlQuery gives:
"select distinct ?r where { { { <nepomuk:/res/5dcd4fcd-6305-4b1d-
b085-6ff52971ebc8>
<http://www.semanticdesktop.org/ontologies/2007/03/22/nco#hasIMAccount> ?r
. } UNION { OPTIONAL { ?v2
<http://www.semanticdesktop.org/ontologies/2007/03/22/nco#hasIMAccount> ?v1 .
?v2 a ?v3 . ?v3 <http://www.w3.org/2000/01/rdf-schema#subClassOf>
<http://www.semanticdesktop.org/ontologies/2007/03/22/nco#PersonContact> .
FILTER(?v1=?r) . } . FILTER(!BOUND(?v1)) . } . ?r
<http://nepomuk.kde.org/ontologies/2009/06/20/telepathy#accountIdentifier>
"/my/account/path"^^<http://www.w3.org/2001/XMLSchema#string> . ?r a ?v4 . ?v4
<http://www.w3.org/2000/01/rdf-schema#subClassOf>
<http://www.semanticdesktop.org/ontologies/2007/03/22/nco#IMAccount> . } . }"
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?
--
-------------------
Dario Freddi
KDE Developer
GPG Key Signature: 511A9A3B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/nepomuk/attachments/20100518/86e932ab/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/nepomuk/attachments/20100518/86e932ab/attachment.sig
More information about the Nepomuk
mailing list