owlim-discussion  

Re: [Owlim-discussion] Counting soundtrack's tracks

Ivan Peikov
Mon, 21 Jun 2010 07:24:59 -0700

Hi Adam,

Unfortunately, SPARQL doesn't support grouping (as supported in SQL). In this 
case you will probably have to implement this functionality in the result 
processing code (i.e. do the counting yourself).

BTW, this is a very common complaint from SPARQL and is not a deficiency of 
FactForge but a limitation of the SPARQL standard.

BigOWLIM (the storage and inference engine behind FactForge) supports result 
counting in its own custom-tailored way, but even this mechanism won't help 
in your case -- it can count the number of all results returned by the query, 
but it can't group results by soundtrack and count the results in each group.


Cheers,
Ivan

On Monday 21 June 2010 17:03:31 Adam Coen wrote:
> Hi, I'd like to count the number of tracks included for each soundtrack
> album in freebase.
> Using FactForge sparql end-point first I select movies from DBpedia, then I
> use the freebase URI to get to the soundtrack page:
>
> PREFIX fb-film: <http://rdf.freebase.com/ns/film.film.>
> PREFIX db-ont: <http://dbpedia.org/ontology/>
> PREFIX db-work: <http://dbpedia.org/ontology/Work/>
> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> PREFIX owl: <http://www.w3.org/2002/07/owl#>
>
> SELECT  ?id ?uriOST
>  WHERE {
> ?id rdf:type db-ont:Film .
> ?id owl:sameAs ?uriFB .
> ?id db-ont:releaseDate ?data_uscita .
> ?id db-work:runtime ?durata .
> ?id db-ont:gross ?incasso .
> ?uriFB fb-film:soundtrack ?uriOST .
>
> FILTER regex(str(?uriFB),"freebase")
> }
>
> LIMIT 300
>
> Now I'd like to count the number of tracks which the soundtrack is composed
> by, but I really don't know how since FactForge doesn't accept neither
> COUNT nor GROUP BY.
> Could anybody help me?


_______________________________________________
OWLIM-discussion mailing list
OWLIM-discussion@ontotext.com
http://ontotext.com/mailman/listinfo/owlim-discussion