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
Namespaces

A namespace is a URI that serves as the root of a "space" of names which are appended to this URI. Namespaces are usually assigned short names that serve as abreviations. For example, the following abreviation is customary:

rdf is the name of the namespace
http://www.w3.org/1999/02/22-rdf-syntax-ns#

A qualified name has the form <prefix>:<localPart>, where the prefix is the name of a namespace. A qualified name has the same meaning as the result of appending the namespace denoted by the prefix to the localPart. For example,

rdf:type has the same meaning as
http://www.w3.org/1999/02/22-rdf-syntax-ns#type

Namespaces are often used to provide unambiguous names for a collection of related concepts. For example, the rdf namespace contains names for the basic rdf concepts, such as Property and type. The names within a particular namespace are often referred to as a vocabulary (the loftier term "ontology" is sometimes used instead).

In Fabl, the function

void namespace(id prefix,string uri)

adds the given namespace to the current Fabl state under the given name. An id is a text string whose contents cannot be modified. Ids are given single quotes as in:

'abc'

while strings use double quotes:

"abc"

See the sections on strings and ids for details.

Once such a namespace has been introduced, qualified names such as rdf:type take on the meaning explained just above. Qualified names are legal Fabl symbols. For example

rdf:type;
-->rdf:type

(This is not an interesting example, but others will follow shortly.)

The following function is run at Fabl startup, thereby installing an initial set of namespaces.
void function stdNamespaces()
{
namespace('rdf',"http://www.w3.org/1999/02/22-rdf-syntax-ns#");
namespace('rdfs',"http://www.w3.org/2000/01/rdf-schema#");
namespace('xsd',"http://www.w3.org/2000/10/XMLSchema#");
namespace('owl',"http://www.w3.org/2002/07/owl#");
// Fabl properties and classes
namespace('fabl',"http://nurl.org/0/fabl/"); 
// Fabl functions and constants (the Fabl IMPlementation)
namespace('fimp',"http://nurl.org/0/fimp/");
namespace('discovery0',"http://fabl.net/vocabularies/discovery0");
}

Additional namespaces are added at initialization by the namespaces() function defined in the http://fabl.net/libsrc/discovery0.fbl file (see the libraries section). Among these appears:

namespace('ex',"http://example.org/");

This namespace is used in later sections for illustrative examples.

The function

Resource namespace(id prefix)

returns the resource denoted by the given prefix.