Marmox™ Home Home
Folder Folder
Page Page
Page Folder Page Folder
Blog Entry Blog Entry
Upload… Upload…
selectedEdit Edit
Save Save
Rename… Rename…
Refresh Refresh
Delete Delete
Previous Previous
Next Next
Download… Download…
Add Comment… Add Comment…
Access… Access…
Properties… Properties…
About The Marmox™ Network About The Marmox™ Network
Log in Log in Join Join
URF Specification

Uniform Resource Framework (URF) Specification

Uniform Resource Framework (URF) Specification

Copyright © 2007-2009 GlobalMentor, Inc. This specification may be freely used but only in unmodifed form.

Author
Garret Wilson
Version
2009-09-06

The Uniform Resource Framework (URF) provides a consistent way for representing resources and their relationships. URF and its interchange formats are useful for data storage, data interchange, data querying, and logical inferences. URF together with its interchange formats provides a more powerful yet in many ways simpler and more consistent replacement for data-oriented XML, RDF, and JSON.

This document defines the Uniform Resource Framework (URF) as an abstract model, and also defines a text-based representation format, Text URF (TURF). This document does not yet provide a description of the binary representation format Serial URF (SURF), or the XML-based format XML URF (XMURF).

Conventions

When this document refers to "URF", it indicates a model for representing a community of knowledge abstract from any representation format. When this document refers to "TURF", it indicates the textual representation of URF. Because abstract concepts must be textualized to be communicated in a text-based specification, at times a description of the URF abstract model will use TURF notation for clarification of the model.

Ontologies

The following are official URF ontologies sanctioned by this specification, with links to their formal definitions in TURF:

URF
The core URF ontology for defining resources.
Content
The URF ontology for describing the content of a resource, such as content type, size, and actual content bytes.
Select
The URF ontology for selecting resources and other objects.
VCard
The URF ontology for describing person resource or white-pages type of directory information as described in [RFC 2426].

Primer

Resources

URF

Everything that can be described by URF is referred to as a resource. Every resource is an instance of the class urf.Resource. A group of described resources is referred to as an URF instance.

TURF

A resource can be described within a colon-semicolon pair. Multiple resources are separated by commas and/or newlines. The following example refers to an anonymous resource:

:;

A resource can optionally be given a label which can be used as a short representation to refer the resource only within the interchange document. A resource label is a name placed in front of a resource description and surrounded by vertical bars, as in the following example:

|label|:;

Resource Identification

URF

A resource may be anonymous or may be identified by a URI.

TURF

A URI is indicated by angle brackets. The following example indicates the URI represented by the characters http://example.com/example/resource:

<http://example.com/example/resource>

A resource may be identified by placing its URI characters within angle quotes; when the resource URI is given, the the colon and semicolon are optional if the resource has no properties. All URIs may be relative references, which are resolved to the base URI of the interchange document. The following example refers to the resource identified by the URI <http://urf.name/urf/resource>.

«http://example.com/example/resource»

A resource identified by URI may also be given a label and/or description:

|label|«http://example.com/example/resource»:;

There can be no newline characters between each of these elements, although there may be newlines inside individual elements if appropriate:

|label|«http://example.com/example/resource»:;

Ontologies and Namespaces

URF

A set of resources related to the same domain may be grouped together into an ontology. If all resources within an ontology to have similar URIs, each constructed relative to the ontology URI, the URI of the ontology is said to be a namespace URI, and each resource is said to have a local name which is combined with the namespace to create the resource URI. Not all resource URIs are part of some namespace.

URF only allows namespace URIs that are collection URIs, ending in a slash character '/'. the URI is formed by URI-encoding all non-pchar characters of the local name according to [RFC 3986] and appending the result to the namespace URI. For example, a namespace URI of <http://purl.org/dc/elements/1.1/> and a local name of "title" yield a resource URI of <http://purl.org/dc/elements/1.1/title>. These rules allow the namespace and local name to be unambiguously determined given any URI within a namespace.

TURF

A resource within a namespace can be identified by a name reference by listing the unencoded local name of the resource, with an optional prefix separated by full stop or period. The prefix, if present, is a string that has been associated with some namespace URI using a tilde character '~' in the TURF preamble, which is surrounded by colon ':' and semicolon ';' characters. If a property name reference has no prefix, the namespace is the URF default namespace, <http://urf.name/default/>.

In the following example, the name reference component.Button is equivalent to the URI reference «java:/com/guiseframework/component/Button», and the name reference of its sole property, label, is equivalent to the URI reference «http://urf.name/default/label». Another resource is also described that uses name references with prefixes for its URI, type, and property.

`URF:
"component"~<java:/com/guiseframework/component/>
"example"~<http://example.com/example/>
"foaf"~<http://xmlns.com/foaf/0.1/>
;¤
*component.Button:
label="Convert"
;
example.janedoe*foaf.Person:
example.name="Jane Doe"
;
.
Namespace declarations within a TURF document are purely syntactical, and their assigned namespace prefixes make no separate appearance in the resulting URF instance.

This specification uses resources in the following namespaces, with corresponding prefixes:

"dc"~<http://purl.org/dc/elements/1.1/>
The Dublin Core Metadata Initiative namespace [DCMI Namespace].
"example"~<http://example.com/example/>
An example namespace; used for hypothetical situations.
"urf"~<http://urf.name/urf/>
The URF namespace for resource and properties related to the framework abstract model itself.

The default namespace URI <http://urf.name/default/> is associated with no prefix (that is, the absense of a prefix).

Properties

URF

A resource may be related to another resource by the use of a property. Every property is itself a resource, although it is not implicitly an instance of the class urf.Property unless declared to be so. A resource subject, a property predicate, and the related resource object together make an assertion about the universe being described.

An infinite number of assertions may be made about a single subject resource. Repeated assertions about a subject resource with the same same predicate property and the same object resource are considered identical.

TURF

Assertions about a particular subject resource are presented within a colon-semicolon pair and separated by commas and/or newlines. Each predicate property and object resource pair of an assertion are separated by an equals character. Object resources, like resources in other contexts, can serve as the subject of other property assertions. In the following example, the resource «http://example.com/example/resource» has a single property «http://example.com/example/property», which has as its value another resource, «http://example.com/example/value»:

`URF¤
«http://example.com/example/resource»:
«http://example.com/example/property»=«http://example.com/example/value»
;
.

By associating the namespace <http://example.com/example/> with the prefix string "example", the above example could be represented in the following representation:

`URF:
"example"~<http://example.com/example/>
;¤
example.resource:
example.property=example.value
;
.

Classes

URF

A resource may represent a class or set of resources containing instances of other resources. As stated earlier, for example, all resources are implicitly instances of the class urf.Resource. Any resource may be explicitly asserted to be an instance of some class by identifying the class resource as a value of the urf.type property. A resource that is an instance of the class urf.Class may indicate that it is a subclass of some other class by indicating that class resource as the value of the urf.subClassOf property. A resource that is an instance of the class urf.Class may indicate that it is an implementation of some interface by indicating that interface resource as the value of the urf.implementationOf property.

TURF

It can be asserted that a resource is an instance of a class and a subclass of some other class by normal representation of the urf.type and urf.subClassOf property. In the following example, the resource example.resource is asserted to be an instance of the class example.MyClass:

`URF:
"urf"~<http://urf.name/urf/>
"example"~<http://example.com/example/>
;¤
example.resource:
urf.type=example.MyClass
example.property=example.value
;
.

As a shorthand representation, that a resource is an instance of one or more classes may be represented by placing a reference to the class resources after the resource reference, each preceded by an asterisk ('*'). The following example is semantically identical to the preceding example.

`URF:
"example"~<http://example.com/example/>
;¤
example.resource*example.MyClass:
example.property=example.value
;
.

There also exists a shorthand representation for the urf.subClassOf and urf.implementationOf properties, using the circumflex accent '^' and the greater than symbol '>', respectivly. The following example indicates that example.MyClass is a class that is a subclass of example.SuperClass and an implementation of the interface example.MyInterface:

`URF:
"example"~<http://example.com/example/>
;¤
example.MyClass*urf.Class^example.MySuperClass>example.MyInterface
.

URF Types

URF and its standard ontologies comes with several built-in types, including:

