3

Can anybody help in knowing whether IFC entity type names are case sensitive or case insensitive.

For example: Can we replace IFCPERSON with IfcPerson (camel case) or ifcperson (small) in an *.ifc file?

hlg
  • 1,321
  • 13
  • 29

3 Answers3

1

How about applying the following convention in every single context:

Simply assume that they are case sensitive and work accordingly.

If you always do that, you will never have a problem.

If you see different casing examples, and all of them work, you can assume it is not case sensitive.

Otherwise, you will always be on the safe side if you simply follow the case conventions that you see and are proven.

Furthermore, you should always implement unit tests for every piece of functionality.

If you have questions about case sensitivity, implement unit tests to prove your assumptions right.

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17
  • Do you know what IFC Is ? As per your answer you are just talking about alphabets . because my problem is if case senstive then will it be upper or camel. As both formats works for me during my testing – Tandeep singh Mar 15 '19 at 13:45
  • I do know what IFC is. I was one of the founding members and world-wide international secretary of IFC two or three decades ago :-) According to the STEP file format specification, "Instances of single entity data types are represented by writing the name of the entity in capital letters", cf. the [ISO 10303-21 Wikipedia description ](https://en.wikipedia.org/wiki/ISO_10303-21). – Jeremy Tammik Mar 16 '19 at 17:04
  • However, IFC toolkits are often implemented in a case sensitive language, e.g., C++, and use camel casing of entity names for better readability. So I guess it depends on the context. – Jeremy Tammik Mar 16 '19 at 17:06
0

You might want to take a look at an online version of ISO10303-p21 which defines the STEP data format (file format of .ifc files).

Chapter 5.4 defines the format of tokens, to which entity names belong, to only contain uppercase letters and digits. So basically they are case sensitive, meaning they may only contain uppercase letters.

Loebl
  • 1,381
  • 11
  • 21
  • I AGREE with you Sir, that ISO is case sensitive and IFC uses it during its working , But these are ISO standards they are talking about keywords used in Iso and its format . But building smart had defines its IFC entities , i just wana know are they all upper or Camel Case. – Tandeep singh Mar 15 '19 at 13:51
  • Buildingsmart uses the STEP data format for its .ifc files. So the rules from ISO-10303-p21 apply to those files. In the specification (e.g. http://www.buildingsmart-tech.org/ifc/IFC4/Add2TC1/html/ as well as th EXPRESS schema spec) they are using camel case. Nonetheless if you want to write standards-compliant .ifc files you will have to adhere to the STEP data format. – Loebl Mar 15 '19 at 14:24
  • I would not consider this case sensitivity. In this specific context I would speak of case sensitivity if identifiers for entity types with different cases would denote different types. Technically this is not possible if the case is fixed to upper. Entity type names in EXPRESS are definitely case-insensitive and the upper case restriction for STEP files is just there to avoid confusion. – hlg Mar 18 '19 at 09:46
0

Let's look at how cases are defined in the standards for EXPRESS (used to specify the schema) and for STEP physical files (used for the actual *.ifc files).

Entity type names in the schema definition

According to ISO10303-11, in EXPRESS, entity names are case-insensitive. The grammar only mentions lower-case letters for entity identifiers (section 7.4 Identifiers and 7.1.2 Letters), reserving upper case for EXPRESS reserved words such as ENTITY.

entity_head = ENTITY entity_id subsuper ";" .
entity_id = simple_id .
simple_id = letter { letter | digit | '_' }
letter = 'a' | 'b' | 'c' | ... | 'x' | 'y' | 'z'

So a schema can not define two different entity types that differ only by their case. In addition, the standard explicitly states case insensitivity:

EXPRESS uses the upper and lower case letters of the English alphabet [..] The case of letters is significant only within explicit string literals. NOTE - EXPRESS may be written using upper, lower, or mixed case letters [..].

Thus, the camel case you see in IFC-EXPRESS definitions (e.g. for IFC4) and in the corresponding BuildingSMART documentation is not significant and just chosen for the sake of readability.

Entity type names in the instance encoding

When it comes to the STEP physical file encoding (ISO10303-21) and your actual instance files, the grammar mentions only upper case characters for entity types:

SIMPLE_ENTITY_INSTANCE  = ENTITY_INSTANCE_NAME "=" SIMPLE_RECORD ";" .
SIMPLE_RECORD = KEYWORD "(" [ PARAMETER_LIST ] ")" .
KEYWORD = USER_DEFINED_KEYWORD | STANDARD_KEYWORD .
STANDARD_KEYWORD  = UPPER { UPPER | DIGIT } .
UPPER = "A" | "B" | "C" | .. | "X" | "Y" | "Z" | "_" .

ISO10303-21 specifies further how to map the schema definition to the actual IFC file (section 12.2.). With regard to the encoding of entity type names it states that STEP files should only use upper case characters.

[..] In either case, any small letters shall be converted to their corresponding capital letters, i.e., the encoding shall not contain any small letters.

This also ensures case insensitivity, but in a different way than in EXPRESS.

Case sensitivity in STEP parsers

Coming back to the original question, whether IFCPERSON can be replaced with IfcPerson. If you where to write the standard, you could use any case you like, since entity type names are case insensitive.

ENTITY IfcPerson;

If you are writing an IFC-STEP file, a strict interpretation of the standard would require to write entity type names in upper case.

#1 = IFCPERSON('ID', 'Last', 'First', $, $, $, $, $));

In practice, parsers have to rely on the case-insensitivity of the schema anyway. Thus, they will perform case-insensitive comparison to the schema-defined entity type names. Most likely they will accept mixed- or lower-case entity type names in the *.ifc file.

But a parser could also reject an IFC file with mixed-case entity type names as not standard-conforming or just ignore the entities which are not all-capital. Imagine an implementation that just converts the schema definitions to upper-case and then does a case-sensitive lookup for the entity instance types. This would be perfectly in accordance with the standard.

hlg
  • 1,321
  • 13
  • 29