Declarative Objectivity (DO) Language : Expressions : Literal Expressions
Literal Expressions
Literal expressions are specified values that remain constant throughout the execution of a DO statement.
Syntax 
 
 
Logical Type
Description
Example Syntax
Boolean
A Boolean literal has the value true or false.
true
false
True
False
TRUE
FALSE
Numeric
Numeric literals include integer values, decimal values, and hexadecimal values. You format them as you would in programming languages like C++ and Java.
123
-77
-98.765
88.3e-9
0xFF
String
A string literal is a single-quoted or double-quoted sequence of characters.
 
See String Tokens for details.
'555-1212'
"John Doe"
Character
A character literal is a string literal consisting of a single character.
'x'
"5"
Date
A date literal is a representation of year, month, and day, in that order.
 
See Date-Time Tokens for details.
2017-03-17
2017/03/17
Time
A time literal is a representation of hours, minutes, seconds, and optionally milliseconds, in that order.
 
See Date-Time Tokens for details.
13:10:50
13:10:50.45
DateTime
A datetime literal is a representation of year, month, day, hours, minutes, seconds, and optionally milliseconds, in that order.
 
Add Z for a datetime in the Coordinated Universal TIme standard (UTC) standard.
 
Add an offset to indicate a time zone that is a number of hours and minutes from UTC.
 
See Date-Time Tokens for details.
2017-03-17 13:10:50
2017-03-17 13:10:50.45
 
2017-03-17 13:10:50Z
2017-03-17 13:10:50.45Z
 
2017-03-17 13:10:50 +07:15
2017-03-17 13:10:50 -01:00
 
Interval
An interval literal is a structure whose components specify a duration of elapsed time.
 
See Interval Structures for details.
INTERVAL{days:10, hours:5, minutes:30, seconds:30, milliseconds:30}
Reference
A reference literal or OID literal is an object identifier (OID) for a particular object.
3-472-9-11
0-0-0-0
Object
An object literal is a structure for specifying the class and attribute values of an object.
 
See Object Structures for details.
Address{street:'350 Banyon Drive', city:'San Jose', state:'CA', zipcode:'95126'}
Collection
A collection literal is a structure whose components specify the element values for a particular type of collection.
 
See Collection Structures for details.
LIST{1,4,75}
LIST{4,1,75}
LIST{'Bob', 'Mary', 'Jane')
SET{3-3-1-9, 3-3-1-12)
MAP{'009':3-3-1-5, 'bmartin':3-3-1-26}
Class
A class literal specifies a schema class. A class literal includes the class name, which can be preceded by its namespace qualification.
:Vehicle
:FleetData.Vehicle
:FleetData::Vehicle
Quick Look 
Return all customers with more than 1000 reward points:
FROM Customer WHERE rewardPoints > 1000 RETURN *;
Update the vehicle with a particular license by setting its availability to false:
UPDATE Vehicle WHERE license == 'ABC1997' SET available TO false;
Add two dates to a rental company’s list of high-volume dates:
UPDATE RentalCompany ADD {2017-01-31, 2017-07-05} TO highVolumeDates;
Remove a particular vehicle from the rental company’s fleet of vehicles.
UPDATE RentalCompany REMOVE 3-3-1-38 FROM vehicles;
Discussion 
You can specify literal expressions to specify constant values of Boolean, numeric, string, date, time, datetime, reference, and class types. You use structure expressions to represent complex values; see Object Structures, Collection Structures, and Interval Structures.
Literal expressions are commonly used as operands in operator expressions. For example, in the following statement, the numeric literal 1000 is an operand of an operator that compares that value to the result of an attribute expression that also evaluates to a numeric value:
FROM Customer WHERE rewardPoints > 1000 RETURN *;
The following statement accomplishes the same thing, but uses the numeric literals 1000 and 0 as operands:
FROM Customer WHERE rewardPoints - 1000 > 0 RETURN *;
Literal expressions may be used as arguments of certain DO clauses. For example, in the following statement, the reference literal (OID) 3-3-1-38 is the argument in a REMOVE Clause, where it specifies the element value to be removed from a collection of references to Vehicle objects:
UPDATE RentalCompany REMOVE 3-3-1-38 FROM vehicles;