urf.Binary
Binary resources represent arbitrarily long sequences of bytes. Binary resources use the appropriate inline namespace for their type, with a lexical form of the base64url encoding of the binary data without line breaks according to [RFC 4648].
urf.Boolean
There are two boolean resources, the values true and false. Boolean resources are identified by URIs in the Boolean inline namespace with lexical representations of "true" and "false", respectively.
urf.Character
Character resources are the Unicode code points, and their lexical forms are the Unicode characters represented by those code points.
urf.Class
Not every resource used as a class is an instance of the class urf.Class, but a resource may be declared to be of the class type to further specify its semantics. The class urf.Class is a subclass of the class urf.Resource.
urf.Date
Date resources represent calendar dates in terms of calendar year, calendar month, and calendar day of month. They use an inline namespace with a lexical form consistent with [RFC 3339] of YYYY-MM-DD as defined in [ISO 8601].
urf.DateTime
A date time resource represents a time of day on a particular calendar date. They use an inline namespace with a lexical form combining the lexical forms of urf.Date and urf.Time separated by T: YYYY-MM-DDThh:mm:ss[.s+][(+|-)hh:mm] with optional UTC offset as defined in [ISO 8601]. A form without the optional UTC offset is said to be floating as defined in [RFC 2445], and should not be used unless a time independent of a time zone is to be specified. In most cases a fixed time is appropriate and a form with the UTC offset should be used. The hours component represents midnight as 00 and must not have a value larger than 23. The UTC offset -00:00 is not allowed; +00:00 must be used instead.
urf.Duration
Duration resources represent lengths of time. They use an inline namespace with a lexical form consistent with [RFC 2445] and [ISO 8601] of P[nYnMnD][TnHnMn[.n]S], where n is some positive number of roman digits and at least the date or time section is present.
urf.Enum
The base class of class resources having inline URIs the lexical forms of which are enumerated as class list elements.
urf.Integer
Integer resources are the positive whole numbers, the negative whole numbers, and zero. They are identified by inline namespace URIs with a lexical representation in the form [-]romandigit+. The integer class is a subclass of the class urf.Number.
urf.Language
Language resources represent human langages and use inline namespace URIs. The lexical form of each is the corresponding language tag described in [RFC 4646].
urf.List
List resources are resources that contain other element resources at certain indexes of the list. A list, like normal resources, may have any property, but the properties representing the elements of the list lie in the ordinal namespace <http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Ordinal/>, each representing the ordinal index of the element. That is, if a list contains an element at index 5, the element resource will appear as a value of the property «http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Ordinal/%225%22» (that is, the property «(urf.Ordinal)"5"», or simply º5). Although many uses cases will prefer a continuous, unduplicated sequence of index properties beginning with º5, this is not an URF requirement.
urf.Map
A resource containing associations between keys and values. Each association is represented by an instance of urf.MapEntry, which indicates a value for the property urf.key and the property urf.value. Each map entry is the value of an urf.entry property of the map resource.
urf.Ordinal
Ordinal resources are numbers that represent the position of an element in a sequence. URF currently only supports finite ordinals, which means that there will be a corresponding ordinal for every positive whole numbers and zero. Ordinals are identified by inline namespace URIs with a lexical representation in the form romandigit+. The ordinal class is a subclass of the class urf.Number.
urf.Property
Not every resource used as a predicate is an instance of the class urf.Property, but a resource may be declared to be of the property type to further specify its semantics and expected domain and range. The class urf.Property is a subclass of the class urf.Class.
urf.Rational
Rational number are all of the measuring numbers and may include decimal fractional parts. They are identified by inline namespace URIs with a lexical representation in the form [-]romandigit+.romandigit+[e[+|-]romandigit+]. The integer class is a subclass of the class urf.Number.
urf.RegularExpression
Regular expression resources are text-based patterns that define rules for the content of strings. These are inline namespace resources.
urf.Resource
Every resource is implicitly an instance of the class urf.Resource. The resources urf.Property and urf.Resource are both instances of the class urf.Resource.
urf.Set
Set resources are resources that contain at most one instance of other element resources. A set, like normal resources, may have any property, but the properties representing the elements of the set appear as values of the urf.element property.
urf.String
String resources are sequences of Unicode code points or text and lie in the corresponding inline namespace.
urf.Time
Time resources represent time of day. They use a inline namespace with a lexical form consistent with [RFC 3339] of hh:mm:ss[.s+][(+|-)hh:mm] with optional UTC offset as defined in [ISO 8601]. A form without the optional UTC offset is said to be floating as defined in [RFC 2445], and should not be used unless a time independent of a time zone is to be specified. In most cases a fixed time is appropriate and a form with the UTC offset should be used. The hours component represents midnight as 00 and must not have a value larger than 23. The UTC offset -00:00 is not allowed; +00:00 must be used instead.
urf.URI
URI resources are sequences of Unicode code points that function as resource identifiers and conform to [RFC 3986]. They lie in the corresponding inline namespace with a lexical form specified by [RFC 3986].
urf.UTCOffset
UTC offset resources represent an offset from UTC to local time. They use an inline namespace with a lexical form of (+|-)hh:mm with semantics corresponding to the UTC offset described in [RFC 2426] and [RFC 2445]. The UTC offset -00:00 is not allowed; +00:00 must be used instead.
content.Charset
The name of the mapping of integer values to a set of characters. This is equivalent to the charset Internet media type parameter described by [RFC 2046] and further elaborated in [RFC 2278] Section 2.3. A charset encapsulates both the concept of a coded character set and a character encoding scheme, as specified in [RFC 2130] Section 3.2. The lexical form is the canonical charset name specified by [IANA Charset Registry], such as UTF-16BE.
content.MediaType
A media type resource is an Internet media types described by [RFC 2046]. Internet media types are also known as MIME types and content types. Media type resources use inline namespace URIs, and each has a lexical form corresponding to its [RFC 2046] representation without any media type parameters.

Selectors

URF

A resource may have a selector that indicates how a specific instance of a class is to be selected. A selector for an instance of a particular class is represented by the urf.List value of a scoped urf.selector property in the scope of the resource's urf.type property for the class instance being selected.

TURF

