Re: [Tracker] RDF Queries



Huh. I played with this a bit more today, and it was giving me errors:

executing rdf query <rdfq:Condition>
   <rdfq:equals>
       <rdfq:Property name='Audio:Album' />
       <rdf:String>Plans</rdf:String>
   </rdfq:equals>
</rdfq:Condition>

with search term  and keyword
search term is
translated rdf query is
Select DISTINCT (S.Path || '/' || S.Name) as uri, GetServiceName(S.ServiceTypeID) as stype , S.Mime FROM Services S INNER JOIN ServiceMetaData M1 ON (S.ID = M1.ServiceID and M1.MetaDataID in (35)) WHERE (S.ServiceTypeID in (select TypeId from ServiceTypes where TypeName = 'Music' or Parent = 'Music')) AND (M1.MetaDataValue = ' 'Plans' ') LIMIT 0,512

ERROR: query Select DISTINCT (S.Path || '/' || S.Name) as uri, GetServiceName(S.ServiceTypeID) as stype , S.Mime FROM Services S INNER JOIN ServiceMetaData M1 ON (S.ID = M1.ServiceID and M1.MetaDataID in (35)) WHERE (S.ServiceTypeID in (select TypeId from ServiceTypes where TypeName = 'Music' or Parent = 'Music')) AND (M1.MetaDataValue = ' 'Plans' ') LIMIT 0,512 failed with error: near "Plans": syntax error


I also ran tracker-extract on the mp3 file that I was expecting to get a hit from, and it didn't return any meta data. I'm guessing that means that tracker isn't gathering meta data from music files? If that's true, is it possible to change the config so it will?

Also, I tried to find people on IRC, but to no avail either on freenode (as mentioned in the thread) or Gimpnet, as mentioned on the tracker site.

Mike



Martyn Russell wrote:
Michael Lissner wrote:

Any help would be appreciated, and if I can find the time, I'd be happy to work on documentation, if it's not done yet.

These are some of the RDF queries we have used with tracker:

#define RDF_QUERY_ALL                        \
    "<rdfq:Condition>\n"                    \
    "  <rdfq:and>\n"                    \
    "    <rdfq:startsWith>\n"                \
    "      <rdfq:Property name='File:Path' />\n"        \
    "      <rdf:String>/</rdf:String>\n"            \
    "    </rdfq:startsWith>\n"                \
    "    <rdfq:not>\n"                    \
    "      <rdfq:equals>\n"                    \
    "        <rdfq:Property name='File:Mime' />\n"        \
    "        <rdf:String>inode/directory</rdf:String>\n"    \
    "      </rdfq:equals>\n"                \
    "    </rdfq:not>\n"                    \
    "  </rdfq:and>\n"                    \
    "</rdfq:Condition>\n"

#define RDF_QUERY_MMCS                        \
    "<rdfq:Condition>\n"                    \
    "  <rdfq:and>\n"                    \
    "    <rdfq:or>\n"                    \
    "      <rdfq:startsWith>\n"                \
    "        <rdfq:Property name='File:Path' />\n"        \
    "        <rdf:String>/media/mmc1</rdf:String>\n"    \
    "      </rdfq:startsWith>\n"                \
    "      <rdfq:startsWith>\n"                \
    "        <rdfq:Property name='File:Path' />\n"        \
    "        <rdf:String>/media/mmc2</rdf:String>\n"    \
    "      </rdfq:startsWith>\n"                \
    "    </rdfq:or>\n"                    \
    "    <rdfq:not>\n"                    \
    "      <rdfq:equals>\n"                    \
    "        <rdfq:Property name='File:Mime' />\n"        \
    "        <rdf:String>inode/directory</rdf:String>\n"    \
    "      </rdfq:equals>\n"                \
    "    </rdfq:not>\n"                    \
    "  </rdfq:and>\n"                    \
    "</rdfq:Condition>\n"

#define RDF_QUERY_FOR_ARTISTS                    \
    "<rdfq:Condition>\n"                    \
    "  <rdfq:equals>\n"                    \
    "    <rdfq:Property name='Audio:Artist' />\n"           \
    "    <rdf:String>%s</rdf:String>\n"                \
    "  </rdfq:equals>\n"                    \
    "</rdfq:Condition>\n"

#define RDF_QUERY_FOR_ALBUMS                    \
    "<rdfq:Condition>\n"                    \
    "  <rdfq:equals>\n"                    \
    "    <rdfq:Property name='Audio:Album' />\n"            \
    "    <rdf:String>%s</rdf:String>\n"            \
    "  </rdfq:equals>\n"                    \
    "</rdfq:Condition>\n"

#define RDF_QUERY_FOR_PLAYLISTS                    \
    "<rdfq:Condition>\n"                    \
    "  <rdfq:equals>\n"                    \
    "    <rdfq:Property name='Playlist:Name' />\n"          \
    "    <rdf:String>%s</rdf:String>\n"            \
    "  </rdfq:equals>\n"                    \
    "</rdfq:Condition>\n"

#define RDF_QUERY_FOR_TAGS                    \
    "<rdfq:Condition>\n"                    \
    "  <rdfq:equals>\n"                    \
    "    <rdfq:Property name='User:Keywords' />\n"          \
    "    <rdf:String>%s</rdf:String>\n"            \
    "  </rdfq:equals>\n"                    \
    "</rdfq:Condition>\n"

Hope this helps. To make sure you have content worthy of being found by RDF queries, remember, you have the src/tracker-utils/ applications to return a bunch of information. E.g.:

  tracker-stats
  tracker-files -s Images
  tracker-unique Audio:Artist
  tracker-services -p
  tracker-search mp3
  tracker-info /path/to/file




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