[Nepomuk] Issues with NegationTerm+ComparisonTerm::setInverted

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Tue May 18 17:30:05 CEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,


Sebastian Trüg wrote
> why would it be "FILTER(!BOUND(?v2))"?
[...]
> Now let's look at the resulting SPARQL:
>
> [select ?r where ]
> OPTIONAL {
>   ?v2 nco:hasIMAccount ?v1 .
>   ?v2 a ?v3 .
>   ?v3 rdfs:subClassOf nco:PersonContact .
>   FILTER(?v1=?r) .
> } .
> FILTER(!BOUND(?v1)) .
>
> The query looks for a ?v1 which is the im account of something that
> is a person contact. Then it makes sure that this ?v1 is in fact our
> ?r and then it wants this ?v1 not to be bound. In other words it
> would only match if ?r is in fact NOT the im account of some person
> contact.


According to the sparql specs [1] this query:

    OPTIONAL { ?x dc:date ?date } .
    FILTER (!bound(?date)) }

returns all ?x that are not bound to a date.
Our query is supposed to return all ?v1 (IMAccounts) that are not bound
to ?v2 (PersonContact), that's why we thought that the generated query
is not correct and that the bound should be on ?v2, not ?v1.
But in our case, we have an inverse relation respect to the example
(hasAccount), so if we had a property isIMAccountOf, the query should
look like:

    OPTIONAL { ?v1 isIMAccountOf ?v2 } .
    FILTER (!bound(?v2)) }

But with the inverse relation, the bound should still be on ?v2:

    OPTIONAL { ?v2 hasIMAccount ?v1 } .
    FILTER (!bound(?v2)) }

because bounding on ?v1 we will receive all PersonContact that are not
bound to a IMAccount and the resulting IMAccounts will be matched to ?r,
and that's always an empty set.


Regards,
 Daniele


[1]http://www.w3.org/TR/rdf-sparql-query/#func-bound
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iJwEAQECAAYFAkvysl8ACgkQLiFMXTq1e8t2BwP/ZjFNc9zoFLiAPMBo5FbWwZCY
72MGGfqiEaOVqOm75zpWSiCygfcDwYBrJJeI/1x+bjV/ii4f99e5/yXU3ovjk0IA
aKYlDbHVWFYCoibQhEKoRUlMUEBgGl2P79EOVLLgRTsi4sqCatxOJFMuITJZaTpC
KQtiNn1zQDUgnRl+w+c=
=s+K/
-----END PGP SIGNATURE-----


More information about the Nepomuk mailing list