A selector for a particular type may be represented in short form by one or more comma-separated resources withing parenthesis after the type short form. The following example selects an instance of the type example.Point using the selector [#5#, #8#], assumedly indicating five units along the X axis and eight units along the Y axis.

`URF:
"example"~<http://example.com/example/>
;¤
*example.Point(#5#, #8#)
.

The following example is semantically equivalent to the short form above:

`URF:
"urf"~<http://urf.name/urf/>
"example"~<http://example.com/example/>
;¤
:
urf.type=example.Point:
urf.selector`=[#5#, #8#]
;
;
.

Inline Resource URIs

URF

Some resource types are singletons that are unambiguously identified by their selectors. These resources are identified by inline URIs that contain both the resource type and the identifying selector within the URI itself. The most common type of resource that use inline URIs are those that in day-to-day life have customarily been identified by character sequences or lexical representations. For example, the integer 123 has historically been represented by the character sequence "123", although the number itself is an abstract concept, not a series of characters. Similarly, the two boolean values are usually represented as the character sequences "true" and "false".

Each inline namespace URI begins with the base URF inline namespace URI <http://urf.name/inline/> and has the following format,

http://urf.name/inline/encodedTypeURI/encodedTURFLexicalForm

where encodedTypeURI is the URI path segment-encoded form of the full type URI of the resource; and encodedTURFLexicalForm is the URI path segment-encoded canonical lexical form of the resource as defined by the indicated type, in its TURF short string form. For example, the integer 123, which is of the type «http://urf.name/urf/Integer», has a lexical form of "123". This TURF string representation, encoded for a URI, yields %22123%22, which results in  the following inline URI:

http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Integer/%22123%22

A resource in an inline namespace is implicitly an instance of the type indicated in the encodedTypeURI section of the URI. In all other aspects resources in inline namespaces are no different from resources not in an inline namespace; these resources are not instances of a special resource type solely because their namespaces are inline namespaces. Inline namespaces provide a framework for easily and consistently formulating identifying URIs for resources that are traditionally identified in lexical form; inline namespaces in themselves imply no additional semantics.

TURF

Any representation of a resource in an inline namespace also implicitly asserts the type of the resource. A resource in an inline namespace can be identified by its URI as with any other resource. For example, the integer 123 can be identified by its URI <http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Integer/%22123%22> as in the following example:

«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Integer/%22123%22»

Rather than indicating directly the URI of a resource in an inline namespace, the resource may be identified by indicating the type of the resource preceded by an asterisk inside the URI reference, followed by the canonical lexical form of the resource as a string inside parentheses. In essence, a type an selector is being used to generate a corresponding URI. The integer 123 may therefore be represented as either of the following short forms:

«*«http://urf.name/urf/Integer»("123")»
«*urf.Integer("123")»

The inline namespaces for several types have additional short representations. The examples below assume that the label urf has been assigned to the URF namespace.

urf.Binary

An binary resource may be identified by its [RFC 4648] base64url lexical form surrounded by percent signs. For example, the series of bytes 64, 63, 62, 61 produce the lexical form, "QD8-PQ=="; the corresponding short representation,

%QD8-PQ==%

is equivalent to the following long representation,

«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Binary/%22QD8-PQ%3D%3D%22»

which is also equivalent to the following general short representation for resources in an inline namespace:

«*urf.Binary("QD8-PQ==")»
urf.Boolean

An boolean resource may be identified by its lexical form surrounded by matching underscore characters ('_'). For example, the following short representation,

_true_

is equivalent to the following long representation,

«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Boolean/%22true%22»

which is also equivalent to the following general short representation for resources in an inline namespace:

«*urf.Boolean("true")»
urf.Character

A character resource may be identified by its character-escaped lexical form with surrounding single quotes. For example, the following short representation,

'x'

is equivalent to the following long representation,

«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Character/%22x%22»

which is also equivalent to the following general short representation for resources in an inline namespace:

«*urf.Character("x")»
urf.Number

Integer and rational number resources may be identified by their lexical forms surrounded by matching number signs ('#'). The specific type of number resource yielded depends on the lexical form used. For example, the following short representations,

#123#
#123.45#

are equivalent to the following long representations, respectively,

«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Integer/%22123%22»
«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Rational/%22123.45%22»

which are also equivalent to the following general short representations for resources in an inline namespace, respectively:

«*urf.Integer("123")»
«*urf.Rational("123.45")»
urf.Ordinal

Ordinal number resources may be identified by their lexical forms surrounded by matching ordinal characters 'º'. For example, the following short representation,

º5º

is equivalent to the following long representation,

«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Ordinal/%225%22»

which are also equivalent to the following general short representation for resources in an inline namespace:

«*urf.Ordinal("5")»
urf.RegularExpression

A regular expression resource may be identified by its regular expression-escaped lexical form surrounded by slashes ('/'). For example, the following short representation,

/a?b+c*/

is equivalent to the following long representation,

«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23RegularExpression/%22a%3Fb%2Bc%2a%22»

which is also equivalent to the general short representation for resources in an inline namespace:

«*urf.RegularExpression("a?b+c*")»
urf.String

A string resource may be identified by its string-escaped lexical form with surrounding quotes. For example, the following short representation,

"apple"

is equivalent to the following long representation,

«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23String/%22apple%22»

which is also equivalent to the general short representation for resources in an inline namespace:

«*urf.String("apple")»
urf.Temporal

A temporal resource such as urf.Date, urf.DateTime, urf.Duration, urf.Time, or urf.UTCOffset may be identified by its lexical form surrounded by matching at signs ('@'). The specific temporal type can be determined by the specific lexical form used. For example, the following short representations for urf.Date, urf.Time, urf.DateTime, urf.Duration, and urf.UTFOffset,

@1980-05-06@
@16:39:57-08:00@
@1980-05-06T16:39:57-08:00@
@P100Y5M3DT8H2M10.5S@
@-08:00@

are equivalent to the following long representations, respectively,

«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Date/%221980-05-06%22»
«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Time/%2216%3A39%3A57-08%3A00%22»
«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23DateTime/%221980-05-06T16%3A39%3A57-08%3A00%22»
«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Duration/%22P100Y5M3DT8H2M10.5S%22»
«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23UTCOffset/%22-08:00%22»

which are also equivalent to the general short representations for resources in an inline namespace:

«*urf.Date("1980-05-06")»
«*urf.Time("16:39:57-08:00")»
«*urf.DateTime("1980-05-06T16:39:57-08:00")»
«*urf.Duration("P100Y5M3DT8H2M10.5S")»
«*urf.UTCOffset("-08:00")»
urf.URI

A URI resource may be identified by its lexical form with surrounding angle brackets '<' and '>'. For example, the following short representation,

<http://urf.name/urf/type>

is equivalent to the following long representation,

«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23URI/http%3A%2F%2Furf.name%2Furf%23type»

which is also equivalent to the general short representation for resources in an inline namespace:

«*urf.URI("http://urf.name/urf/type")»

Enums

URF

URF provides a special class, urf.Enum, for declaring subclasses that have values from a finite set of lexical forms. The URI of each instance of the enum subclass is a normal inline URI, made up of the enum type (the urf.Enum subclass) and the lexical form of the enum value. urf.Enum is in turn a subclass of urf.Set, and the lexical form values of the enum type are specified as set elements of the urf.Enum subclass. For example, the URF class urf.Boolean is a subclass of urf.Enum, and its lexical form values are "false" and "true". The URI of each urf.Boolean instance is formed following normal URF inline URI rules, resulting in «http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Boolean/%22false%22» and «http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Boolean/%22true%22».

TURF

The following is the definition of the urf.Boolean class, which is a typical enum subclass:

`URF:
"urf"~<http://urf.name/urf/>
;¤
urf.Boolean*urf.Class^urf.Enum{
"false",
"true"
}
.

Reification

URF

Propositions may be described without actually asserting those propositions. The sentence, "John believes that the sky is purple," for example, does not assert that the skye is purple, but merely that John believes this to be the case. The proposition "the sky is purple" may be described like any other resource, using the URF class urf.Proposition and the URF properties urf.subject, urf.predicate, and urf.object.

TURF

The following example asserts that John believes the sky to have the color purple without asserting that the sky actually has that color:

`URF:
"urf"~<http://urf.name/urf/>
"example"~<http://example.com/example/>
;¤
example.john:
example.believes=*urf.Proposition:
urf.subject=example.sky
urf.predicate=example.color
urf.object=example.purple
;
;
.

Propositions may be presented in a short form consisting of the subject, predicate, and object enclosed in open double quotation mark '“' and closed double quotation mark '”' characters. The following example is semantically equivalent to the previous one:

`URF:
"urf"~<http://urf.name/urf/>,
"example"~<http://example.com/example/>
;¤
example.john:
example.believes=“example.sky, example.color, example.purple”
;
.

Any proposition that is asserted can be reified by placing a label before the equals sign in a property definition. The label will then identify a proposition that is the reification of the property assertion, and that labeled resource can then be used in any situation in which a resource is expected. The following example first asserts that the sky is purple, using the label skyColorPurple to represent the reified proposition, “example.sky, example.color, example.purple”. Then it is asserted that John believes this proposition; the second assertion is therefore semantically identical to the one in the previous example.

`URF:
"example"~<http://example.com/example/>
;¤
example.sky:
example:color|skyColorPurple|=example:purple
;
example.john:
example.believes=|skyColorPurple|
;
.

Proposition Scope

URF

Some assertions are only valid within a certain scope; they are asserted in a separate URF instance related to the context of some other subject and property. For example, if Juan has an English name of "John", Juan could specify a example.name of "John" with an example.lang of example.english. Because the string "John" may not represent an English string in all contexts, its property example.lang should be considered to be in the scope of the relationship between Juan and the example.name "John". The assertion, "the string 'John' is in English", is contextual to the string "John" being the name of Juan.

Similarly, Juan could specify a example.weight of #72# with an example.unit of example.kilogram. Because the integer #72# may not represent a unit of kilograms in all contexts, its property example.unit should be considered to be in the scope of the relationship between Juan and the example.weight #72#. The assertion, "the integer 72 is in kilograms", is contextual to the integer 72 being the weight of Juan.

Scoped propositions are actually propositions asserted in separate knowledge communities created by their context propositions.

TURF

To restrict a particular property assignment to the scope of the subject serving as the value of some other resource's property, the grave accent character '`' is used before the equals sign '=' in the property declaration:

`URF:
"example"~<http://example.com/example/>
;¤
example.juan:
example.name="John":
example.lang`=example.english
;
example.weight=#72#:
example.unit`=example.kilogram
;
;
.

Ordered Properties

URF

Although all resource property assertions of a particular subject have no inherent order, URF provides a facility for declaring property order using scoped properties. Each property that should be considered to have an order relative to other assertions of the same property is given a scoped property urf.order with a value of type urf.Integer, representing the relative order in which the property should be interpreted.

The interpretation of the property's order is specific to the property in question. Although many uses cases will prefer a continuous, unduplicated sequence of order property values beginning with 0, this is not an URF requirement. The result of merging ordered properties is undefined, except that the properties in each group before the merge must still be in the same order relative to each other after the merge.

TURF

Ordered properties may be indicated using the general representation for contextual properties. The following example indicates that a resource has two names, "William" and "Bill", and that "Will" comes before "Bill". (What it means that a name "comes before" another name depends on the definition of the name property being used. Perhaps one name comes before the other if used simultaneously, or perhaps one name has a higher priority or is considered the "default" name.)

`URF:
"urf"~<http://urf.name/urf/>
"example"~<http://example.com/example/>
;¤
example.billy:
example.name="William":
urf.order`=#0#
;
example.name="Bill":
urf.order`=#1#
;
;
.
The same information may be presented in short representation in the form of a sequence by placing the ordered values within matching backslash characters. A sequence does not result in a new type of value, but rather indicates that the given predicate should be asserted for each value, each with a scoped property of urf.order with values starting at #0# and continuing sequentially. The following example represents information semantically identical to the previous example:
`URF:
"urf"~<http://urf.name/urf/>
"example"~<http://example.com/example/>
;¤
example.billy:
example.name=\"William", "Bill"\
;
.

Programming Languages

URF

URF provides inherent support for describing how to instantiate objects from programming languages such as Java. When an ontology of a semantic framework such as URF is used to represent programming language objects, the ontology is referred to as a Programming Language Ontology for Objects and Properties, or PLOOP. A class can be identified as an object's type using a URI that identifies the type, such as «java:/com/example/package/ExampleClass» for the Java class com.example.package.ExampleClass. The urf.List value of the selector property urf.selector specifies the resources to be used for object initialization using a constructor with parameters matching the given values.

URF properties specify programming language properties, which may be virtual properties using "getter" and "setter" methods such as with JavaBeans. Programming languages usually have properties relative to each class rather than absolute for all classes. URF uses properties in the default namespace to represent these relative properties. For example, the Java property represented by the JavaBean method com.example.package.ExampleClass.setProperty(java.lang.String) would be represented by an URF property with the URI «http://urf.name/default/property». Some values may be language-specific; Java, for example, provides a global null value represented in URF by «java:null».

TURF

The TURF selector shorthand notation specifies constructor arguments for a class instance if a non-default constructor is desired. The class com.guiseframework.Category of the Guise Internet application framework [Guise], for example, does not have a default constructor. The following example provides an urf.selector urf.List property containing a single element of type urf.String, which can be converted to a java.lang.String object and used as arguments for the com.guiseframework.Category(java.lang.String, java.lang.String) constructor. Properties of that class will then be set, recursively converting values such as urf.List to the equivalent Java object such as java.util.List.

`URF:
"guise"~<java:/com/guiseframework/>
;¤
*guise.Category("category1", "First Category"):
categories=[
*guise.Category("subcategoryA")
*guise.Category("subcategoryB")
]
;
.

This is equivalent to the following TURF long form:

`URF:
"urf"~<http://urf.name/urf/>
"guise"~<java:/com/guiseframework/>
;¤
:
urf.type=guise.Category:
urf.selector`=["category1", "First Category"]
;
categories=[
:
urf.type=guise.Category:
urf.selector`=["subcategoryA"]
;
;
:
urf.type=guise.Category:
urf.selector`=["subcategoryB"]
;
;
]
;
.

Knowledge Communities

URF

The class urf.Community represents a body of knowledge accepted within a certain context. The urf.Community class is a subclass of urf.Set; its elements are instances of urf.Proposition. The propositions an urf.Community contains are considered to be asserted within that community.

The class urf.Proposition is a subclass of urf.Community, which means that each proposition is itself a knowledge community providing a context for asserted propositions. Scoped propositions are propositions that are contained within another instance of urf.Proposition.

TURF

In a TURF interchange document, every root resource and its recursive properties (excluding those within other urf.Community instances), represent propositions asserted in a default knowledge community. For example, the following example asserts that Punxsutawney Phil predicts the weather. ("Punxsutawney Phil" the name given to a marmot in Punxsutawney, Philadelphia, USA. On the American holiday Groundhog Day, whether Punxsutawney Phil sees his shadow is considered to be a prognostication regarding the onset of spring weather.)

`URF:
"punx"~<http://example.com/punxsutawney/>
;¤
punx.Phil:
punx.predicts=punx.weather
;
.

It may instead be asserted that some other community, possibly identified, asserts a set of propositions. The currency symbol '¤' and full stop '.' characters indicate that the properties and resources between them are reified as propositions and serve as elements of the given urf.Community instance—which in turn is taken to mean that the propositions are asserted by the given knowledge community. (All TURF exchange documents have a common instance community in which root assertions are made.) For example, rather than directly asserting that Punxsutawney Phil predicts the weather, the following example asserts that the community of Punxsutawney asserts (believes or holds) that Punxsutawney Phil predicts the weather (the urf.Community specification is redundant here, because the community short form implies the urf.Community type):

`URF:
"urf"~<http://urf.name/urf/>
"punx"~<http://example.com/punxsutawney/>
;¤
punx.Punxsutawney*urf.Community¤
punx.Phil:
punx.predicts=punx.weather
.
.

Semantics identical to those the previous example can be represented in the following longer form, with the propositions (shown here in short form) that are asserted in the community explicitly reified:

`URF:
"urf"~<http://urf.name/urf/>
"punx"~<http://example.com/punxsutawney/>
;¤
punx.Punxsutawney*urf.Community{
“punx.Phil, punx.predicts, punx.weather”
}
.

Because scoped properties are really propositions asserted in the knowledge community that is some other proposition, scoped properties may be represented in the same manner as other knowledge community representations. The following is the scoped property example given earlier in its short form:

`URF:
"example"~<http://example.com/example/>
;¤
example.juan:
example.name="John":
example.lang`=example.english
;
example.weight=#72#:
example.unit`=example.kilogram
;
;
.

Because each urf.Proposition instance is also an instance of urf.Community, reifying the propositions example.name="John" and example.weight provides two separate knowledge communities, in this case asserting the scoped properties. This is illustrated in the following example, which uses labels to indicate the reification of the asserted propositions relating to example.juan:

`URF:
"example"~<http://example.com/example/>
;¤
example.juan:
example.name|juanNameJohn|="John"
|juanNameJohn|¤
"John":
example.lang=example.english
;
.
example.weight|juanWeight72|=#72#
|juanWeight72|¤
#72#:
example.unit=example.kilogram
;
.
;
.

Referring to labeled assertions represent the reification of those propositions, and property declarations within a community (which itself may be another reified proposition) represent reified propositions asserted within that community. Therefore, the previous example can be represented in a more fully reified form (using proposition short forms):

`URF:
"urf"~<http://urf.name/urf/>
"example"~<http://example.com/example/>
;¤
example.juan:
example.name="John"
example.weight=#72#
“example.juan, example.name, "John"”{
“"John", example.lang, example.english”
}
“example.juan, example.weight, #72#”{
“#72#, example.unit, example.kilogram”
}
;
.

