1. General Examples
Contents
-
General Examples
- Get list of all available classes
- Get list of all available properties
- Get list of all classes in use
- Get list of all properties in use
- Get list of all known items
- Get all info about home dir
- Get list of all known files in home dir
- Update as MusicPieces the objects that have the Mime Type "audio/foo"
- Get files that match either criteria
1.1. Get list of all available classes
tracker sparql -q "SELECT ?s WHERE { ?s rdf:type rdfs:Class . }"
1.2. Get list of all available properties
tracker sparql -q "SELECT ?s WHERE { ?s rdf:type rdf:Property . }"
1.3. Get list of all classes in use
tracker sparql -q "SELECT DISTINCT ?o WHERE { ?s rdf:type ?o . }"
1.4. Get list of all properties in use
tracker sparql -q "SELECT DISTINCT ?p WHERE { ?s ?p ?o . }" # Not possible in Tracker as of writing
1.5. Get list of all known items
tracker sparql -q "SELECT ?s WHERE { ?s rdf:type nie:InformationElement . }"
1.6. Get all info about home dir
# this is like "tracker info $HOME" tracker sparql -q "SELECT ?u { ?u nie:url 'file://$HOME' . } Results: urn:uuid:xyz tracker sparql -q "SELECT * WHERE { <urn:uuid:xyz> ?p ?o . }"
1.7. Get list of all known files in home dir
tracker sparql -q "SELECT ?url WHERE { ?s a nfo:FileDataObject ; nie:url ?url . FILTER (STRSTARTS (?url, 'file://$HOME/' . }"
1.8. Update as MusicPieces the objects that have the Mime Type "audio/foo"
tracker sparql -u -q "INSERT { ?urn a nmm:MusicPiece . } WHERE { ?urn nie:mimeType \"audio/foo\" . }"
1.9. Get files that match either criteria
Use UNION to get files where either file name contains "physics" or where the title contains "physics".
tracker sparql -q "SELECT nie:url(?s) WHERE { ?s a nfo:FileDataObject . ?s nie:url ?url . { ?s nfo:fileName ?name . FILTER (CONTAINS(LCASE(?name), 'physics')) } UNION { ?s nie:title ?title . FILTER (CONTAINS(LCASE(?title), 'physics')) } }"