Re: [PATCH 2/5] tracker: add proper name to devices



On Wed, 2011-01-26 at 20:50 +0100, Juan A. Suárez Romero wrote:
> On Tue, 2011-01-25 at 10:47 +0000, llandwerlin gmail com wrote:
> > +#define TRACKER_MOUNTED_DATASOURCES_START                    \
> > +  "SELECT nie:dataSource(?urn) AS ?datasource "              \
> > +  "(SELECT nie:url(tracker:mountPoint(?ds)) "                \
> > +  "WHERE { ?urn nie:dataSource ?ds  }) "                     \
> > +  "(SELECT GROUP_CONCAT(tracker:isMounted(?ds), \",\") "     \
> > +  "WHERE { ?urn nie:dataSource ?ds  }) "                     \
> >    "WHERE { ?urn a nfo:FileDataObject . FILTER (?urn IN ("
> >  
> >  #define TRACKER_MOUNTED_DATASOURCES_END " ))} GROUP BY (?datasource)"
> >  
> > +#define TRACKER_DATASOURCES_REQUEST                                     \
> > +  "SELECT ?urn nie:dataSource(?urn) AS ?source "                        \
> > +  "(SELECT GROUP_CONCAT(nie:url(tracker:mountPoint(?ds)), \",\") "      \
> > +  "WHERE { ?urn nie:dataSource ?ds  }) "                                \
> > +  "WHERE { "                                                            \
> > +  "?urn tracker:available ?tr . "                                       \
> > +  "?source a tracker:Volume . "                                         \
> > +  "FILTER (bound(nie:dataSource(?urn))) "                               \
> > +  "} "                                                                  \
> >    "GROUP BY (?source)"
> >  
> 
> I find these queries far complicated to understand. 
> 
> What are you trying to get?
> 
> For the case of TRACKER_DATASOURCES_REQUEST seems you are trying to get
> the list of tracker Volumens, but still not sure why getting the ?urn
> and other fields.

TRACKER_DATASOURCES_REQUEST is the first request we made after the
plugin initialization. It gives us the list of available volumes indexed
by tracker. It may be possible to simplify it a little bit.

Just before we list the devices, we start listening to tracker
GraphUpdate signals which give us the updates on the database. We do a
quick filtering of this updates informations to just care about updated
files. At this point, we don't know the associated URN for each updated
file. What we have is an integer (tracker:id property).
TRACKER_MOUNTED_DATASOURCES_* are used to build a request which is going
to give us the list of the sources related to the changes given a list
of tracker:id properties.

The complexity of these queries is related to the fact that the
nie:dataSource property is a multi-value key. The following request
should display all the URN and mount point of all audio files on the
tracker database :

	SELECT ?urn tracker:mountPoint(nie:dataSource(?urn))
	  WHERE { ?urn a nfo:Audio }

Unfortunately, this won't give us the mountPoint because of the
multi-value state of nie:dataSource.

Thus we have to concatenate all the values in nie:dataSource (so far I
haven't seen any data source with more than one element) .

Regards,

--
Lionel Landwerlin




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]