Constants are atomic ground terms and they represent the value of a data type.
In general, constants can be written in the following way:
"charseq"^^datatype
The charseq supports escaping for Unicode and some other special characters.
String
The string data type is used for character sequences.
Data type: http://www.w3.org/2001/XMLSchema#string
Shortcut: _string
Syntax alternatives:
· double-quoted strings:
"charseq"
· triple double-quoted strings:
"""charseq"""
· string representation with data type:
"charseq"^^_string
Double quoted strings without a data type (i.e. ^^datatype) are automatically interpreted as constants of the XML schema data type http://www.w3.org/2001/XMLSchema#string.
ObjectLogic supports the Java-like escape sequences starting with the character '\' for Unicode characters and some special characters.
Characters in the range ASCII 0x00 to 0x1f are not allowed as characters in quoted string but can be entered as escape sequence.
New lines are directly allowed in double quoted strings.
Escape sequences
\u1a3b |
UTF-16 character (here code point 1A3B) A Unicode escape sequence consists of 1. a backslash character '\' 2. a 'u' 3. four hexadecimal digits |
\\ |
backslash character \ (ASCII 0x5c) |
\" |
double quote character " (ASCII 0x22) |
\' |
single quote character ' (ASCII 0x27) |
\n |
line feed character (ASCII 0x10) |
\r |
carriage return character (ASCII 0x13) |
\t |
horizontal tab character (ASCII 0x09) |
\f |
form feed character (ASCII 0x0c) |
Examples:
"foo" º "foo"^^_string
º "foo"^^<http://www.w3.org/2001/XMLSchema#string>
"""multi-line
second line
third""" º "multi-line\nsecond line\nthird"
"M\u00fcller" º "Müller"^^_string
IRI
Data type: http://www.w3.org/2007/rif#iri
Shortcut: _iri
Syntax alternatives:
· full qualified IRI reference
'<' IRI '>'
· local part identifier (implicitly carries default namespace)
identifier
· single quoted local part (implicitly carries default namespace)
'\'' charseq '\''
· prefix plus local part
(identifier | '\'' charseq '\'') '#'
(identifier | '\'' charseq '\'')
· IRI in ObjectLogic reserved namespace
· '_'(identifier | '\'' charseq '\'')
· IRI in ObjectLogic internal namespace
'$' (identifier | '\'' charseq '\'')
· string representation with data type
"charseq"^^_iri
The following examples assume that these namespace prefixes are defined
:- default prefix = "http://foo#".
:- prefix a = "urn:ietf:rfc:".
:- prefix 'i!' = "urn:isbn:".
Examples:
<http://www.acme.com/project1#ontology1>
º "http://www.acme.com/project1#ontology1"_iri
Müller º <http://foo#Müller>
'Jörg Müller' º <http://foo#Jörg%20Müller>
a#'2648' º <urn:ietf:rfc:2648>
a#2648 (invalid syntax)
'i!'#'0451450523' º <urn:isbn:0451450523>
_bar º <obl:reserved:bar>
$bar º <obl:intern:bar>
Double
Data type: http://www.w3.org/2001/XMLSchema#double
Shortcut: _double
Syntax alternatives:
· number containing decimal point
['+'|'-']? digit+ '.' digit+ Exponent? FloatSuffix?
['+'|'-']? '.' digit+ Exponent? FloatSuffix?
Exponent := ['E'|'e'] ('+'|'-')? Digit+
FloatSuffix := ['d'|'D'|'f'|'F']
· number containing exponent
['+'|'-']? digit+ Exponent FloatSuffix?
· number with float type suffix
['+'|'-']? digit+ FloatSuffix
· string representation with data type
"charseq"^^_double
All numbers containing a decimal point, or an exponent or a float type suffix are constants of the _double data type
Examples:
1.2 º "1.2"^^_double
º "1.2"^^<http://www.w3.org/2001/XMLSchema#double>
.12 º "0.12"^^_double
-0.12 º "-0.12"^^_double
12e-34 º "1.2e-33"^^_double
13d º 13.0 º "13.0"^^_double
Int
Data type: http://www.w3.org/2001/XMLSchema#int
Shortcut: _int
Syntax alternatives:
· numbers between -231 and 231-1 without decimal point
digit+
· string representation with data type
"charseq"^^_int
All constants of type _int are the same term if it was defined with the same value but with either data type _int, _long, _integer or _decimal.
Examples:
1234567 º "1234567"^^_int
º "1234567"^^<http://www.w3.org/2001/XMLSchema#int>
-98765 º "-98765"^^_int
Long
Data type: http://www.w3.org/2001/XMLSchema#long
Shortcut: _long
Syntax alternatives:
· numbers between -263 and 263-1 without decimal point
digit+
· string representation with data type
"charseq"^^_long
All constants of type _long are the same term if it was defined with the same value but with either data type _long, _integer or _decimal. If the value is between -231 and 231-1, it is also the same as the constant with the same value and data type _int.
Examples:
123456789012345 º "123456789012345"^^_long
º "123456789012345"^^<http://www.w3.org/2001/XMLSchema#long>
-123456789012345 º "-123456789012345"^^_long
1234567 º "1234567"^^_long º "1234567"^^_int
Integer
Data type: http://www.w3.org/2001/XMLSchema#integer
Shortcut: _integer
Syntax alternatives:
· integer numbers less than -263 or greater than 263-1 without decimal point
digit+
· string representation with data type
"charseq"^^_integer
Examples:
123456789012345678901234567890
º "123456789012345678901234567890"^^_integer
º "123456789012345678901234567890"^^<http://www.w3.org/2001/XMLSchema#integer>
Decimal
Data type: http://www.w3.org/2001/XMLSchema#decimal
Shortcut: _decimal
Syntax alternatives:
· string representation with data type
"charseq"^^_decimal
If the decimal value is an integer, the term is the same as if it was defined with an integer data type. Constants of data type double and of data type decimal do not unify.
Examples:
"12.3456"^^_decimal º "12.3456"^^<http://www.w3.org/2001/XMLSchema#decimal>
12.3456 º "12.3456"^^_double
"123"^^_decimal
º "123"^^_integer
º "123"^^_long
º "123"^^_int
º 123
Date
The date data type is used to specify a date.
Data type: http://www.w3.org/2001/XMLSchema#date
Shortcuts: _date, _d
Syntax alternatives:
· lexical representation according the XMLSchema data type
"YYYY-MM-DD"^^_date
"YYYY-MM-DDZ"^^_date
"YYYY-MM-DDShh:mm"^^_date
"YYYY-MM-DD"^^_d
"YYYY-MM-DDZ"^^_d
"YYYY-MM-DDShh:mm"^^_d
| • | YYYY indicates the year |
| • | MM indicates the month (1-12) |
| • | DD indicates the day (1-31) |
To specify a date in UTC time is marked with the suffix 'Z'
| • | Z character 'Z' indicates that this date is in UTC time |
Alternatively, to specify the timezone you can add an offset from the UTC time by adding a positive or negative time behind the date
| • | S +/- sign of the time zone offset relative to UTC |
| • | hh hours of time zone offset |
| • | mm minutes of time zone offset (0-59) |
Examples:
"2009-03-31"^^_date
"1999-12-24Z"^^_date
"2009-03-31-06:00"^^_date
Time
The time data type is used to specify a time.
Data type: http://www.w3.org/2001/XMLSchema#time
Shortcuts: _time, _t
Syntax alternatives:
· lexical representation according the XMLSchema data type
"hh:mm:ss.f"^^_time
"hh:mm:ss.fZ"^^_time
"hh:mm:ss.fShh:mm"^^_time
"hh:mm:ss.f"^^_t
"hh:mm:ss.fZ"^^_t
"hh:mm:ss.fShh:mm"^^_t
| • | hh indicates the hour (0-23) |
| • | mm indicates the minute (0-59) |
| • | ss indicates the second (0-59) |
| • | f optional part to indicate the fractions of a second |
To specify a date in UTC time is marked with the suffix 'Z'
| • | Z character 'Z' indicates that this date is in UTC time |
Alternatively, to specify the timezone you can add an offset from the UTC time by adding a positive or negative time behind the date
| • | S +/- sign of the time zone offset relative to UTC |
| • | hh hours of time zone offset |
| • | mm minutes of time zone offset (0-59) |
Examples:
"13:57:00"^^_time
"13:57:01.124"^^_time
"23:15:00Z"^^_time
"00:00:00.001+09:00"^^_time
DateTime
The dateTime data type is used to specify a date and a time.
Data type: http://www.w3.org/2001/XMLSchema#dateTime
Shortcuts: _datetime, _dt
Syntax alternatives:
· lexical representation according the XMLSchema data type
"YYYY-MM-DDThh:mm:ss.f"^^_dateTime
"YYYY-MM-DDThh:mm:ss.fZ"^^_dateTime
"YYYY-MM-DDThh:mm:ss.fShh:mm"^^_dateTime
"YYYY-MM-DDThh:mm:ss.f"^^_dt
"YYYY-MM-DDThh:mm:ss.fZ"^^_dt
"YYYY-MM-DDThh:mm:ss.fShh:mm"^^_dt
| • | YYYY indicates the year |
| • | MM indicates the month (1-12) |
| • | DD indicates the day (1-31) |
| • | T the character 'T' indicates the start of the required time section |
| • | hh indicates the hour (0-23) |
| • | mm indicates the minute (0-59) |
| • | ss indicates the second (0-59) |
| • | f optional part to indicate the fractions of a second |
To specify a date in UTC time is marked with the suffix 'Z'
| • | Z character 'Z' indicates that this date is in UTC time |
Alternatively, to specify the timezone you can add an offset from the UTC time by adding a positive or negative time behind the date
| • | S +/- sign of the time zone offset relative to UTC |
| • | hh hours of time zone offset |
| • | mm minutes of time zone offset (0-59) |
Examples:
"2009-03-31T13:57:00"^^_dateTime
"2009-03-31T13:57:01.124"^^_dt
"2009-03-31T23:15:00Z"^^_dt
"2000-01-01T00:00:00.001+09:00"^^_dt
Duration
The duration data type is used to specify a time interval.
Data type: http://www.w3.org/2001/XMLSchema#duration
Shortcuts: _duration
Syntax alternatives:
· lexical representation according the XMLSchema data type
"sPnYnMnDTnHnMn.fS "^^_duration
| • | s +/- sign of time interval (optional) |
| • | P the character 'P' indicates the period (required) |
| • | nY indicates the number of years (optional) |
| • | nM indicates the number of months (optional) |
| • | nD indicates the number of days (optional) |
| • | nH indicates the number of hours (optional) |
| • | nM indicates the number of minutes (optional) |
| • | n.fS indicates the number of seconds (optional) with optional fractions of seconds |
Examples:
"-P1Y"^^_duration
"PT1004199059S"^^_duration
"P1DT2S"^^_duration
"P1Y2M3DT5H20M30.123S"^^_duration
The following values are invalid: 1Y (leading P is missing), P1S (T separator is missing), P-1Y (all parts must be positive), P1M2Y (parts order is significant and Y must precede M), or P1Y-1M (all parts must be positive).
Boolean
The boolean data type is used to specify a true or false value
Data type: http://www.w3.org/2001/XMLSchema#boolean
Shortcuts: _boolean
Syntax alternatives:
· lexical representation according the XMLSchema data type
"true"^^_boolean
"false"^^_boolean
· Objectlogic keywords
true
false
Examples:
true º "true"^^_boolean
false º "false"^^_boolean
Plain Literal
The rdf:PlainLiteral data type is used to specify a text strings with an attached language tag.
Data type: http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral
Shortcuts: _PlainLiteral, _text
Syntax alternatives:
· lexical representation according RIF-DTB syntax
"str@lang"^^_PlainLiteral
| • | "abc"{de} == "abc@de"^^_PlainLiteral |
| • | str character sequence (escaping conventions are same as for _string) |
| • | @ the character '@' separates value and language tag |
| • | lang language tag (can be empty) |
Examples:
"Wein@de"^^_PlainLiteral
"vine@en"^^_PlainLiteral
"vin@fr"^^_PlainLiteral
"UNO@"^^_PlainLiteral
See also: http://www.w3.org/2005/rules/wiki/DTB#ref-rdf-PlainLiteral
XMLLiteral
The XMLLitereal data type is used to specify well-formed fragment of XML text.
Data type: http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral
Shortcuts: _XMLLiteral
Syntax alternatives:
· XML text with data type
"xmltext"^^_XMLLiteral
Examples:
"<foo>bar</foo> "^^_XMLLiteral
"<order id=\"12345\"/>"^^_XMLLiteral