{"id":1340,"date":"2014-05-06T23:50:12","date_gmt":"2014-05-06T22:50:12","guid":{"rendered":"https:\/\/www.entropywins.wtf\/blog\/?p=1340"},"modified":"2019-05-06T08:59:02","modified_gmt":"2019-05-06T07:59:02","slug":"wikibase-and-doctrine-dbal","status":"publish","type":"post","link":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/","title":{"rendered":"Wikibase and Doctrine DBAL"},"content":{"rendered":"<p><a href=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1338\" data-permalink=\"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/the-wikidata-phase3-software-components\/dt\/\" data-orig-file=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt.png\" data-orig-size=\"213,61\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"dt\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt.png\" class=\"alignnone size-full wp-image-1338\" src=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt.png\" alt=\"dt\" width=\"213\" height=\"61\" srcset=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt.png 213w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt-100x28.png 100w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt-150x42.png 150w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt-200x57.png 200w\" sizes=\"auto, (max-width: 213px) 100vw, 213px\" \/><\/a><\/p>\n<p>When I started writing this blog post, I realized some introduction to the query components was first due. You can find it in my last blog post: <a href=\"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/the-wikidata-phase3-software-components\/\">The Wikidata phase3 software components<\/a>.<\/p>\n<p>In this post I described how the SQLStore uses a database abstraction layer to not bind itself to a particular relational database. The <a href=\"http:\/\/wikiba.se\/\">Wikibase software<\/a> as a whole is already using a database abstraction layer, namely the one MediaWiki provides. Even though the main Wikibase applications, Wikibase Client and Wikibase Repo, depend on MediaWiki, the SQLStore does not. That rules out direct usage of the <a href=\"https:\/\/www.mediawiki.org\/wiki\/Manual:Database_access\">MediaWiki database abstraction layer<\/a>.<\/p>\n<p>Nevertheless, the MediaWiki database abstraction layer has served us reasonably well, and the team is familiar with it. Furthermore, using it does not introduce a new dependency that WMF operations might get mad about. So what we did was create a new set of interfaces for database interaction, much in line with those of the MediaWiki database abstraction later, though without a bunch of design issues the later suffers from. We then created thin implementations of these interfaces that delegated to the MediaWiki database abstraction layer. This inversion of control made it possible to use the MW abstraction layer in SQLStore, without having\u00a0SQLStore know about MediaWiki.<\/p>\n<p>These interfaces where put in a new component called Wikibase Database. I covered <a href=\"https:\/\/www.entropywins.wtf\/blog\/2013\/11\/01\/new-database-abstraction-layer-for-mediawiki\/\">the creation of Wikibase Database<\/a> in an earlier blog post.<\/p>\n<p>The SQLStore does not have a fully fixed schema. One can configure which types of data are supported, and generally each type of data has its own table. Furthermore one can provide additional types of data that the core SQLStore does not support. Hence having the tables build with manually constructed SQL in sql files as done in MediaWiki does not seem convenient at all. The <a href=\"https:\/\/semantic-mediawiki.org\/\">Semantic MediaWiki<\/a> deals with this problem by dynamically generating a declarative definition of the schema and then translating that into SQL. We went with the same approach for the SQLStore, though took a lot of care to not repeat the spaghetti implementation approach of SMW.<\/p>\n<p>This means we needed some way to represent tables, columns, indexes, etc in PHP. Furthermore, we&#8217;d need to be able to turn this PHP representation into SQL compatible with the used database. Unfortunately the MediaWiki database abstraction later can do neither of those.<\/p>\n<p>What we ended up doing was creating schema representation objects and adding additional interfaces to Wikibase Database. And than creating implementations of those for MySQL and SQLite. Needless to say, writing such SQL generation code is rather tedious and quite hard to test. We knew that before hand, and spend quite some time looking around for existing solutions we&#8217;d be able to delegate to. Unfortunately none where found.<\/p>\n<p>Several months later I somehow ended up on the <a href=\"http:\/\/docs.doctrine-project.org\/projects\/doctrine-dbal\/en\/latest\/reference\/architecture.html\">architecture page of Doctrine DBAL<\/a>. After reading through the basic introduction there, I thought &#8220;oh wow, this sound very similar to what we did in Wikibase Database&#8221;. So I read through the more detailed docs, and slowly came to the realization that DBAL is exactly what we had been looking for before. Making the facepalm even worse, I actually read through the basic Doctrine docs and quickly looked at its source when doing the initial research. Base on that I had concluded that it came with all this not needed ORM stuff, not realizing <a href=\"http:\/\/www.doctrine-project.org\/\">Doctrine<\/a> itself was build on an independent <a href=\"http:\/\/www.doctrine-project.org\/projects\/dbal.html\">DBAL<\/a>.<\/p>\n<p><a href=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/facepalm.jpeg\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1341\" data-permalink=\"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/facepalm\/\" data-orig-file=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/facepalm.jpeg\" data-orig-size=\"318,451\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"facepalm\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/facepalm.jpeg\" class=\"alignnone wp-image-1341\" src=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/facepalm.jpeg\" alt=\"facepalm\" width=\"166\" height=\"235\" srcset=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/facepalm.jpeg 318w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/facepalm-211x300.jpeg 211w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/facepalm-100x141.jpeg 100w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/facepalm-150x212.jpeg 150w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/facepalm-200x283.jpeg 200w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/facepalm-300x425.jpeg 300w\" sizes=\"auto, (max-width: 166px) 100vw, 166px\" \/><\/a><\/p>\n<p>I&#8217;ve now migrated the SQLStore to use Doctrine DBAL rather than Wikibase Database. The similarities between the interfaces of both abstraction layers is extremely high. The structure of the schema definition objects is essentially identical.<\/p>\n<p><a href=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1342\" data-permalink=\"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/dbal\/\" data-orig-file=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal.png\" data-orig-size=\"1069,316\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"dbal\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal-1024x302.png\" class=\"alignnone wp-image-1342 \" src=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal.png\" alt=\"dbal\" width=\"880\" height=\"260\" srcset=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal.png 1069w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal-300x88.png 300w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal-1024x302.png 1024w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal-100x29.png 100w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal-150x44.png 150w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal-200x59.png 200w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal-450x133.png 450w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal-600x177.png 600w, https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dbal-900x266.png 900w\" sizes=\"auto, (max-width: 880px) 100vw, 880px\" \/><\/a><\/p>\n<p>Of course Doctrine DBAL has many interfaces that Wikibase Database does not have. For instance, it can compare two schemas with each other, and turn the diff into SQL queries. That&#8217;s something that we will very likely have use for at a later point. It also has a nice query builder, support for more databases and a much more solid implementation overall. And perhaps most important of all, it does not need to be maintained by us. That&#8217;s one big project liability traded for another liability orders of magnitude less significant \ud83d\ude42<\/p>\n<p>The <a href=\"https:\/\/github.com\/wmde\/WikibaseQueryEngine\/pull\/29\">refactoring in the SQLStore<\/a> from Wikibase Database killed about 1000 lines of code and obsoleted Wikibase Database (8000 lines of code) itself. Granted, this refactoring also tackled a design problem that caused not needed complexity, which contributed to this 1000 lines. It&#8217;s always great when you can remove so much code while retaining all functionality. In fact some TODOs got tackled along the way and some bugs got fixed. Oh and, we can now run the integration tests on an in-memory SQLite database \\o\/<\/p>\n<p>So far my experience with Doctrine DBAL has been almost entirely positive. Many thanks to the authors of this software.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I started writing this blog post, I realized some introduction to the query components was first due. You can&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[331,347,346,156,197,215,316,348,317,343,344,305],"class_list":["post-1340","post","type-post","status-publish","format-standard","hentry","category-programming","tag-architecture","tag-dbal","tag-doctrine","tag-mediawiki","tag-planet-wikimedia","tag-refactoring","tag-software-design","tag-sqlstore","tag-wikibase","tag-wikibase-query","tag-wikibase-queryengine","tag-wikidata"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Wikibase and Doctrine DBAL - Blog of Jeroen De Dauw<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Wikibase and Doctrine DBAL - Blog of Jeroen De Dauw\" \/>\n<meta property=\"og:description\" content=\"When I started writing this blog post, I realized some introduction to the query components was first due. You can&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog of Jeroen De Dauw\" \/>\n<meta property=\"article:published_time\" content=\"2014-05-06T22:50:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-06T07:59:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt.png\" \/>\n<meta name=\"author\" content=\"Jeroen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/JeroenDeDauw\" \/>\n<meta name=\"twitter:site\" content=\"@JeroenDeDauw\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeroen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/\"},\"author\":{\"name\":\"Jeroen\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#\\\/schema\\\/person\\\/4e2ef14f2ca7dc3a0ac137d1692b66b7\"},\"headline\":\"Wikibase and Doctrine DBAL\",\"datePublished\":\"2014-05-06T22:50:12+00:00\",\"dateModified\":\"2019-05-06T07:59:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/\"},\"wordCount\":802,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#\\\/schema\\\/person\\\/4e2ef14f2ca7dc3a0ac137d1692b66b7\"},\"image\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/05\\\/dt.png\",\"keywords\":[\"Architecture\",\"DBAL\",\"Doctrine\",\"MediaWiki\",\"Planet Wikimedia\",\"Refactoring\",\"Software design\",\"SQLStore\",\"Wikibase\",\"Wikibase Query\",\"Wikibase QueryEngine\",\"wikidata\"],\"articleSection\":[\"Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/\",\"url\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/\",\"name\":\"Wikibase and Doctrine DBAL - Blog of Jeroen De Dauw\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/05\\\/dt.png\",\"datePublished\":\"2014-05-06T22:50:12+00:00\",\"dateModified\":\"2019-05-06T07:59:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/05\\\/dt.png\",\"contentUrl\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/05\\\/dt.png\",\"width\":213,\"height\":61},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2014\\\/05\\\/06\\\/wikibase-and-doctrine-dbal\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Wikibase and Doctrine DBAL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/\",\"name\":\"Entropy Wins\",\"description\":\"A blog on Software Architecture, Design and Craftsmanship\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#\\\/schema\\\/person\\\/4e2ef14f2ca7dc3a0ac137d1692b66b7\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#\\\/schema\\\/person\\\/4e2ef14f2ca7dc3a0ac137d1692b66b7\",\"name\":\"Jeroen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g\",\"caption\":\"Jeroen\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/jeroendedauw\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/JeroenDeDauw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Wikibase and Doctrine DBAL - Blog of Jeroen De Dauw","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/","og_locale":"en_US","og_type":"article","og_title":"Wikibase and Doctrine DBAL - Blog of Jeroen De Dauw","og_description":"When I started writing this blog post, I realized some introduction to the query components was first due. You can&hellip;","og_url":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/","og_site_name":"Blog of Jeroen De Dauw","article_published_time":"2014-05-06T22:50:12+00:00","article_modified_time":"2019-05-06T07:59:02+00:00","og_image":[{"url":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt.png","type":"","width":"","height":""}],"author":"Jeroen","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/JeroenDeDauw","twitter_site":"@JeroenDeDauw","twitter_misc":{"Written by":"Jeroen","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/#article","isPartOf":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/"},"author":{"name":"Jeroen","@id":"https:\/\/www.entropywins.wtf\/blog\/#\/schema\/person\/4e2ef14f2ca7dc3a0ac137d1692b66b7"},"headline":"Wikibase and Doctrine DBAL","datePublished":"2014-05-06T22:50:12+00:00","dateModified":"2019-05-06T07:59:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/"},"wordCount":802,"commentCount":2,"publisher":{"@id":"https:\/\/www.entropywins.wtf\/blog\/#\/schema\/person\/4e2ef14f2ca7dc3a0ac137d1692b66b7"},"image":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/#primaryimage"},"thumbnailUrl":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt.png","keywords":["Architecture","DBAL","Doctrine","MediaWiki","Planet Wikimedia","Refactoring","Software design","SQLStore","Wikibase","Wikibase Query","Wikibase QueryEngine","wikidata"],"articleSection":["Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/","url":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/","name":"Wikibase and Doctrine DBAL - Blog of Jeroen De Dauw","isPartOf":{"@id":"https:\/\/www.entropywins.wtf\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/#primaryimage"},"image":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/#primaryimage"},"thumbnailUrl":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt.png","datePublished":"2014-05-06T22:50:12+00:00","dateModified":"2019-05-06T07:59:02+00:00","breadcrumb":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/#primaryimage","url":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt.png","contentUrl":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/05\/dt.png","width":213,"height":61},{"@type":"BreadcrumbList","@id":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/wikibase-and-doctrine-dbal\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.entropywins.wtf\/blog\/"},{"@type":"ListItem","position":2,"name":"Wikibase and Doctrine DBAL"}]},{"@type":"WebSite","@id":"https:\/\/www.entropywins.wtf\/blog\/#website","url":"https:\/\/www.entropywins.wtf\/blog\/","name":"Entropy Wins","description":"A blog on Software Architecture, Design and Craftsmanship","publisher":{"@id":"https:\/\/www.entropywins.wtf\/blog\/#\/schema\/person\/4e2ef14f2ca7dc3a0ac137d1692b66b7"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.entropywins.wtf\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.entropywins.wtf\/blog\/#\/schema\/person\/4e2ef14f2ca7dc3a0ac137d1692b66b7","name":"Jeroen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g","caption":"Jeroen"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g"},"sameAs":["https:\/\/www.linkedin.com\/in\/jeroendedauw\/","https:\/\/x.com\/https:\/\/twitter.com\/JeroenDeDauw"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p74TBF-lC","jetpack-related-posts":[{"id":1337,"url":"https:\/\/www.entropywins.wtf\/blog\/2014\/05\/06\/the-wikidata-phase3-software-components\/","url_meta":{"origin":1340,"position":0},"title":"The Wikidata phase3 software components","author":"Jeroen","date":"2014-05-06","format":false,"excerpt":"Work on the long awaited query functionality for the Wikidata project has already happened during a period of several months. Since queries are a completely disjoint feature set from the existing functionality, we decided to put it into a new component part of the Wikibase software. This component is called\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1141,"url":"https:\/\/www.entropywins.wtf\/blog\/2013\/11\/01\/new-database-abstraction-layer-for-mediawiki\/","url_meta":{"origin":1340,"position":1},"title":"New database abstraction layer for MediaWiki","author":"Jeroen","date":"2013-11-01","format":false,"excerpt":"Disclaimer: the views and opinions expressed in this blog post are my own, and do not reflect those of Wikmedia Germany or my colleagues. At Wikimedia Germany, we\u2019ve created a library that acts as database abstraction layer and which is largely build on top of the MediaWiki database abstraction layer.\u2026","rel":"","context":"With 1 comment","block_context":{"text":"With 1 comment","link":"https:\/\/www.entropywins.wtf\/blog\/2013\/11\/01\/new-database-abstraction-layer-for-mediawiki\/#comments"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1453,"url":"https:\/\/www.entropywins.wtf\/blog\/2015\/08\/11\/wikibase-datamodel-services\/","url_meta":{"origin":1340,"position":2},"title":"Wikibase DataModel Services","author":"Jeroen","date":"2015-08-11","format":false,"excerpt":"I'm happy to announce the immediate availability of a new Wikibase library: Wikibase DataModel Services (which I'll in this blog post refer to as DMS). Rationale behind the library The main motivation for introducing this new library is to reduce technical debt and draw more solid architectural boundaries in the\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1383,"url":"https:\/\/www.entropywins.wtf\/blog\/2014\/08\/02\/optional-table-alias-in-the-doctrine-querybuilder\/","url_meta":{"origin":1340,"position":3},"title":"Doctrine QueryBuilder table alias","author":"Jeroen","date":"2014-08-02","format":false,"excerpt":"The Doctrine project, best known for its Object Relational Mapper, also includes a database abstraction layer, used by the ORM. This abstraction layer is called DBAL, for DataBase Abstraction Layer. Quickly after I started using DBAL in some Wikibase components, I got annoyed at how single table single table selects\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"dbal-old","src":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2014\/08\/dbal-old.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1165,"url":"https:\/\/www.entropywins.wtf\/blog\/2013\/12\/23\/wikibase-datamodel-released\/","url_meta":{"origin":1340,"position":4},"title":"Wikibase DataModel released!","author":"Jeroen","date":"2013-12-23","format":false,"excerpt":"I\u2019m happy to announce the 0.6 release of Wikibase DataModel. This is the first real release of this component. DataModel? Wikibase is the software behind Wikidata.org. At its core, this software is about describing entities. Entities are collections of claims, which can have qualifiers, references and values of various different\u2026","rel":"","context":"In \"Component\"","block_context":{"text":"Component","link":"https:\/\/www.entropywins.wtf\/blog\/tag\/component\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1524,"url":"https:\/\/www.entropywins.wtf\/blog\/2016\/01\/25\/replicator-a-cli-tool-for-wikidata\/","url_meta":{"origin":1340,"position":5},"title":"Replicator: Wikidata import tool","author":"Jeroen","date":"2016-01-25","format":false,"excerpt":"I'm happy to announce the first release of Replicator, a CLI tool for importing entities from Wikidata. Replicator was created for importing data from Wikidata into the QueryR REST API persistence. It has two big conceptual components: getting entities from a specified source, and then doing something with said entities.\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/posts\/1340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/comments?post=1340"}],"version-history":[{"count":3,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/posts\/1340\/revisions"}],"predecessor-version":[{"id":2606,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/posts\/1340\/revisions\/2606"}],"wp:attachment":[{"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/media?parent=1340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/categories?post=1340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/tags?post=1340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}