Sphinx a user-friendly assertion language David North Senior Developer, CoreFiling Eurofiling Workshop, Luxembourg, December 2013 What is Sphinx? • Domain-specific language for making assertions about XBRL facts • High-level, semantic, based on an ndimensional world • Not XML • Designed for humans to write and edit directly • Proprietary History • 2009 – first prototypes • 2011 – stable language reaches 1.0 • 2012 – version 2.0 incorporating real-world feedback requiring breaking changes • 2013 – (later abandoned) attempt to offer the Sphinx IP to XBRL International The requirements Sphinx grew from • XBRL US (XUSI) – development of the XBRL US Consistency Checks for quality/consistency of SEC filings • CIMA – regulator needing to check quality/consistency of incoming instances • Replaced a stopgap spreadsheet-based solution Who uses it? • XUSI • CIMA • HMRC Proprietary: Disadvantages • Not an XII standard • Fewer options for implementations • Difficult for a regulator to mandate its usage by filers • Can't be part of DTS Proprietary: Advantages • High quality tools available from CoreFiling • Fast evolution of the language in response to customer feedback What can it be used for? • Rapid creation of business and accounting rules • Typical checks might include: – X must be reported – Co-constraints (if X is reported, Y must be too) – Comparing data across dimensions The language • Based on item expressions • The most basic: [ ] • Represents the table of all items in the instance. Operations on it apply to every cell in turn • Restrict by axes (“aspects” in XBRL formula) – FooConcept[ ] – restriction to facts with FooConcept – [Geography=UK, Product=Cheese] – restricts Lining up How is the following expression evaluated? Revenue[ ] = SalesRevenue[ ] + RentRevenue[ ] Examples Please refer to accompanying file “Sphinx Examples.txt” Tools • Rules authored in SpiderMonkey, potentially alongside taxonomy development – Can test against instances here • Can plug authored “rulebase” into other CoreFiling tools both for GUI-based instance validation and command-line/web based validation (e.g. filter gateway). Sphinx vs XBRL formula • Sphinx does lining up (implicit filtering) by default • Sphinx cannot do fact creation • Sphinx cannot use XPath • User-defined Sphinx functions are inlanguage only (no ability to make them implementation-defined) Questions?