[Nepomuk] Complex SPARQL Query

Vishesh Handa me at vhanda.in
Mon Dec 10 13:16:56 UTC 2012


I finally managed.

select ?r where { ?r nao:lastModified ?m1, ?m2. FILTER( ?m1 != ?m2 ). }

I made this into a more generic query -

select ?r ?p where { ?p nrl:maxCardinality "1"^^xsd:int . ?r ?p ?o1,?o2 .
FILTER( ?o1 != ?o2 ) . }

It's now there in the nepomukcleaner



On Fri, Nov 30, 2012 at 1:38 PM, Ivan Čukić <ivan.cukic at kde.org> wrote:

> Hi,
>
> Maybe something like this (can't test, not at home, so the syntax is
> probably borked as well)
>
> select ?resource, count(*) as ?count
> where { ... }
> group by ?resource
> having ?count > 1
>
>
>
>
> On 30 November 2012 06:10, Vishesh Handa <me at vhanda.in> wrote:
>
>> Hey guys
>>
>> I'm trying to write a sparql query to list all the resources which have
>> more than 1 value for nao:lastModified (cause of buggy code).
>>
>> I was trying - "select distinct ?r (select count(?m) where { ?r
>> nao:lastModified ?m . }) as ?mc where { ?r ?p ?o . FILTER( ?mc > 1 ) . }"
>>
>> But virtuoso refuses to let me use the ?mc variable in the where clause.
>> I can do a - "select distinct ?r (select count(?m) where { ?r
>> nao:lastModified ?m . }) as ?mc where { ?r ?p ?o . } ORDER BY DESC(?mc)
>> LIMIT 10". Check the results, modify them, and re-run the query, but it's
>> terribly slow. Running this query takes over a minute.
>>
>> Does anyone know of a simpler way of doing this?
>>
>> --
>> Vishesh Handa
>>
>>
>> _______________________________________________
>> Nepomuk mailing list
>> Nepomuk at kde.org
>> https://mail.kde.org/mailman/listinfo/nepomuk
>>
>>
>
>
> --
> While you were hanging yourself on someone else's words
> Dying to believe in what you heard
> I was staring straight into the shining sun
>



-- 
Vishesh Handa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/nepomuk/attachments/20121210/abab521c/attachment.html>


More information about the Nepomuk mailing list