Fabl (pronounced "fable") is a native programming language for the Semantic Web. The Fabl object model is the RDF property graph, and the Fabl type system implements a subset of the OWL web ontology language (RDF is the W3C standard data representation for the current generation of Semantic Web technology, while OWL is a W3C standard for describing classes of RDF objects). However, this manual does not assume prior familiarity with RDF, OWL, or other Semantic Web technologies. Learning Fabl is one way of learning about the Semantic Web.
Fabl programs themselves are represented as Semantic Web objects. This representation of computation within the Semantic Web allows active content to be integrated seamlessly into RDF repositories, and provides a programming environment which simplifies the manipulation of RDF when compared to use of a conventional language via an API.
Fabl programs may be expressed as RDF objects using standard RDF syntax, or via a conventional syntax which might be described as Javascript (or its standardized variant ECMAScript) enhanced with types and qualified property names. The language is designed to be easy to learn for programmers familiar with the conventional JavaScript/HTML/XML/DOM webprogramming model. In fact, this alternative syntax allows programmers to create and manipulate RDF objects without needing to learn the XML-based RDF syntax - a syntax that can be difficult to master.
Installing and starting Fabl
Fabl is distributed for Linux as a compressed tarball, named fabl-2.0.11.tar.gz. To install, uncompress and untar this into any directory (eg /usr/local or /usr/local/src), then follow the instructions at http://fabl.net/2.0.11/install.html.
For Windows platforms, Fabl can be installed under the cygwin Linux-compatability environment.
Fabl runs either in interactive mode, or as a CGI handler. To run Fabl in interactive mode, start a command shell, set your current directory <fablRoot>/bin, where <fablRoot> is the root of the installation, and then type "./fabl". For example:
cd /usr/local/fabl-2.0.11/bin ./fablThis manual includes a series of examples which the reader may type or paste into the command shell. Here's the first one:
2 + 3; ->5
In the above, "2+3;" is user input, and "->5" represents the response. The command shell does not print out the arrow ("->"); we include the arrow in our examples to indicate lines where response by the Fabl interpreter appears.
As the user interacts with the Fabl interpreter, its state changes. For example,
var a = 23; a++; ->24
Adds a new variable, then increments it. The Fabl state is an RDF graph.
We will introduce Fabl syntax and the Fabl programming environment with examples involving primitive types (such as strings and numbers). RDF does not enter the picture until objects are introduced.
Adenine
Adenine, developed as part of the Haystack project, is a language that shares Fabl's basic goals and structure: it too has RDF resources as its native objects, and represents programs within RDF. The following are some of the significant differences: (1) Fabl's syntax is conventional in style (a minor modification of Javascript), while Adenine's is more unusual (eg Adenine syntax for adding one and two is "+ 1 2" rather than "1+2") (2) Fabl is written in C (and itself), while Adenine lives in the Java environment, (3) Fabl is strongly typed (with OWL as its type system), while Adenine includes only runtime typing.