Wikibase QueryEngine

Jump to: navigation, search

As part of the Wikidata project, a rudimentary query engine has been created.

This indexes Wikibase Entity objects and allows doing Ask queries against the data. The QueryEngine has currently just one implementation, the SQLStore, which is very much inspired on SMWs SQLStore3. It can be seen as a cleaner implementation of SQLStore3 that uses the Wikibase DataModel rather then the SMW DataItem+DataValue+SemanticData collection.

As its only dependency on anything Wikibase is the DataModel, future usage by SMW is not out of the question. Especially if SMW switches its DI+DV implementation to the DataValues component, and swaps out the old Ask implementation for the new one, the effort to do so would not be all that big. The current interface of this SQLStore is Wikibase DataModel specific, and uses the Wikibase Entity class rather than SMWs SemanticData. It is possible however to create alternative implementations of the relevant code, which is really a small part of the entire component, to create an additional SMW specific interface. This would effectively be a new store, which would behind the scene share most of its code with the already existing one.

Advantages of making such a change are:

  • The implementation is a lot cleaner (way lower complexity), and thus easier to maintain and extend
  • It is a lot more solid and has many unit and integration tests
  • The amount of SMW specific code, and thus things that need to maintained by only SMW devs, is decreased
  • Wikibase QueryEngine uses Wikibase Database (which is not dependent on other Wikibase stuff), and allows us to get rid of some of our setup code (which is bad)

As of October 2013, the QueryEngine SQL store has only implemented support for the most trivial kind of queries in its SQL generation code. This needs to change before potential SMW adoption, though will likely have happened by the time DataValues and Ask are in use by SMW, which is pretty much a prerequisite. The Wikibase Database component which is used currently only supports MySQL and SQLite. Support for PostGres would need to be added if we want to support it.