Wilbur: DAML
-
DAML Parser as an Extension of the RDF Parser
-
Constructing DAML Lists
-
URI Constants
1. DAML Parser as an Extension of the RDF Parser
daml-parser [Class]
This class implements a DAML parser (technically a DAML+OIL
December 2000 parser), as an extension (i.e., a subclass) of the Wilbur
RDF parser (class rdf-parser).
The extension basically consists of a new state (:daml-collection)
in the parser's state machine to handle the "daml:collection"
parse type, and specializations of four methods: parse-using-parsetype
(which forces the the parser's state machine into the :daml-collection
state), attach-to-parent
(which "grows" a DAML-list from the end when the parser is in the :daml-collection
state), as well as nox:start-element
and nox:end-element
(which handle the transitions to and from the :daml-collection
state; nox:end-element
also terminates the DAML list by replacing the last, incomplete node with
a reference to daml:nil).
The daml-parser class can be used in place of the rdf-parser
class in all functions which accept this class (namely parse-db-from-file
and parse-db-from-stream).
2. Constructing DAML Lists
DAML lists are essentially similar in structure to Common Lisp lists as
they consist of dotted pairs (nodes with properties daml:first
and daml:rest). Consequently we have
defined two functions, daml-list
and daml-cons, that are equivalent
to the Common Lisp functions
list and cons. Converting
daml-list (&rest items) [Function]
This function takes an arbitrary number of (Common Lisp) objects and constructs
a DAML list. The head of this list (a node
instance) is returned. Lists are terminated with a reference to -daml-nil-.
If you want to turn an existing (Common Lisp) list into a DAML list,
use
(apply #'daml-list list)
daml-cons (first rest &optional
uri)
[Function]
This function takes two Common Lisp objects, first and rest
(in practice, rest should be a node instance) and constructs
a DAML "dotted pair" (a node
instance, which is returned).
3. URI Constants
The system defines a set of constants for useful DAML URIs (strings). In
the following table, the prefix "daml" is assumed to denote the
value of -daml+oil-uri-.
Constant |
Value |
-daml+oil-uri- |
"http://www.daml.org/2000/12/daml+oil#" |
-daml-list-uri- |
daml:List |
-daml-first-uri- |
daml:first |
-daml-rest-uri- |
daml:rest |
-daml-nil-uri- |
daml:nil |
Copyright © 2001 Nokia. All Rights Reserved.
Subject to the NOKOS License version 1.0
Author: Ora Lassila (ora.lassila@nokia.com)