URF is a framework for storing resources and their descriptions. Here URF is shown using TURF, the text-based URF format.
The following is the string example:
"example"
Here is an ordered list containing strings:
["first", "second", "third"]
Next is an unordered set containing a string, a character, an integer, a rational, and a Boolean:
{"example", 'x', #123#, #123.45#, _true_}
The following is a map that associates keys with values. Here the map is associating words with the ordinals those words represent:
〔º1º="first", º2º="second", º3º="third"〕
The same map can be formatted in a more readable way by inserting whitespace and replacing the commas with Unicode newline characters:
〔
º1º="first"
º2º="second"
º3º="third"
〕
Similar to a map, an unnamed (anonymous) resource can be described using property-value pairs. Rather than a simple mapping, this resource description represents properties and their corresponding values describing the resource. For example, a single resource with its properties could be used as an application configuration file.
The following anonymous resource description uses properties in the default URF namespace. It also introduces two other types: URI and date.
:
showSplash=_false_
maxUsers=#3#
homePage=<http://www.example.com/>
expirationDate=@2123-12-31@
;
The following is another URI, http://example.com/example/janedoe:
<http://example.com/example/janedoe>
The following is the actual describable resource identified by the URI http://example.com/example/janedoe:
«http://example.com/example/janedoe»
That resource may be stored in a TURF interchange document:
`URF¤
«http://example.com/example/janedoe»
.
If the resource is in a namespace, the URI reference can be replaced with a name reference. Namespaces are declared in a TURF preamble section surrounded by the colon ':' and semicolon ';' characters, separated by commas using the tilde character '~' to associate the namespace prefix with the namespace URI. The following example identifies the same resource as in the previous example.
`URF:
"example"~<http://example.com/example/>
;¤
example.janedoe
.
The following is the same resource with a type of foaf.Person and with other properties declared. Strings and numbers are resources and can themselves be described. The salary value resource is given a scoped property indicating the currency. The currency resource is identified using an inline URI in the inline namespace for the example.Currency type. Comments begin with a dagger and end with a double dagger.
`URF:
††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††
†
† This is an example TURF interchange document.
†
††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††‡
†declare the example and FOAF namespaces‡
"example"~<http://example.com/example/>
"foaf"~<http://xmlns.com/foaf/0.1/>
;¤
†describe a FOAF person identified by the URI <http://example.com/example/janedoe>‡
example.janedoe*foaf.Person:
example.name="Jane Doe"
example.birthday=@1980-01-01@
example.salary=#1000000#:
example.currency`=«*example.Currency("usd")»
;
;
.
The following is semantically equivalent to the preceding example but uses long URI references and no comments:
`URF¤
«http://example.com/example/janedoe»:
«http://urf.name/urf/type»=«http://xmlns.com/foaf/0.1/Person»
«http://example.com/example/name»=«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23String/%22Jane%20Doe%22»
«http://example.com/example/birthday»=«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Date/%221980-01-01%22»
«http://example.com/example/salary»=«http://urf.name/inline/http%3A%2F%2Furf.name%2Furf%23Integer/%221000000%22»:
«http://example.com/example/currency»`=«http://urf.name/inline/http%3A%2F%2Fexample.com%2Fexample%23Currency/%22usd%22»
;
;
.
This is the proposition, "The moon is made of cheese," using the default namespace in place of some formal ontology. Note that a proposition uses curly double quotes instead of the double-quote character.
“moon, madeOf, cheese”
It can be asserted that Little Johnny believes the moon is made of cheese:
littleJohnny:
believes=“moon, madeOf, cheese”
;
It can also be asserted that the moon is made of cheese and that Little Johnny believes this to be true:
moon:
madeOf|cheeseMoon|=cheese
;
littleJohnny:
believes=|cheeseMoon|
;
The following indicates that a knowledge community long ago held the moon to be made of cheese:
community*urf.Community:
when=longAgo
;{
“moon, madeOf, cheese”
}
The following example is semantically identical to the previous one but uses the community short form:
community*urf.Community:
when=longAgo
;¤
moon:
madeOf=cheese
.
The following example is semantically identical to the previous one but uses a formal ontology with the namespace prefix example, and places the entire set of propositions in a TURF interchange document:
`URF:
"urf"~<http://urf.name/urf/>
"example"~<http://example.com/example/>
;¤
example.community*urf.Community*:
example.when=example.longAgo
;¤
example.moon:
madeOf=example.cheese
.
.