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)