Biml
Designed byScott Currie[1]
DeveloperVarigence[1]
First appeared2008[1]
Stable release
3.0 / November 1, 2012 (2012-11-01)
OSMicrosoft Windows
Filename extensions.biml
Websitewww.bimlscript.com
Major implementations
Mist IDE, BIDS Helper[2]

Business Intelligence Markup Language (BIML) is a domain-specific XML dialect for defining business intelligence (BI) assets. Biml authored BI assets can currently be used by the BIDS Helper add-on for Microsoft SQL Server Business Intelligence Development Studio (BIDS) and the Varigence Mist (now called BimlStudio) integrated development environment; both tools translate Biml metadata into SQL Server Integration Services (SSIS) and SQL Server Analysis Services (SSAS) assets for the Microsoft SQL Server platform. However, emitters can be created to compile Biml for any desired BI platform.

While Biml’s declarative design is sufficient to author BI assets, BimlScript extends the language by enabling authors to embed C# or VB.NET code within Biml, similar to how ASP.NET includes .NET code within static HTML markup.[3] BimlScript is used to merge changes into existing Biml assets, automatically generate Biml code, and apply changes across multiple Biml files during compilation.

History

Biml

Biml is an XML dialect that specifies all aspects of a BI solution, including relational models, data transformation packages, multi-dimensional models, and tabular models.

Unlike other BI solutions, Biml has a "write once, target any platform" philosophy. This enables Biml users to switch their target platform without needing to change their code. Currently, Biml targets SQL Server versions 2005, 2008, 2008 R2, 2012 and 2014, emitting SSIS packages and SSAS cubes.

Because Biml is XML, it can leverage the vast ecosystem of tools for XML based languages. This also makes it human-readable/writable, so it is easier to edit by hand than the SSIS/SSAS files it generates.

In late 2009, Biml was extended with BimlScript. BimlScript allows C# or VB.NET code nuggets to be embedded directly within Biml. BimlScript's goal is to automate repetitive work in reusable scripts. Additionally, it has been used to automate package generation and build reusable patterns for BI tasks. BimlScript is also used to take metadata from various sources (relational database structure, relational data, flat files, annotations, etc...) and automatically generate Biml code from it.

Mist

Mist is an IDE for authoring Biml code and building BI assets. Mist leverages visual design capabilities and debugging features to simultaneously edit entire business intelligence models, including relational tables, SSIS packages, and cubes.[1] Mist also incorporates modern programming IDE features, including text editors with syntax highlighting, Intelliprompt and quick-info displays, source control integration, and multi-monitor support.

BIDS Helper

As Biml’s popularity has grown, key portions of the Biml engine, including dynamic package generation, have been contributed to the BIDS Helper open source project hosted on CodePlex.[2][4]

BimlScript community

BimlScript.com is a community website for developing and sharing Biml solutions to BI problems, and contributing Biml content to share with others. Along with tutorials, walkthroughs, and videos, the site provides an online Biml editor.[5]

Code generation

Biml files are compiled to produce BI assets for a chosen platform. Currently, it is possible to generate assets for Microsoft’s SSIS, SSAS, and SQL Server platforms, for the 2005, 2008 (R2), 2012 and 2014 releases. Other platforms may be targeted in the future.

Syntax

Biml has a syntax that’s common to all XML languages. Tags begin and end with < and >, respectively. Furthermore, tags can have attributes and nested elements.

Biml

Declaration

Biml documents begin with a common declaration

<Biml xmlns="http://schemas.varigence.com/biml.xsd">

Root types

Biml has a well-defined set of root types, indicating the various kinds of BI assets that can be created:

  • Connections
  • Databases
  • Schemas
  • Tables
  • Dimensions
  • Facts
  • Packages
  • File Formats
  • Script Projects
  • Cubes
  • Principals

Example

