Research Assistant; Freelancer
Databases can replace the management of many individual files and are also an instrument for mastering complexity.
Two types of databases will be presented
- ifcSQL as a central repository for schema information and models
- ifcSQLite as exchange format
These database concepts show, that the IFC data model is not bounded to a specific file format and can be exchanged in various ways.
Relational databases have standardized access mechanisms that have become established in software development, similar to XML.
A server-based database offers a solid foundation for digital twins with the possiblity of standardized and established queries via SQL.
Utilizing IfcSharp enables the user to store IFC-data on either a SQL-Server or a portable SQLite file. With this, we gain four major benefits in comparison to 'ordinary' STEP files:
- Data-access is possible without parsing
- Integrated referencial integrity
- Typesafe in base-types
- mulituser functionality
Microsoft Visual Studio
SQLite Database Engine
DB Browser for SQLite
Microsoft SQL Server
Establishing digital twins and component libraries by using database technology
Two partnering developers in personal commitment
IfcSQL
Background
The underlaying concept of ifcSQL is shown is this picture:

In words
A IFC-model contains entities with attributes.
An attribute can be of TYPE, SELECT, ENTITY-Ref, ENUM and List (of attributes).
SELECT itself can be TYPE, SELECT or ENTITY-Refs.
In ifcSQL every base-type is mapped to a separate table.
To create the instance-part of the ifcSQL-database, you can use the SQL-script ifcSQL_Instance_create.sql, wich is testet on Microsoft SQL-Server.
SQL-script creates
- schemata (used as namespaces)
- user defined types (for describing meaning of types)
- tables with minimal referential integrity.
- views
- a scalar function for the current project
- a stored procedure preserving globalId-space
The result should look like this for tables

and like this for view:

IfcSQLite
Background
The underlaying concept of ifcSQLite is shown is this picture:

In words
A IFC-Model contains entities with attributes.
An attribute can be of TYPE, SELECT, ENTITY-Ref, ENUM and List (of attributes).
SELECT itself can be TYPE, SELECT or ENTITY-Refs.
In ifcSQLite every entity have its own table an every attribute have its own type.
Types, that are not storable (typesave) in a flat table are stored as a string (at the moment) in the STEP-format.
IfcSharpLibrary
The C#-Library of IfcSharp contains interfaces to the IFC-model of buildingSMART, which is described here:<BR/>
https://technical.buildingsmart.org/standards/ifc/ifc-schema-specifications/
With the IfcSharp Library you can write IFC-models by C#-code or read and write to different formats, like this:
ifc.Repository.CurrentModel.ToStepFile(); // creates hello_project_output.ifc (step-format)
ifc.Repository.CurrentModel.ToHtmlFile(); // creates hello_project_output.html in step-format with syntax highlighting
ifc.Repository.CurrentModel.ToCsFile(); // creates hello_project_output.cs with c# code (useful for creating code from existing files)
ifc.Repository.CurrentModel.ToSqliteFile();// creates hello_project_output.sqlite3 with the default option exportCompleteSchema=false
ifc.Repository.CurrentModel.ToXmlFile(); // creates hello_project_output.ifcXml
ifc.Repository.CurrentModel.ToSqlFile(); // creates SQL for ifcSQL without server-connection
ifc.Repository.CurrentModel.ToSql(ServerName: System.Environment.GetEnvironmentVariable("SqlServer"), DatabaseName:"ifcSQL",ProjectId:3,WriteMode:ifc.Model.eWriteMode.OnlyIfEmpty); // Sql server connection required
One of these Formats is ifcSQL, that ist not intended to transport Models form A to B. It is instead intended to store and query models as a collection of digital twins.
ifcSQL is described in the Repository-Folder 'ifcSQL' in IfcSharpLibrary.
<!-- IfcSharp-documentation, Copyright (c) 2020, Bernhard Simon Bock, Friedrich Eder, MIT License (see https://github.com/IfcSharp/IfcSharpLibrary/tree/master/Licence) --->
IfcSchema
The folder IfcSchema contains the schema-definition of different IFC-releases as C#-classes.
Background
The datamodel of the Industry Foundation Classes (IFC) is defined in various releases as EXPRESS-files here: https://technical.buildingsmart.org/standards/ifc/ifc-schema-specifications/
The underlaying meta-concept is shown is this picture:

In words
A IFC-Model contains entities with attributes.
An attribute are from types of TYPE, SELECT, ENTITY-Ref, ENUM and Lists (of attributes).
SELECT itself can be TYPE, SELECT or ENTITY-Refs.
In IfcSharp the types ENTITY, TYPE, SELECT and ENUM are stored in 4 C#-Files, wich contain the informations of these types.
Example of an ENTITY-class-defintion in IfcSharp
[ifcSql(TypeGroupId:5,TypeId: 472,TableId:3)] public partial class ActorRole:ENTITY{//================================================================================
public ActorRole():base(){}
public ActorRole(RoleEnum Role,Label UserDefinedRole=null,Text Description=null,string EndOfLineComment=null):base(){AddNext();this.Role=Role;this.UserDefinedRole=UserDefinedRole;this.Description=Description;this.EndOfLineComment=EndOfLineComment;}
public ActorRole(RoleEnum Role,string EndOfLineComment=null):base(){AddNext();this.Role=Role;this.EndOfLineComment=EndOfLineComment;}
[ifc(1)] public RoleEnum Role; //ENUM
[ifc(2,optional=true)] public Label UserDefinedRole; //TYPE
[ifc(3,optional=true)] public Text Description; //TYPE
[ifcInverse(For:"RelatedResourceObjects")] public LIST<ExternalReferenceRelationship> HasExternalReference;
}//=====================================================================================================================
In words
The C#-attribute ifcSql contains the class-information from the schema-database of ifcSQL.<br/>
TypeGroupId:5 means, that this class decribes an entity<br/>
TypeId: 472 means, that this is type with id-number 472 from the schema-database of ifcSQL<br/>
TableId:3 means, thats this class has the database-storetype of number 3.<br/>
The C#-attribute ifc contains the attribute-information from the schema-database of ifcSQL.<br/>
(1) means, that this is the first attribute in the STEP-file-order.<br/>
optional=true indicates, that this attribute is optional<br/>
The C#-attribute ifcInverse contains the inverse-information from the schema-database of ifcSQL.<br/>
For:"RelatedResourceObjects" decribe the name of the relating element.
See "Detailed description of the project"
Using open standards (IFC and SQL) for storing and exchanging building components and models.
Moving from a huge amount of files to a single database.
Adding SQL/SQLite to the list of existing exchange formats STEP, XML and JSON is something we would like to see.
Putting all schema-information and relating information (Express, mvdXML, bSDD, etc.) in one single open database.
Similar to the planet-file (Planet.osm) from openstreetmap.