Fix assertion on construction.

Ensure g_init_type() is called before attempting to use any of the
tracker_sparql api.

Change-Id: I2d71c362bc43fb1f51a6d66c4d26daf3a45e5999
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Verify the type of query results before accessing them.

Tracker will emit ugly warning messages if the wrong accessor is used
to access a value including when the result is null, so always check
the type before extracting a value.

Change-Id: I4df575aa742fd047e7fd349f43339d999305a2c1
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>