Note that example.name="John" and example.weight=#72# are listed separately as assertions of John's name and weight; those two propositions are later explicitly reified as propositions and serve as separate knowledge communities containing other assertions about the name "John" and the weight #72#.

URF

Everything that is described in URF is referred to as a resource. For purposes of description within URF, each resource may be identified using a URI [RFC 3986]. Resources are described by a set of assertions, each of which is a proposition, an instance of urf.Proposition. Each proposition contains a subject, a predicate, and an object.

A particular group of assertions is called an URF instance. Each asserted proposition exists in some URF knowledge community as an element of urf.Community. Each urf.Proposition is itself a subclass of urf.Community, and may therefore contain other scoped assertions that are contextual to the first proposition. The root assertions of an URF instance are part of the instance community and may be considered to be asserted in the same knowledge community as the instance community of all other URF instances.

TURF

TURF is the text interchange format for URF. TURF emphasizes terseness and consistency while maintaining human readability, with a preference for using symbols from existing interchange formats such as JSON and programming languages such as Java and C#. TURF has several useful properties, including:

  • TURF has a signature character sequence, `URF, for easy recognition.
  • TURF has unambiguous beginning and end delimiters, allowing TURF to be embedded in existing text-based content.
  • Whitespace separators and comments may be removed with no loss of semantics, resulting in an extremely compact representation.
  • Standard delimiters are used, such as {…} for sets, […] for lists, "…" for strings, <…> for URIs, #…# for numbers, and º…º for ordinals.

Internet Media Type

The Internet media type [RFC 2046] of general URF information encoded as TURF is:

text/urf

TURF differs from general [RFC 2046] text media types in the following:

  • The default charset of TURF is UTF-8 rather that US-ASCII.
  • TURF allows any Unicode newline character [UTR #13] to represent newlines rather than only CRLF.

For any application-specific URF data encoded as TURF should be represented as application/applicationName+turf to allow the data to be recognized as such, where applicationName is the application-specific identifier for the URF information. Note: These Internet media types have yet to be registered with the IANA.

Encoding

TURF may use any encoding in a closed environment in which all relevant parties are aware of the encoding being used. In situations where the encoding may not be readily known to a processor, such as in a general file stored in a file system, TURF must use the UTF-8 character encoding. TURF interchange document files should use a UTF-8 U+FEFF sequence (the so-called UTF-8 Byte Order Mark or BOM) at their beginning to notify general text processing agents that may not be aware of TURF that UTF-8 encoding is being used [Unicode BOM FAQ].

Signature

Every TURF interchange document must begin with the signature character sequence, `URF, which must appear as the first characters of the document after the Byte Order Mark (BOM), if any [Unicode BOM FAQ].

