Re: [Tracker] RDF Queries



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

--
Regards,
Martyn



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