Hi, Sebastian explain this a couple of days ago here :). Count is available in API using CreateCountQuery
http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk/html/classNepomuk_1_1Query_1_1Query.html#ad3c79b80b619cab4841e8faa203fb3daad550c1ac98e41005749758fab9aded3f So basically you must construct the query using the API and then add the CreateCountQuery flag. On Tue, Oct 18, 2011 at 2:36 PM, Marco Martin <[email protected]> wrote: > Hi all, > > a thing i'm experimenting with for the resource browser of active is being > able to have informations from nepomuk as "clouds" of attributes, so apart > the > tag cloud (easy, built in ;) i need a similar thing for other properties as > well, so results of the form property/occurrences > > i did some experiments and did manage only in pure Sparql so far (see > below).. > > would those be possible in the c++ api? also because i would like to > arbitrarly mix them to have things like > "cardinalities of ratings per activity" > or > "cardinalities of tags of things in a certain date interval" > and in Sparql can become very messy quite quickly ;) > > > #how many resources of each type > > SELECT ?o count(*) as ?count > WHERE {?s rdf:type ?o} > group by ?o > > > > > #how many resources of each rating > > SELECT ?rating count(*) as ?count > WHERE {?s > <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#numericRating> > ?rating} > group by ?rating > > > > > #how many resources of each type, related to the activity > nepomuk:/res/47d7281f-dd5c-4162-8026-5bc069f91945 > > select distinct ?t count(*) as ?count > where { <nepomuk:/res/47d7281f-dd5c-4162-8026-5bc069f91945> > <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#isRelated> ?r . > ?r rdf:type ?t . > ?r <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#userVisible> > ?v1 > . > FILTER(?v1>0) . } > group by ?t > > > > #how many resources per activity > > select distinct ?a count(*) as ?count > where { ?a > <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#isRelated> ?r > . ?a rdf:type kext:Activity > } group by ?a > > -- > Marco Martin > _______________________________________________ > Nepomuk mailing list > [email protected] > https://mail.kde.org/mailman/listinfo/nepomuk > -- Best wishes, Ignacio
_______________________________________________ Nepomuk mailing list [email protected] https://mail.kde.org/mailman/listinfo/nepomuk
