The Fabl Manual
Function Index
Class Index
Globals Index
Libraries
Contents

Title Page
Introduction
Sample Code
Architecture
Syntax
Strong Typing
Polymorphism
Operators
Help
Errors
Configuration
RDF
Namespaces
Owl
Datatypes
Resources
Dot ops
Coercion
Type Casting
nil

Types
string
id
int
double
boolean
Literal
Containers
Functions
void

Home
Regarding
The Path
Classes
Delegation
Functional Values
Read/Write
Load/Store
Libraries
Imports
CGI
Literal

The Fabl datatype Literal implements the class rdfs:Literal. Literal contains all values belonging to datatypes, including ints, ids, strings, and doubles. In the Fabl context, data of type Literal most often arises from parsing RDF in the standard XML or the N-triple syntax. Literal data appearing in RDF often lacks specific typing information, and is therefore assigned the type Literal when brought into the Fabl environment, pending information that would resolve the intended type more exactly. Literals always have a string represesentation, yielded by the operation

Literals can be cast to and from the datatypes int, double, string, and boolean, as explained in the type casting section.

The following function determines whether a Literal can be interpreted as an int.

boolean isInt(Literal lt)

The argument lt may have been introduced as a string, but, as long as the string has the appropriate form for an integer, isInt will return true. For example:

isInt("34"~Literal);
-->true
isInt("a34"~Literal);
-->false
isInt(3~Literal);
-->true

The behavior of the following functions is analogous:

boolean isDouble(Literal lt)

boolean isBoolean(Literal lt)