Hi!
Wikidata seems to use the experimental Java server,
not the default and more tested Node.js server.
I reported it here:
https://github.com/LinkedDataFragments/Server.Java/issues/41
After thinking a bit about it I *think* I've found the logic behind it:
when it encounters first P-statement, it uses only suffix and puts the
full URL in @context. However when it encounters second URI with the
same suffix, it uses the prefix and then there's no need in @context.
Since the statements can be encountered in any order in the DB, it's not
consistent which of the two gets @context and which gets prefix.
The algorithm for parsing it would be checking if the key has :, if yes,
resolve against prefix, if not - resolve against @context.
--
Stas Malyshev
smalyshev(a)wikimedia.org