RDF query can be used to limit the results of certain d-bus methods such as:

Search.Query
Metadata.GetSum
Metadata.GetCount
Metadata.GetUniqueValues
Metadata.GetUniqueValuesWithCount
Metadata.GetUniqueValuesWithCountAndSum

Query examples

Greater than example

 List of all available images larger than 256x256 (good list for image viewer)
<rdfq:Condition>
  <rdfq:and>    

    <rdfq:greaterThan>
      <rdfq:Property name="Image:Width" />
      <rdf:Integer>256</rdf:Integer> 
    </rdfq:greaterThan>

    <rdfq:greaterThan>
      <rdfq:Property name="Image:Height" />
      <rdf:Integer>256</rdf:Integer> 
    </rdfq:greaterThan>


  </rdfq:and>
</rdfq:Condition>

List all music from the 80s

<rdfq:Condition>
  <rdfq:and>    

    <rdfq:greaterThan>
      <rdfq:Property name="Audio:ReleaseDate" />
      <rdf:Integer>1979</rdf:Integer> 
    </rdfq:greaterThan>

    <rdfq:lessThan>
      <rdfq:Property name="Audio:ReleaseDate" />
      <rdf:Integer>1990</rdf:Integer> 
    </rdfq:lessThan>
    
  </rdfq:and>
</rdfq:Condition>

In Set example

Get all office document files

<rdfq:Condition>

  <rdfq:inSet>
    <rdfq:Property name="File:Mime" />
    <rdf:String>application/msword,application/pdf,application/vnd.ms-excel,application/vnd.oasis.opendocument.text,application/vnd.sun.xml.writer</rdf:String> 
  </rdfq:inSet>

</rdfq:Condition>

Containing string example

Get available video files.

<rdfq:Condition>
  <rdfq:contains>
    <rdfq:Property name="File:Mime" />
    <rdf:String>video/</rdf:String> 
  </rdfq:contains>
</rdfq:Condition>

It is better to use the category based list though, but this is an example on how to do it on RDF-query.

Get available mp2 music files.

We need access to the complete list of ogg music files.

RDF query:

<rdfq:Condition>
  <rdfq:contains>
    <rdfq:Property name="File:Mime" />
    <rdf:String>audio/ogg</rdf:String> 
  </rdfq:contains>
</rdfq:Condition>

Projects/Tracker/Documentation/RDF-Query (last edited 2013-11-25 12:54:24 by WilliamJonMcCann)