This is an example of the AdventureWorks DimCurrency table, authored in Biml:

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
  <Dimensions>
    <Dimension Name="DimCurrency" SchemaName="Target.dbo" AttributeAllMemberName="All Source Currencies" DimensionType="Currency" FriendlyName="Currency">
      <Columns>
        <Column Name="CurrencyKey" />
        <Column Name="CurrencyAlternateKey" DataType="StringFixedLength" Length="3" />
        <Column Name="CurrencyName" DataType="String" Length="50" />
      </Columns>
      <Keys>
        <Identity Name="IK_DimCurrency">
          <Columns>
            <Column ColumnName="CurrencyKey" />
          </Columns>
        </Identity>
        <UniqueKey Name="AK_DimCurrency_CurrencyAlternateKey">
          <Columns>
            <Column ColumnName="CurrencyAlternateKey" />
          </Columns>
        </UniqueKey>
      </Keys>
      <Indexes></Indexes>
      <Attributes>
        <Attribute Name="Source Currency" EstimatedCount="101" OrderBy="Name" AttributeType="CurrencySource" GroupingBehavior="DiscourageGrouping">
          <InstanceSelection>DropDown</InstanceSelection>
          <KeyColumns>
            <KeyColumn ColumnName="CurrencyName" NullProcessing="Error" />
          </KeyColumns>
        </Attribute>
        <Attribute Name="Source Currency Code" EstimatedCount="105" OrderBy="Name" AttributeType="CurrencyIsoCode" Usage="Key" GroupingBehavior="DiscourageGrouping">
          <InstanceSelection>DropDown</InstanceSelection>
          <KeyColumns>
            <KeyColumn ColumnName="CurrencyKey" NullProcessing="Error" />
          </KeyColumns>
          <NameColumn ColumnName="CurrencyAlternateKey" />
        </Attribute>
      </Attributes>
      <Relationships>
        <Relationship Name="Source Currency" ParentAttributeName="Source Currency Code" ChildAttributeName="Source Currency" Type="Rigid" />
      </Relationships>
    </Dimension>
  </Dimensions>
</Biml>

BimlScript

All BimlScript tags begin and end with <# and #> delimiters, respectively. Special types of BimlScript tags use augmented versions of these delimiters, to indicate specific usages.

Directives

A Biml file, with BimlScript, begins with at least one directive. Directives provide instructions to the Biml engine, regarding how to process the BimlScript and generate its Biml. Directives are single tags that begin with <#@. Each directive begins with a single term, followed by attributes that supply required values.

The two most common directives are template and import.

Template

This directive indicates that the file's BimlScript uses the C# programming language.

<#@ template language="C#" #>
Import

This directive specifies .NET namespaces that should be imported for the file. It is functionally equivalent to the C# using statement or VB.NET Imports statement.

<#@ import namespace="Varigence.Languages.Biml.Connection" #>

Delimiters

When authoring BimlScript, additional delimiters may be used. These delimiters match the behavior of T4 template delimiters.

DelimiterDescription
<#Defines statements, in .NET code, that provide control flow in a Biml file.
<#=Evaluates .NET code, converts it to a string, and then embeds it in the Biml file.
<#+Defines properties, methods, and files that are excluded from the Biml file but may be accessed by other BimlScript code nuggets.

Example

This BimlScript example imports a database's assets via a connection, declared in a separate file, named "AdventureWorksLT". Each schema and table from the imported database is then embedded directly within the Schemas and Tables collections, respectively.

 
<#@ template language="C#" hostspecific="True" tier="2" #>
<#@ import namespace="Varigence.Languages.Biml.Connection" #>
<#@ import namespace="Varigence.Hadron.Extensions" #>
<#@ import namespace="Varigence.Hadron.Extensions.SchemaManagement" #>
<#@ import namespace="Varigence.Hadron.CoreLowerer.SchemaManagement" #>

<#+ public ImportResults Results
{ 
    get 
    { 
        return ((AstOleDbConnectionNode)RootNode.Connections["AdventureWorksLT"]).ImportDB();
    }
}
#>

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
    <Databases>
        <Database Name="MyDatabase" ConnectionName="AdventureWorksLT" />
    </Databases>
    <Schemas>
        <#=Results.SchemaNodes.GetBiml()#>
    </Schemas>
    <Tables> 
        <#=Results.TableNodes.GetBiml()#>
    </Tables>
</Biml>

This example shows how developers can use Biml and BimlScript to:

  1. Import schemas and tables directly from a database, and use them without needing to manually copy their structure.
  2. Have any changes to the assets be automatically reflected the next time this code is run.
  3. Import the assets and convert them to Biml using only two simple lines of code.

References

  1. 1 2 3 4 Leonard, Andy; Masson, Matt; Mitchell, Tim; Moss, Jessica; Ufford, Michelle (2012). "Chapter 17: Business Intelligence Markup Language". SQL Server 2012 Integration Services Design Patterns. APress. p. 456. ISBN 978-1430237716.
  2. 1 2 Tok, Wee-Hyong; Parida, Rakesh; Masson, Matt; Ding, Xiaoning; Sivashanmugam, Kaarthik (2012). Microsoft SQL Server 2012 Integration Services. O'Reilly Media, Inc. p. 511. ISBN 978-0735665859.
  3. Chenn, Ronen (May 16, 2011). "BIDS helper new features ( April 2011 )". Business Intelligence, Technology, Thoughts, Thinking. Retrieved October 1, 2012.
  4. Welch, John (June 7, 2011). "Biml Package Generator". BIDS Helper. Retrieved September 30, 2011.
  5. "Welcome to BimlScript.com". BimlScript.com. Retrieved October 4, 2012.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.