🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Case sensitive or not
This page was created by Hans.karlsen on 2020-06-23. Last edited by Wikiadmin on 2026-07-29.

You can use this page to determine whether names, strings, tagged values, and Boolean values are case-sensitive when you work in MDriven Designer, OCL, and an MDrivenServer persistence database.

Quick reference

Where you are working Case-sensitivity rule What to do
Tagged-value content A tagged value is a String. Its interpretation is defined by the feature that reads it. Treat the value as feature-specific. Boolean-tagged values should accept casing differences.
OCL identifiers and operators Largely case-insensitive. Use the documented identifier or operator spelling for readability.
OCL type names A type name must begin with a capital letter. Write type references with an initial capital, for example Person.
String data in OCL String data is case-sensitive by default. Use an explicit case-insensitive comparison or normalize case before comparing.
Persistence-search behavior Database collation can make a database comparison case-sensitive or case-insensitive. Do not rely on the database default when the required behavior is case-insensitive; use sqlLikeCaseInsensitive for string searches.
Boolean default database values MDrivenServer persistence stores Boolean values as a database bit. Set DefaultDbValue to 1 for true or 0 for false.

Tagged values

A tagged value is stored as a String. The code or feature that consumes the tag decides how that String is interpreted, so case handling is evaluated per tag rather than by one global tagged-value rule.

MDriven aims for Boolean-tagged values to be case-insensitive. For example, a Boolean tag intended to mean true should accept different casing of that Boolean value. If you find a Boolean tag for which casing changes the result, report it so the behavior can be corrected.

Do not assume that a non-Boolean tag has the same behavior. For example, a tag whose value is used as a name, key, or other text value may need exact casing because it is interpreted as String data.

OCL names, types, and String values

OCL is largely case-insensitive for identifiers and operators. Type names are the exception: a type must start with a capital letter.

For example, use an initial capital when referring to a model type:

Person.allInstances

The fact that OCL identifiers and operators are largely case-insensitive does not make your data case-insensitive. A String value keeps its casing, and ordinary String comparisons are case-sensitive.

'North' = 'north'

This evaluates as false because the String values differ in case.

Compare two String values without case sensitivity

When you need to compare two complete String values while ignoring case, use compare with its case-insensitive argument and test for zero:

vName.compare('north', true) = 0

The expression is true when vName has the same text as north regardless of casing. See Documentation:Comparing strings for this comparison pattern and Documentation:String for String behavior and operations.

Normalize case when needed

OCL provides toupper and tolower to convert String case. Use conversion when you need a normalized value as part of a larger expression. For equality of two Strings, the compare pattern above makes the intent explicit.

Collection membership remains case-sensitive

The includes operator returns whether an object is contained in a collection. When the value being tested is text, its matching is case-sensitive. Do not use includes when your requirement is a case-insensitive text match.

Search Strings in persistence

Use sqlLike and sqlLikeCaseInsensitive for String matching in persistence searches. The two operators differ in how reliably they handle casing.

Requirement Operator Important behavior
Match text according to the database comparison behavior sqlLike Case behavior can depend on the database server and its collation settings.
Match text or part of text while ignoring case sqlLikeCaseInsensitive Use this when the search must be case-insensitive.

For example, search for people whose names contain the value entered in vSeekParam, regardless of case:

Person.allinstances->select(a|a.Name.sqlLikeCaseInsensitive('%'+vSeekParam+'%'))

The percent characters are SQL-like wildcards, so this example finds a name containing the search text rather than requiring the whole name to match.

sqlLike may ignore case in a persistence search, but that result depends on the database server and its settings. For example, the Turnkey built-in SQL Server Compact database does not ignore case for this operator. Use sqlLikeCaseInsensitive when users expect case-insensitive searching.

Database collation

When you create a SQL Server instance, you choose its collation. A collation controls, among other things, whether database text comparisons distinguish letter case.

  • A SQL Server collation whose name contains _CI_ is case-insensitive.
  • Other collations are case-sensitive.

This setting affects database-side behavior, including behavior you may observe with sqlLike. It does not change the OCL rule that String data is case-sensitive by default. Define the required behavior in each expression instead of depending on a particular deployment collation.

Boolean database defaults in MDrivenServer

In the persistence mapping used by MDrivenServer, a Boolean is stored as a database bit:

Boolean value Database bit value
true 1
false 0

If you set DefaultDbValue for a Boolean attribute, enter 1 for true or 0 for false. Do not enter a textual Boolean value such as true or false as the database default.

Checklist

  1. If you are reading a tagged value, check how the specific feature interprets its String value.
  2. If you are writing an OCL type name, start it with a capital letter.
  3. If you compare String values, expect case-sensitive behavior unless you explicitly choose otherwise.
  4. If you need case-insensitive equality, use compare(otherString, true) = 0.
  5. If you need case-insensitive persistence searching, use sqlLikeCaseInsensitive.
  6. If you configure a Boolean DefaultDbValue for MDrivenServer persistence, use 1 or 0.

See also