Fix sparql generation for linked data.

Nested references no longer seem to work, either for referencing return
values or in filters.  So build predicate statements whenever there is
a relationship between types.

Change-Id: Id9015047764d36ed3854bf4a785fb6b5bcba639b
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Exclude query results located on removed media.

Only include results whose tracker:available property is true, or if
query is for an aggregate type then only include results which aggregate
data from a item with a true tracker:available property.

Change-Id: Iaf7487fb33fa0f7bdc0537ba3240fa4cb2c93a44
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Don't exclude results with incomplete information from results.

Make any predicates required for filters, results, or sorting optional.

Change-Id: I5a506999b40746d095d6969c4e61c90543982bb0
Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
MER: Add packaging.

Change-Id: I1e942440b902a89910efe120b71653fe6ae390df