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
Resources

The Fabl type Resource implements the universal type rdfs:Resource. Fabl provides a shorter synonym for this type: ob, so that

Resource == rdfs:Resource;
->true
Resource == ob;
->true

The function

Resource allocate(string qname)

allocates a resource with the given qualified name.

For example, after

allocate("ex:myresource");

the resource with URI http://example.org/myresource is added to Fabl's triple store, if it is not already present. It is not an error to reallocate a resource.

The function

Resource resource(string uri)

allocates a resource when given its uri rather than qualified name. So,

resource("http://example.org/myresource") == allocate("ex:myresource");
->true

The function

string uri(Resource rs)

returns the the URI of rs, if any.

For example:

uri(rdf:type);
-->http://www.w3.org/1999/02/22-rdf-syntax-ns#type

The variant

Resource allocate(string qname,Class cl)

allocates the resource and also assigns it the given type.

For example,

allocate("ex:myproperty",rdf:Property);

allocates a resource of type rdf:Property - that is to say, an RDF property. A property can have more than one value on a single resource. That is, there can be arbitrarily many triples <S,P,O1> ... with the same subject S and property P. However, the class owl:FunctionalProperty represents the set of properties P that take on at most a single value on any subject S.

allocate("ex:myFunctionalProperty",owl:FunctionalProperty);

allocates a functional property.

An anonymous resource is one with no URI. The function

<value-of-type tp> function new(Class tp)

creates an anonymous resource of the specified type. For example:

var aa = new(Resource);

In Fabl, anonymous properties are not allowed; Properties should be created with allocate , not new.