Grammar

The following grammar indicates literals in normal style, variables in emphasized text, and grammar symbols in strong text.

Any two TURF tokens may be separated by filler: Unicode separator or Unicode whitespace characters, or a TURF comment, which is a string surrounded by the dagger '†' and double dagger '‡' characters.

filler ⇒ Unicode Paragraph Separator | Unicode Segment Separator | Unicode Whitespace | comment

comment ⇒ †"[Unicode character except double dagger and backslash | escapedunicode | escapedcontrol]*‡

Between elements in a list, filler has a caveat: Unicode newline characters [UTR #13] function as a list separator, which is at least one newline character and/or at most a single comma character (','), optionally surrounded by other filler characters:

listseparator ⇒ Unicode Newline+ | ,

A TURF interchange document is encoded in UTF-8 and begins with the TURF signature `URF followed by the description of the instance community, which consists of optional properties and a required community short representation.

TURF ⇒ signature [:properties;] communityshort

signature ⇒ `URF

The community short form, the grammar of which is below, is delimited by the currency character '¤' and the full stop character '.' and contains zero or more resource descriptions, separated by list separators. Each resource description must have at least one of the following optional components, any may have any or all of them: a label, a reference, one or more type short forms, a set of property definitions, a community short form, a proposition form, a list short form, a set short form, and a map short form. No Unicode newline characters are allowed between elements of a resource description.

resource ⇒ [label] [reference] [types] [superclasses] [interfaces] [properties] [communityshort] [propositionshort] [listshort] [setshort] [mapshort]

A label consists of a name surrounded by matching vertical bars ('|').

label ⇒ |name|

A name is any letter followed by any number of letters, digits, or connectors such as the underscore character '_'.

name ⇒ namebeginchar(namechar)*

namebeginchar ⇒ Unicode Letter

namechar ⇒ Unicode Letter | Unicode Decimal Digit Number | Unicode Connector Punctuation

A resource reference is a URI reference, a name reference, or one of several short representations.

reference ⇒ urireference | namereference | urishort | stringshort | charactershort | booleanshort | numbershort | ordinalshort | regexshort | temporalshort

A resource URI reference is enclosed in angle quotes. The contents is either the text of a URI (or relative reference); or a resource reference to an inline type preceded by an asterisk '*', immediately followed by a string containing the lexical representation of a resource, surrounded by parentheses '(' and ')'. If a relative reference is provided, it is resolved against the base URI of the TURF document according to the rules specified in [RDF/XML] 5.3 Resolving URIs. Any URI reference that includes a lexical representation is equivalent to a URI reference in the form «http://urf.name/inline/encodedTypeURI/encodedTURFLexicalForm».

urireference ⇒ «(*type(stringshort)) | (urichar+)»

type ⇒ reference

A name reference is a name representing the local name of a resource, optionally preceded by a name ending with the full stop or period character '.', together representing the URI of a resource. The prefix, if present, must have been associated with a namespace URI in using the tilde character '~' either in the properties of the current resource or one of its subject resources. If no prefix is present for a property, the namespace is the URI of the first type of the subject resource. A prefix must be present in all other name references. The local name is the unencoded form of the fragment to be appended to the namespace URI.

namereference ⇒ [prefix.]localName

prefix ⇒ name

localName ⇒ name

A string short form is a sequence of Unicode characters, using the backslash as an escape character, enclosed in double quotes. The double quotation mark ('"') and backslash ('\\') characters must be escaped. A string short form is equivalent to a resource of type urf.String using the corresponding inline namespace. The string short form "example" is the equivalent of the string resource «(urf.String)"example"».

stringshort ⇒ "[Unicode character except double quote and backslash | \" | \\ | escapedunicode | escapedcontrol]*"

Any Unicode code point may be represented in string and other short representations where indicated by the four lowercase hexadecimal representation following the character sequence "\u", or if the code point is not in the Basic Multilingual Plane, two such sequences representing UTF-16 surrogate pair.

escapedunicode ⇒ \uxxxx

Several control characters have escaped forms which can be used in string and other short representations where indicated.

escapedcontrol ⇒ \b | \t | \n | \f | \r | \“ | \”

\b †\\\u0062‡ ⇒ \u0008 †backspace‡

\t †\\\u0074‡ ⇒ \u0009 †character tabulation‡

\n †\\\u006e‡ ⇒ \u000a †line feed (LF)‡

\f †\\\u0066‡ ⇒ \u000c †form feed (FF)‡

\r †\\\u0072‡ ⇒ \u000d †carriage return (CR)‡

\“ †\\\u201c‡ ⇒ \u0098 †start of string (SOS)‡

\” †\\\u201d‡ ⇒ \u009c †string terminator (ST)‡

A character short form is a single Unicode characters, using the backslash as an escape character, enclosed in a single quote. The single quote ('\'') and backslash ('\\') characters must be escaped. A character short form is equivalent to a resource of type urf.Character using the corresponding inline namespace. The character short form 'x' is the equivalent of the character resource «(urf.Character)"x"».

charactershort ⇒ '[Unicode character except single quote and backslash | \' | \\ | escapedunicode | escapedcontrol]*'

A URI short form is a sequence of character constituting a syntactically correct URI or a relative reference, surrounded by the angle brackets '<' and '>'. Alternatively, a type and selector may be provided with identical syntax to a resource URI reference. If a relative reference is provided, it is resolved against the base URI of the TURF document according to the rules specified in [RDF/XML] 5.3 Resolving URIs. A URI short form is equivalent to a resource of type urf.URI using the corresponding inline namespace. The URI short form <http://example.com> is the equivalent of the URI resource «(urf.URI)"http://example.com"».

urishort ⇒ <(*type(stringshort)) | (urichar+)>

A boolean short form is the character sequence true or false surrounded by matching underscore characters '_'. A boolean short form is equivalent to a resource of type urf.Boolean using the corresponding inline namespace. The boolean short form _true_ is the equivalent of the boolean resource «(urf.Boolean)"true"».

booleanshort ⇒ _true_|_false_

A number short form consists of Roman digits, optionally preceded by a minus sign, with an optional decimal and optional exponent, all surrounded by matching number signs '#'. A number short form is equivalent to a resource of type urf.Integer or urf.Rational, depending on the lexical form used, using the corresponding inline namespace. The number short form #123# is the equivalent of the number resource «(urf.Integer)"123"», and the number short form #123.45# is the equivalent of the number resource «(urf.Rational)"123.45"».

numbershort ⇒ #[-]n[.n][e(+|-)n]#

n ⇒ romandigit+

An ordinal short form consists of roman digits surrounded by matching ordinal signs 'º'. An ordinal short form is equivalent to a resource of type urf.Ordinal using the corresponding inline namespace. The ordinal short form º27º is the equivalent of the ordinal resource «(urf.Ordinal)"27"».

ordinalshort ⇒ ºnº

A regular expression short form is a sequence of Unicode characters, using the backslash as an escape character, enclosed in forward slash ('/') characters. The slash ('/') and backslash ('\\') characters must be escaped. A regular expression short form is equivalent to a resource of type urf.RegularExpression using the corresponding inline namespace. The regular expression short form /a?b+c*/ is the equivalent of the string resource «(urf.RegularExpression)"a?b+c*"».

regexshort ⇒ /[Unicode character except slash and backslash | \/ | \\ | escapedunicode | escapedcontrol]*/

A temporal short form consists of the lexical form of a temporal resource such as urf.Date, urf.DateTime, urf.Duration, urf.Time, or urf.UTCOffset, surrounded by matching at signs ('@'). An urf.Duration requires at least the date or the time section to be present. The hours component represents midnight as 00 and must not have a value larger than 23. The UTC offset -00:00 is not allowed; +00:00 must be used instead. A temporal short form is equivalent to a resource of the corresponding urf.Temporal type, based upon the specific lexical form used. The temporal short form @1999-03-04@ is the equivalent of the number resource «(urf.Date)"1999-03-04"», for example.

temporalshort ⇒ @(YYYY-MM-DD) | (YYYY-MM-DDThh:mm:ss[.s+][(+|-)hh:mm]) | (hh:mm:ss[.s+][(+|-)hh:mm]) | (P[nYnMnD][TnHnMn[.n]S]) | ((+|-)hh:mm)@

The types declaration consists of one or more resource references, each preceded by an asterisk '*'. Each type reference is equivalent to the reference asserted as the object of the urf.type property. Each type reference may optionally specify comma-separated selector resources between parentheses characters '(' and ')' following the type reference. The selector resources are equivalent to the values of urf.List value of a scoped urf.selector property in the context of the resource's urf.type property for which the type is a value.

types ⇒ typeshort*

typeshort ⇒ *typereference[([selectorresource[,selectorresource]*])]

typereference ⇒ reference

selectorresource ⇒ resource

The superclasses declaration consists of one or more resource references, each preceded by a circumflex accent '^'. Each superclass reference is equivalent to the reference asserted as the object of the urf.subClassOf property.

superclasses ⇒ superclassshort*

superclassshort ⇒ ^reference

The interfaces declaration consists of one or more resource references, each preceded by a greater-than symbol '>'. Each interface reference is equivalent to the reference asserted as the object of the urf.implementationOf property.

interfaces ⇒ interfaceshort*

interfaceshort ⇒ *reference

Properties consist of a list of predicate resource and object resource pairs between the color character ':' and the semicolon character ';', each separated by the equals sign '='. If the grave character '`' is present before the equals sign, it indicates that the property is scoped in the context of the property's subject resource and its respective predicate resource and subject resource. If a label is provided, it identifies the proposition represented by the reification of the assertion.

properties ⇒ :[property[listseparator property]*];

property ⇒ resource[label][`]=(sequenceshort|resource)

A sequence short form consists of a sequence of element resources separated by list separators and surrounded by the backslash character '\\'. Each listed element resource indicates another assertion of the given predicate with the given element resource as the value, each with a contextual property of urf.order with values starting at #0# and continuing sequentially.

sequenceshort ⇒ \[resource[listseparator resource]*]\

A community short form consists of a sequence of resources surrounded by the currency symbol '¤' and the full stop character '.', separated by list separators. Each listed resource represents an unreified proposition that is a value of the urf.element property. The presence of a community short form implies a type of urf.Community if no other types have yet been specified, either implicitly or explicitly.

communityshort ⇒ ¤[resource[listseparator resource]*].

A proposition short form lists the subject, predicate, and object of a proposition inside the open double quotation mark '“' and closed double quotation mark '”' characters, separated by list separators. A proposition short form is equivalent to setting the resource urf.Subject, urf.Predicate, and urf.Object propoerties to the three listed resources within the proposition short form. The presence of a proposition short form implies a type of urf.Proposition if no other types have yet been specified, either implicitly or explicitly.

propositionshort ⇒ “subject listseparator predicate listseparator object”

subject ⇒ resource

predicate ⇒ resource

object ⇒ resource

A list short form consists of a sequence of element resources surrounded by bracket characters '[' and ']' and separated by list separators. Each listed element resource represents the value of an ordinal index property, in sequence beginning with the ordinal property º0º. The presence of a list short form implies a type of urf.List if no other types have yet been specified, either implicitly or explicitly.

listshort ⇒ [[resource[listseparator resource]*]]

A set short form consists of a sequence of element resources surrounded by curly bracket characters '{' and '}' and separated by list separators. Each listed element resource represents a value of the urf.element property. The presence of a set short form implies a type of urf.Set if no other types have yet been specified, either implicitly or explicitly.

setshort ⇒ {[resource[listseparator resource]*]}

A map short form consists of a sequence of key/value associations surrounded by tortoise shell bracket characters '〔' and '〕'. Each key is separated from its value using the equals sign '=', and the key/value combinations are separated by list separators. Each key/value association represents a resource of type urf.MapEntry as a value of the urf.entry property of the map resource, with key a value of the map entry urf.key property, and the value a value of the map entry urf.value property. The presence of a map short form implies a type of urf.Map if no other types have yet been specified, either implicitly or explicitly.

mapshort ⇒ 〔[mapentry[listseparator mapentry]*]〕

mapentry ⇒ key=value

key ⇒ resource

value ⇒ resource

Reference Implementation

GlobalMentor, Inc. maintains an open-source reference implementation for processing URF. The library provides an API and source code for parsing URF from TURF, parsing URF from RDF/XML, creating a Java instance tree from URF, generating TURF from URF, generating URF from a Java instance tree, and manipulating URF in-memory. The reference implementation source code may be downloaded from the GlobalMentor Subversion repository at <https://svn.globalmentor.com/java/src/com/globalmentor/urf/>. The API documentation may be found at <http://www.guiseframework.com/doc/api/com/globalmentor/urf/package-summary.html>. The Guise Internet application framework [Guise] development library contains the URF reference implementation already compiled, and is available at <http://www.guiseframework.com/com.guiseframework-unlicensed.jar>.

GlobalMentor also maintains an online demonstration of live, dynamic URF processing and exploration. The demonstration uses the Guise Internet application framework [Guise] and allows TURF or RDF/XML to be processed and displayed as URF assertions, TURF, and a dynamic tree or resources and properties. This URF processing demonstration is available at <http://www.guiseframework.com/demo/urfprocess>.

Examples

JSON

In the JavaScript Object Notation (JSON) [RFC 4627], every object besides strings, numbers, and booleans are associative arrays using string keys. The following is a complex JSON object, using every JSON data type available:

{
"length":1234,
"valid":true,
"status":"processing",
"results":[false, 5, "dog", {"code":9.8}]
}

While this representation has some undesirable traits (e.g. strings are not recommended as general property identifiers except in the case of resources used as maps), the following TURF representation is semantically identical to the JSON example above:

`URF¤
:
"length"=#1234#,
"valid"=_true_,
"status"="processing",
"results"=[_false_, #5#, "dog", :"code"=#9.8#;]
;
.

Note that, unlike JSON, in TURF the commas separating the values are optional if the values appear on separate lines.

There is one slight semantic descrepancy between these two examples: URF uses a true ordinal property for each list element, while JSON adds each array element as the value of a string containing the lexical form of an integer.

Although the above TURF representation replicates the simple semantics of the given JSON example, a better formulation that takes advantage of URF semantics would most importantly use actual properties rather than associative array string key pseudo-properties. An improved formulation would also indicate the type of the resources. Such improvements are illustrated in the following reformulation (assuming the "code" string in the list was intended to actually be a key in a map):

`URF:
"urf"~<http://urf.name/urf/>
"example"~<http://example.com/example/>
;¤
*example.Class:
example.length=#1234#
example.valid=_true_
example.status="processing"
example.results=[_false_, #5#, "dog", 〔"code"=#9.8#〕]
;
.

PLOOP

The following TURF example uses URF as PLOOP for the Guise Internet application framework [Guise] using the Java programming language. It defines a panel of Guise components that allow temperature to be converted between Celsius and Fahrenheit. (The control listeners and temperature conversion logic would be defined elsewhere.)

`URF:
"component"~<java:/com/guiseframework/component/>
"layout"~<java:/com/guiseframework/component/layout/>
"validator"~<java:/com/guiseframework/validator/>
"demo"~<java:/com/guiseframework/demo/>
;¤
*demo.TemperatureConversionPanel2:
label="Guise™ Demonstration: Temperature Conversion"
layout=*layout.FlowLayout:
flow=«*layout.Flow("LINE")»
;
name="temperatureConversionPanel"
children=[
*component.LayoutPanel:
layout=*layout.FlowLayout:
flow=«*layout.Flow("PAGE")»
;
name="inputPanel"
children=[
*component.TextControl(«java:/java/lang/Double»):
label="Input Temperature"
name="temperatureInput"
validator=*validator.ValueRequiredValidator
;
*component.TextControl(«java:/java/lang/Double»):
editable=_false_
label="Output Temperature"
name="temperatureOutput"
;
]
;,
*component.LayoutPanel:
layout=*layout.FlowLayout:
flow=«*layout.Flow("PAGE")»
;
name="conversionPanel"
children=[
*component.GroupPanel:
label="Input Scale"
layout=*layout.FlowLayout:
flow=«*layout.Flow("PAGE")»
;
name="scalePanel"
children=[
*component.CheckControl:
checkType="ellipse"
label="Calsius"
name="celsiusCheckControl"
;
*component.CheckControl:
checkType="ellipse"
label="Fahrenheit"
name="fahrenheitCheckControl"
;
]
;
*component.Button:
label="Convert"
name="conversionButton"
;
]
;
]
;
.

The preceding example, when processed by an URF PLOOP processor, will produce an object instance graph identical to that produced by the following Java code:

import com.guiseframework.component.*;
import com.guiseframework.component.layout.*;
import com.guiseframework.validator.*;

DefaultNavigationPanel navigationPanel=new DefaultNavigationPanel();
navigationPanel.setName("temperatureConversionPanel");
navigationPanel.setLayout(new FlowLayout(Flow.LINE));
navigationPanel.setLabel("Guise\u2122 Demonstration: Temperature Conversion");

LayoutPanel inputPanel=new LayoutPanel(new FlowLayout(Flow.PAGE));
TextControl<Double> temperatureInput=new TextControl<Double>(Double.class);
temperatureInput.setName("temperatureInput");
temperatureInput.setLabel("Input Temperature");
temperatureInput.setValidator(new ValueRequiredValidator<Double>());
inputPanel.add(temperatureInput);

TextControl<Double> temperatureOutput=temperatureOutput=new TextControl<Double>(Double.class);
temperatureOutput.setName("temperatureOutput");
temperatureOutput.setLabel("Output Temperature");
temperatureOutput.setEditable(false);
inputPanel.add(temperatureOutput);

navigationPanel.add(inputPanel);

LayoutPanel conversionPanel=new LayoutPanel();
conversionPanel.setLayout(new FlowLayout(Flow.PAGE));

GroupPanel scalePanel=new GroupPanel();
scalePanel.setLayout(new FlowLayout(Flow.PAGE));

scalePanel.setLabel("Input Scale");
CheckControl celsiusCheckControl=celsiusCheckControl=new CheckControl();
celsiusCheckControl.setName("celsiusCheckControl");
celsiusCheckControl.setCheckType(CheckControl.CheckType.ELLIPSE);
celsiusCheckControl.setLabel("Celsius");
scalePanel.add(celsiusCheckControl);
CheckControl fahrenheitCheckControl=fahrenheitCheckControl=new CheckControl();
fahrenheitCheckControl.setName("fahrenheitCheckControl");
fahrenheitCheckControl.setCheckType(CheckControl.CheckType.ELLIPSE);
fahrenheitCheckControl.setLabel("Fahrenheit");
scalePanel.add(fahrenheitCheckControl);

conversionPanel.add(scalePanel);

Button convertButton=new Button();
convertButton.setName("conversionButton");
convertButton.setLabel("Convert");
conversionPanel.add(convertButton);
navigationPanel.add(conversionPanel);

RDF/XML

URF is a semantic superset of RDF, and can represent any construct available in RDF. URF presents equivalents of many RDF classes as well. In terms of representation formats, TURF can represent any semantic information that is available using [RDF/XML], yet is more flexible and has less restrictions. The following is a sample RDF/XML representation of an RDF data instance using many of the capabilities available in RDF/XML:

<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:example="http://example.com/example/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
>
<foaf:Person rdf:about="http://example.com/example#janedoe">
<foaf:nick xml:lang="pt-BR">Janinha</foaf:nick>
<example:age rdf:datatype="&xsd;integer">23</example:age>
<example:birthdate rdf:datatype="&xsd;date">1980-04-05</example:birthdate>
<example:motto rdf:parseType="Literal">Do it. Do it <xhtml:em>right</xhtml:em>.</example:motto>
<example:favoriteSites rdf:parseType="Collection">
<rdf:Description rdf:about="http://www.globalmentor.com/"/>
<rdf:Description rdf:about="http://www.garretwilson.com/"/>
</example:favoriteSites>
<example:possibleVacationDestinations>
<rdf:Alt>
<rdf:li>Paris</rdf:li>
<rdf:li>Rome</rdf:li>
</rdf:Alt>
</example:possibleVacationDestinations>
</foaf:Person>
</rdf:RDF>

The following URF information represented in TURF is semantically equivalent to the RDF information in the previous example represented in RDF/XML:

`URF:
"urf"~<http://urf.name/urf/>
"content"~<http://urf.name/content/>
"dc"~<http://purl.org/dc/elements/1.1/>
"example"~<http://example.com/example/>
"foaf"~<http://xmlns.com/foaf/0.1/>
;¤
example.janedoe*foaf.Person:
example.age=#23#
example.birthdate=@1980-04-05@
example.favoriteSites=[
«http://www.globalmentor.com/»
«http://www.garretwilson.com/»
],
example.motto="Do it. Do it <xhtml:em xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">right</xhtml:em>.":
content.type`=«*content.MediaType("text/xml-external-parsed-entity")»
;
example.possibleVacationDestinations={
"Paris",
"Rome"
}
nick="Janinha":
dc.language`=«*urf.Language("pt-BR")»
;
;
.

Note that, rather than use special literal types or general strings, URF promotes the representation of resources by URIs. Thus the language tag "pt-BR" for Brazilian Portuguese is represented as a resource with a URI in the urf.Language inline namespace, and the integer value 23 is represented as a resource with a URI in the urf.Integer inline namespace (shown here in its short form, #23#).

VCard

The URF VCard Ontology provides a representation of VCard [RFC 2426] within a semantic framework. The following is VCard information in traditional vCard MIME Directory Profile syntax as specified by [RFC 2426].

BEGIN:vCard
VERSION:3.0
FN:Jane Doe
N:Doe;Jane;Mary,Ann;Dr.;M.D.,Ph.D.
ORG:Example Corporation;North American Division;Business Development
TITLE:Directory of Business Development
ADR;TYPE=WORK,POSTAL,PARCEL:;Suite 45;123 Some Street;Someplace;CA;12345-6789;USA
LABEL="123 Some Street\nSuite 45\nSomeplace, CA 12345-6789"
TEL;TYPE=PREF;VOICE,WORK:+1-234-567-8910
TEL;TYPE=VOICE,HOME,CELL:+1-234-567-8911
EMAIL;PREF:janedoe@example.com
EMAIL:jdoe@example.org
URL:http://www.example.com/home/jane/
BDAY=1980-02-02T09:45:00
CATEGORY:Internet,B2B,P2P,Web2.0,ABCD
END:vCard

The same vCard information in its URF VCard formulation is shown below for the resource «http://example.com/example/janedoe». Note that the URF VCard version provides more semantics by using true classes and properties to describe what [RFC 2426] calls structured values.

`URF:
"vcard"~<http://urf.com/vcard/>
"example"~<http://example.com/example/>
;¤
example.janedoe:
vcard.fn="Jane Doe"
vcard.n=*vcard.Name:
vcard.familyName="Doe"
vcard.givenName="Jane"
vcard.additionalName=\"Mary", "Ann"\
vcard.honoraryPrefix="Dr."
vcard.honorarySuffix=\"M.D.", "Ph.D."\
;
vcard.org=\"Example Corporation", "North American Division", "Business Development"\
vcard.title="Directory of Business Development"
vcard.adr=*vcard.Adr:
vcard.adrType=«*vcard.AdrType("work")»
vcard.adrType=«*vcard.AdrType("postal")»
vcard.adrType=«*vcard.AdrType("parcel")»
vcard.extendedAddress="Suite 45"
vcard.streetAddress="123 Some Street"
vcard.locality="Someplace"
vcard.region="CA"
vcard.postalCode="12345-6789"
vcard.countryName="USA"
;
vcard.label="123 Some Street\nSuite 45\nSomeplace, CA 12345-6789"
vcard.tel=
\
«tel:+1-234-567-8910»:
vcard.telType`=«*vcard.TelType("voice")»
vcard.telType`=«*vcard.TelType("work")»
;
«tel:+1-234-567-8911»:
vcard.telType`=«*vcard.TelType("voice")»
vcard.telType`=«*vcard.TelType("home")»
vcard.telType`=«*vcard.TelType("cell")»
;
\
vcard.email=\<janedoe@example.com>, <jdoe@example.org>\
vcard.url=<http://www.example.com/home/jane/>
vcard.bday=@1980-02-02T09:45:00@
vcard.category="Internet"
vcard.category="B2B"
vcard.category="P2P"
vcard.category="Web2.0"
vcard.category="ABCD"
;
.

References

DCMI Namespace
Andy Powell and Harry Wagner. Namespace Policy for the Dublin Core Metadata Initiative (DCMI). Dublin Core Namespace Initiative, 2007.
Guise
Guise™ Internet Application Framework. GlobalMentor, Inc.
IANA Charset Registry
IANA Charset Registry. Internet Assigned Numbers Authority.
ISO 8601
ISO 8601:2004(E): Data elements and interchange formats — Information interchange — Representation of dates and times. International Organization for Standardization, 2004-12-01.
RDF/XML
Dave Beckett. RDF/XML Syntax Specification (Revised). World Wide Web Consortium, 2006-02-10.
RFC 2046
N. Freed and N. Borenstein. RFC 2046: Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types. Internet Engineering Task Force, 1996.
RFC 2130
C. Weider, C. Preston, K. Simonsen, H. Alvestrand, R. Atkinson, M. Crispin, and P. Svanberg. RFC 2130: The Report of the IAB Character Set Workshop held 29 February - 1 March, 1996. Internet Engineering Task Force, 1997.
RFC 2278
N. Freed and J. Postel. RFC 2278: IANA Charset Registration Procedures. Internet Engineering Task Force, 1998.
RFC 2426
F. Dawson and T. Howes. RFC 2426: vCard MIME Directory Profile. Internet Engineering Task Force, 1998.
RFC 2445
F. Dawson and and D. Stenerson. RFC 2445: Internet Calendaring and Scheduling Core Object Specification (iCalendar). Internet Engineering Task Force, 1998.
RFC 3339
G. Klyne and C. Newman. RFC 3339: Date and Time on the Internet: Timestamps. Internet Engineering Task Force, 2002.
RFC 3966
H. Schulzrinne. RFC 3966: The tel URI for Telephone Numbers. Internet Engineering Task Force, 2004.
RFC 3986
T. Berners-Lee, R. Fielding, and L. Masinter. RFC 3986: Uniform Resource Identifier (URI): Generic Syntax. Internet Engineering Task Force, 2005.
RFC 4627
D. Crockford. RFC 4627: The application/json Media Type for JavaScript Object Notation (JSON). Internet Engineering Task Force, 2006.
RFC 4646
A. Phillips and M. Davis. RFC 4646: Tags for Identifying Languages. Internet Engineering Task Force, 2006.
RFC 4648
S. Josefsson. RFC 4648: The Base16, Base32, and Base64 Data Encodings. Internet Engineering Task Force, 2006.
Unicode BOM FAQ
Asmus Freytag and Mark Davis. Unicode Byte Order Mark (BOM) FAQ. Unicode, Inc., Retrieved 2006-06-07.
UTR #13
Mark Davis. Unicode Technical Report #13: Unicode Newline Guidelines. Unicode, Inc., 1999.
XML Schema 2
Paul V. Biron and Ashok Malhotra. XML Schema Part 2: Datatypes Second Edition. World Wide Web Consortium, 2004-10-28.

Acknowledgements

Brad Neuberg encouraged the creation of an alternate RDF serialization; Frank Manola made convincing arguments for using ordinals instead of integers as list element predicates.

History

2009-09-06
  • Change namespace URI rules to only allow namespace URIs that are collection URIs.
  • Renamed "lexical namespace/URI" to "inline namespace/URI" and improved the corresponding semantics.
  • Renamed urf.Real to urf.Rational.
2009-08-24
  • Changed grammar to allow Unicode newline characters as separators.
  • Changed TURF content type to text/urf.
2008-01-20
  • Improved semantics of urf.Map by adding map entries to distinguish between properties and map key/value associations.
  • Added delimiters for urf.Map TURF short form.
  • Changed delimiter of urf.Boolean TURF short form.
  • Modified urf.type TURF short form syntax.
  • Introduced urf.selector property with TURF short form.
  • Removed urf.inits property.
  • Documented urf.subClassOf and urf.implementationOf properties.
  • Added TURF superclass and interface short forms.
  • Renamed content.CharacterEncoding to content.Charset.
2007-12-31
  • Added content.CharacterEncoding class.
  • Renamed URF reference implementation Java package.
2007-12-23
  • Changed TURF preamble delimiters.
  • Changed TURF namespace association delimiter.
  • Changed syntax for urf.Boolean short form.
  • Changed order of string and type in TURF lexical form reference.
  • Brought back requirement for ending delimiters for TURF number, temporal, and ordinal short representations to prevent an ambigious grammar.
2007-11-22
  • Changed syntax for urf.Boolean short form.
  • Changed the TURF preface delimiter.
2007-11-18
  • Added TURF preamble.
  • Improved TURF name grammar.
  • Simplified TURF name namespace inheritance rules.
  • Changed urf.MediaType to content.MediaType.
  • Simplified PLOOP processing rules.
  • Addressed merging of ordered properties.
  • Changed syntax for urf.Enum value declarations.
  • Introducted urf.Community.
  • Reframed semantics of scoped properties in terms of URF communities.
  • Added urf.Proposition short form.
  • Changed comment syntax.
  • Expanded rules for URI namespace determination.
  • Changed syntax for urf.Boolean short form.
2007-10-16
  • Changed order of TURF properties declaration.
  • Added urf.init property.
  • Added PLOOP specification.
  • Improved and clarified TURF namespace inheritance rules.
  • Added list of ontologies along with links to their TURF definitions.
  • Added RDF/XML example.
  • Added PLOOP example.
  • Added reference implementation links.
  • Improved and simplified TURF URI and URI reference lexical form representation.
  • Clarified and extended urf.Temporal types.
  • Changed base lexical namespace URI to <http://urf.name/lexical/>.
  • Added urf.Language type.
  • Added urf.MediaType type.
  • Changed PLOOP example to use java: URIs.
  • Removed trailing delimiter from TURF temporal short forms.
  • Added urf.Enum description.
2007-10-05
  • Added TURF Internet media type.
  • Removed requirement that TURF strings must escape control characters.
  • Added period to set of name characters.
  • Added comments to TURF.
  • Clarified and expanded TURF Unicode control escape sequences.
  • Clarified and expanded namespace rules.
  • Added urf.Binary type.
  • Added urf.Ordinal type.
  • Changed arrays to use ordinal indexes.
  • Removed trailing delimiter from TURF number short forms.
  • Removed trailing delimiter from TURF boolean short forms.
  • Changed TURF boolean short form delimiter.
  • Changed TURF name short form prefix delimiter.
  • Changed TURF properties section delimiter.
  • Improved TURF name grammar.
  • Added urf.Set type.
  • Renamed urf.Array to urf.List.
  • Clarified TURF name reference namespace inheritance.
2007-09-15
  • Switched to info:lexical lexical namespaces.
2007-09-14
  • Added name reference short form.
  • Modified syntax for sequences.
  • Switched to info:lexis lexical namespaces.
  • Changed property type for array indexes.
  • Clarified number types.
  • Added delimiters to boolean and number types.
  • Added the ID namespace.
  • Clarified array grammar.
  • Added URF abstract model grammar.
  • Added JSON example.
2007-09-08
  • Modified and simplified syntax for resource URI references and type declarations.
  • Changed contextual properties to scoped properties.
2007-09-02
  • First public release of URF.