Per James Heald on WIkidata:
Software exists that can act as a wrapper, to add a SPARQL layer around an existing live SQL database (W3C: RDF and SQL). At its simplest, each row in each SQL table becomes an item, each column a relation, the contents of each cell a value.
It would be very nice to expose the existing Mediawiki databases to WDQS, so that one could eg sort or filter query returns by the number of hits; or identify what categories an item is contained in on different wikis; or filter output to return only pages of at least a given length; or marked as stubs, etc. etc.