Common Lisp Package: CL-RDFXML

The cl-rdfxml package provides functionality for processing RDF/XML representations of RDF graphs. RDF/XML processes XML using Closure XML (CXML) and handles URIs using PURI.

README:

FUNCTION

Public

BLANK-NODE (&OPTIONAL (ID NIL IDP) (NAMESPACE *BLANK-NODES*))

blank-node [id [namespace]] => blank-node id---a string namespace---an equal hash-table Blank-node returns a blank node. If id is specified, then if there is already a blank node in namespace whose id is equal to id, then that blank node is returned. Otherwise, a new blank node is created, inserted into namespace, and returned. If id is not specified, then a new blank node is returned, and namespace is not modified.

IGNORE-ATTRIBUTE (&OPTIONAL CONDITION)

ignore-attribute [condition] => | condition---a condition Ignore-attribute attempts to invoke the restart named ignore-attribute. This is intended for use when an attribute appears in a place where it is prohibited, but parsing would continue successfully if the attribute had not been specified.

IGNORE-ATTRIBUTES (&OPTIONAL CONDITION)

ignore-attributes [condition] => | condition---a condition Ignore-attributes attempts to invoke the restart named ignore-attributes. This is intended for use when duplicate attributes are provided and all can be ignored, or when mutually exclusive attributes appear, and all can be ignored.

IGNORE-CHARACTERS (&OPTIONAL CONDITION)

ignore-characters [condition] => | condition---a condition Ignore-characters attempts to invoke the restart named ignore-characters. This is intended for use when character data appears in a place that should have been whitespace.

IGNORE-LANGUAGE (&OPTIONAL CONDITION)

ignore-language [condition] => | condition---a condition Ignore-language treats a xml:lang attribute whose value was not a language tag conforming to RFC 3066 as though the attribute had not been specified. This occurs by invoking the restart ignore-language.

INTERN-PLAIN-LITERAL (STRING &OPTIONAL (LANGUAGE NIL))

intern-plain-literal string [language] => plain-literal string, language---strings plain-literal---a plain literal Intern-plain-literal returns a literal with the specified string and language. Calls to intern-plain-literal with strings that are equal and languages that are equal return the same literal object.

INTERN-TYPED-LITERAL (STRING DATATYPE)

intern-plain-literal string datatype => typed-literal string---a string datatype---a URI designator typed-literal---a typed literal intern-typed-literal returns a literal with the specified string and datatype. Calls to intern-plain-literal with strings that are equal and designators for the same URI return the same literal object.

PARSE-AS-TYPED-LITERAL (&OPTIONAL CONDITION)

parsed-as-typed-literal [condition] => | condition---a condition parse-as-typed-literal attempts to parse an empty-property-element as typed literal. This is intended to be used when an rdf:datatype attribute is present on an empty property element. Strictly speaking, this is prohibited by the RDF/XML specification (see errata), but some RDF/XML parses output it anyway.

PARSE-DOCUMENT (FUNCTION INPUT &KEY ((COERCE-DATATYPED-EMPTY-PROPERTIES *COERCE-DATATYPED-EMPTY-PROPERTIES*) *COERCE-DATATYPED-EMPTY-PROPERTIES*) ((PARSE-URIS-STRICTLY *PARSE-URIS-STRICTLY*) *PARSE-URIS-STRICTLY*) ((WARN-ON-RDF-PREFIXED-NON-RDF-NAMES *WARN-ON-RDF-PREFIXED-NON-RDF-NAMES*) *WARN-ON-RDF-PREFIXED-NON-RDF-NAMES*) ((WARN-ON-NON-NAMESPACED-NAMES *WARN-ON-NON-NAMESPACED-NAMES*) *WARN-ON-NON-NAMESPACED-NAMES*) ((WARN-ON-PARSE-TYPE-OTHER *WARN-ON-PARSE-TYPE-OTHER*) *WARN-ON-PARSE-TYPE-OTHER*))

parse-document function input => | function---a function of three arguments input---an input suitable for cxml:make-source Parse-document parses input, binds *triple-receiver* to function, and calls emit-triple with each triple that can be extracted from the input. *blank-nodes* is rebound to a new equal hash table and maps blank node identifiers to their blanks nodes. If the document element is rdf:RDF, then its children are processed as node elements, otherwise, the body of the document is parsed as a sequence of node elements.

PARSE-URI-NON-STRICTLY (CONDITION)

parse-uri-non-strictly condition => result* condition---a condition Parse-uri-non-strictly is a restart function that invokes the restart named parse-uri-non-strictly. If no such restart is available, parse-uri-non-strictly returns NIL, otherwise the results of invoking the restart are returned.

Private

ADD-FRAGMENT (ID BASE)

add-fragment id base => interned-uri id---a uri fragment id base---a uri designator Add-fragment merges "#<id>" with base, and returns the result of interning the merged URI.

ATTRIBUTE-URI (ATTRIBUTE SOURCE)

attribute-uri attribute source => uri attribute---a sax:attribute source---a cxml:source uri---a PURI uri Attribute-uri returns the URi associated with the attribute, as described by Section 6.1.4 Attribute Event in the RDF/XML Syntax specification. In general this is the concatenation of the namespace URI with the local name. If no namespace is provided, and the local name is ID, about, resource, parseType, or type, then the corresponding RDF term URI is returned. Otherwise, an error is signalled.

CHECK-FOR-ILLEGAL-NAMESPACE-NAMES (ATTRIBUTES)

check-for-illegal-namespace-names attributes => | attributes---a list of attributes check-for-illegal-namespace-names enforces the restriction of Section 5.1 of the RDF/XML Syntax Specification that states that "within RDF/XML documents it is not permitted to use XML namespaces whose namespace name is the RDF namespace URI reference concatenated with additional characters." If such a namespace binding is encountered, an error of type illegal-namespace-name is signalled.

CONSUME-WHITESPACE (SOURCE)

consume-whitespace source => | source---a cxml source Consume-whitespace peeks and consumes events from source while the events are of type :characters and the associated string satisfies xml-whitespace-p, or if the event is :comment.

CORE-SYNTAX-TERM-P (OBJECT)

core-syntax-term-p object => boolean core-syntax-term-p returns true if object is in +core-syntax-terms+.

CURRENT-POSITION (SOURCE)

current-position source => position source---a cxml:source position---a string Current-position returns a string of the form <line>.<column> indicating the approximate position of source.

ELEMENT-ATTRIBUTES (SOURCE)

element-attributes source => attributes source---a cxml:source attributes---an alist Element-attributes returns an association list whose keys are the attribute URIs of the attributes of the current element and whose values are the corresponding values. The attributes used in RDF/XML are the atributes of the element, except that xml attributes are removed (those satisfying xml-attribute-p) according to Section 6.1.2 "Element Event" in the RDF/XML Syntax Specification.

ELEMENT-LITERAL-CONTENT (SOURCE &KEY (CONSUME-END T))

element-literal-content source &key consume-end => content source---a cxml:source content---a string consume-end---a boolean Element-literal-content returns a string that is the literal content of the of element at source. The current event of source should be :start-element of the element whose literal content is to be extracted. The corresponding :end-element is consumed if consume-end is non-nil (the default).

ELEMENT-URI (SOURCE)

element-uri source => uri source---a cxml:source uri---a URI Element-uri returns the result of interning the concatenation of the current element's uri and lname. Element-uri calls klacks:current-uri and klacks:current-lname, which signal an error if the current event is not :start-element or :end-element.

EMIT-TRIPLE (&KEY (SUBJECT *SUBJECT*) (PREDICATE *PREDICATE*) (OBJECT *OBJECT*))

emit-triple &key subject predicate object => value* subject, predicate, object---objects Emit-triple calls the value of *triple-receiver* with the three values subject, predicate, and object. subject, predicate, and object, if not provided, default, respecively, to *subject*, *predicate*, and *object*.

EMPTY-PROPERTY-ELEMENT (SOURCE ATTRIBUTES)

empty-property-element source attributes => | source---a cxml:source attributes---an alist Processes an empty property element, emitting the appropriate triples for property attributes on the element, as well as the triple of which the empty property is the object. The triple of which the empty property element is the object is also reified when the ID attribute is present.

EMPTY-PROPERTY-ELEMENT-COMPONENTS (SOURCE ATTRIBUTES)

empty-property-element-components source attributes => pattributes, id, thing source---a cxml:source attributes, pattributes---association lists id---a PURI uri or nil thing---a indicator of the empty property element Empty-property-element-components returns as multiple values the property attributes of the element (as an association list), an id corresponding to the element (which is NIL if no ID was provided), and an indicator of the element, which is either a plain literal with the empty string as its lexical component, a blank node, or a URI.

ENSURE-NON-REPEATED-ID (ATTRIBUTES SOURCE)

ensure-non-repeated-id attributes => new-attributes attributes, new-attributes---association lists Ensure-non-repeated-id ensures that if the association list attributes contains a value for the key rdf:ID, that *element-ids* does not currently map value to t, that is, that the element has not appeared on another element. If there is an rdf:ID value and it has already been specified on another element, restarts include using this value anyway, ignoring the rdf:ID attribute, and using a different value. In any of the cases that an ID is eventually specified, *element-ids* is updated to include the new ID.

EXPANDED-LI-URI

expanded-li-uri => uri uri---a puri:uri Expanded-li-uri returns the uri generated by incrementing the current element's parent's li counter and adding the fragment _n (where n is the incremented counter) to the RDF namespace.

ID-NAME-P (STRING)

id-name-p string => boolean string---a string Id-name-p returns true if string is a valid XML NCName, which are the only valid names attribute values for rdf:ID and rdf:nodeID.

IMMEDIATE-XML-LANG (SOURCE)

immediate-xml-lang source => result source---a cxml:source result---a string or nil Immediate-xml-lang returns the value of the xml:lang attribute on the source. Source's current event should be :start-element. If the attribute is specified, its value, a string, is returned. If the attribute is not specified, nil is returned.

INTERN-URI (XURI)

intern-uri xuri => uri xuri---a uri designator uri---a puri:uri Intern URI is a wrapper around puri:intern-uri that provides a use-value restart, so that a new uri designator can be provided.

LANGUAGE-TAG-P (STRING)

language-tag-p string => boolean string---a string language-tag-p return true if the designated string is in the form specified by RFC-3066. the general form of such a language tag is <ALPHA>{1,8} ['-' [<ALPHA> | <DIGIT>]{1,8}]*, that is, a string of at least 1 and at most 8 alphabetic characters followed by any number of subtags that are a hypen followed by at least 1 and at most 8 alphabetic or digit characters. RFC-3066 also specifies what particular strings may appear based on country codes, etc., but these constraints are not enforced here.

LITERAL-PROPERTY-ELEMENT (SOURCE ATTRIBUTES TEXT)

literal-property-element source attributes text => | source---a cxml:source attributes---an alist text---a string Literal-property-element emits the triple corresponding to the literal property element. Text is the literal text of the literal property. Attributes is the alist of attributes of the property-element that originally contained text.

MEMBERSHIP-FRAGMENT-P (FRAGMENT)

membership-fragment fragment => boolean fragment---a string or NIL Membership-fragment-p returns true if fragment is of the form "_n where n is a decimal integer greater than zero with no leading zeros." (RDF/XML Syntax Specification, Section 5.1)

MEMBERSHIP-PROPERTY-ELEMENT-P (XURI)

membership-property-element-p xuri => boolean xuri---a uri designator Membership-property-element-p returns true if the designated URI is either rdf:li or of the form rdf:_n where n standard for a sequence of base-10 digits.

MERGE-URIS (URI BASE)

merge-uris uri base => interned-uri uri, base---uri designators interned-uri---a uri merge-uris is a convenience function that merges uri and base and interns the result.

NODE-ELEMENT (SOURCE)

node-element source => node source---a cxml source Node-element processes the source's current node. Source should be at a :start-element, and the element should correspond to a node. Triples represented in the node will be emitted. The node is returned.

NODE-ELEMENT-COMPONENTS (SOURCE)

node-element-components source => property-attributes, this source---a cxml:source property-attributes---an alist this---a blank node or a URI Node-element-components returns an alist of the property-attributes on the element at which source should be positioned, and a blank node or URI indicating the object that this node element represents. At most one of rdf:ID, rdf:nodeID, and rdf:about should be specified, and an error is signalled if more than one is specified. An error is also signalled if any the URI of any attribute is not a valid property-attribute URI.

NODE-ELEMENT-LIST (SOURCE &KEY (COLLECT NIL))

node-element-list source &key collect => [nodes] source---a cxml-source Node-element-list processes a node element list, corresponding to production 7.2.10, ws* (nodeElement ws*)*. If collect is non-nil, then the nodes are collected and returned.

NODE-ELEMENT-SUBJECT (THIS SOURCE)

node-element-subject this base => result this---a cons, or nil source---a cxml:source Node-element-subject returns the object designated by this (the second return value of node-element-attributes) and base. If this is null, then a blank-node is returned. Otherwise, the car of this should be either +rdf-node-id+, +rdf-about+, or +rdf-id+, and result is determined as follows: If the uri is +rdf-node-id+, then a blank node with an id is returned, where the id is the cdr of this. If the uri is +rdf-about+, then the cdr of the this is mergedd with base. If uri is +rdf-id+, then the cdr of this is added as a fragment to base.

NODE-ELEMENT-URI-P (XURI &AUX (URI (INTERN-URI XURI)))

node-element-uri-p xuri => boolean xuri---a URI designator Node-element-uri-p determines whether the designated URI is a valid node element URI. Node element URIs are all URIs except core syntax terms, rdf:li, and old RDF terms.

NON-PARSE-TYPE-PROPERTY-ELEMENT (SOURCE)

non-parse-type-property-element source => | source---a cxml:source If a property element does not specify the rdf:parseType attribute, then the property-element is parsed with either resource-property-element, literal-property-element, or empty-property-element. Resource-property-element matches in the case that there is a single element within the property-element, literal-property-element matches when there is only text content within the property-element, and empty-property-element matches when there is no content whatsoever within the property-element.

OLD-TERM-P (OBJECT)

old-term-p object => boolean old-term-p returns true if object is in +old-terms+.

PARSE-TYPE-COLLECTION-PROPERTY-ELEMENT (SOURCE)

parse-type-collection-property-element source => | source---a cxml source parse-type-collection-property-element processes the content of a property element that has parseType="Collection". Triples are emitted that describe the sequence of nodes within the property element.

PARSE-TYPE-LITERAL-PROPERTY-ELEMENT (SOURCE)

parse-type-literal-property-element source => | source---a cxml source Parse-type-literal-property-element binds *object* to a typed literal whose type is rdf:XMLLiteral, and whose content is the text content of the current element. If the current element has an rdf:ID attribute, then the triple is reified with the ID.

PARSE-TYPE-PROPERTY-ELEMENT-ID (SOURCE &AUX (ID NIL))

parse-type-property-element-id source => id source---a cxml:source id---a URI or nil Elements that specify the rdf:parseType attribute may only have one other attribute, rdf:ID. This function extracts the value of the rdf:ID attribute if specified and returns a URI which is the base uri with the value of the ID attribute as a fragment id or nil if there is no such attribute. An error is signalled if rdf:ID is specified more than once, or if an attribute other than rdf:parseType or rdf:ID is specified.

PARSE-TYPE-RESOURCE-PROPERTY-ELEMENT (SOURCE)

parse-type-resource-property-element source => | source---a cxml source parse-type-resource-property-element processes a property element with parseType Resource, according to production 7.2.18.

PEEK-SKIPPING-COMMENTS (SOURCE)

peek-skipping-comments source => result* souce---a cxml:source Peek-skipping-comments returns the same values that klacks:peek returns, with the exception that if the next event from source is :comments, the event is consumed. The values of the first non-comment event are returned.

PREFIXP (PREFIX SEQUENCE &KEY (TEST 'EQL))

prefixp prefix sequence => boolean, properp prefix, string---sequences properp---a boolean prefixp returns true if prefix is a prefix of sequence. Elements of prefix and sequence are compared using test. A second value, properp, is true when the length of the prefix is less than the length of the sequence, regardless of whether prefix is actually a prefix of sequence.

PROMPT-FOR-LINE (MESSAGE &REST ARGS)

prompt-for-line message &rest args => line, okp message---a format control args---format arguments for message line---a string okp---a boolean Prompt-for-line displays the prompt specified by message and args on *query-io* and reads a line from *query-io*. If the reading is successful, the line is returned and okp is true. If reading fails, say, from an EOF, then line is the empty string, and okp is false.

PROMPT-FOR-URI

prompt-for-uri => result result---a list of two values. prompt-for-uri returns the list of values that result from invoking prompt-for-line with the message "Enter a URI:".

PROPERTY-ATTRIBUTE-URI-P (XURI &AUX (URI (INTERN-URI XURI)))

property-attribute-uri-p xuri => boolean xuri---a URI designator Property-attribute-uri-p determines whether the designated URI is a valid property attribute URI. Property attribute URIs are all URIs except core syntax terms, rdf:Description, rdf:li, and old RDF terms.

PROPERTY-ELEMENT (SOURCE)

property-element source => | source---a cxml source Property-element processes the current property element, according to production 7.2.14. There are actually a number of different kinds of property elements that can appear, and so process-property element processes enough of the element to determine which type, and then dispatches to more specific property element processing functions.

PROPERTY-ELEMENT-LIST (SOURCE)

property-element-list source => | source---a cxml source Property-element-list processes a property element list, corresponding to production 7.2.13, ws* (propertyElt ws*)*.

PROPERTY-ELEMENT-URI-P (XURI &AUX (URI (INTERN-URI XURI)))

property-element-uri-p xuri => boolean xuri---a URI designator Property-element-uri-p determines whether the designated URI is a valid property element URI. Property element URIs are all URIs except core syntax terms, rdf:Description, and old RDF terms.

RDF-NAME-P (XURI)

rdf-name-p xuri => boolean xuri---a URI designator Rdf-name-p returns true if the designated URI is an RDF name, including the infinite set of rdf:_n names.

RDF-NAMESPACE-PREFIXED-P (XURI)

rdf-namespace-prefixed xuri => boolean xuri---a uri designator Rdf-namespace-prefixed-p returns true if xuri is prefixed with +rdf-namespace+.

REIFY-TRIPLE (TRIPLE-URI)

reify-triple triple-uri => | triple-uri---a PURI URI Reify-triple emits the four triples that reify the triple <*subject* *predicate* *object*>. Triple-uri is the URI of the reified triple.

RESOURCE-PROPERTY-ELEMENT (SOURCE ATTRIBUTES)

resource-property-element source attributes => | source---a cxml:source attributes---an alist resource-property-element finished the processing of a resource property element that should have begun with non-parse-type-property-element. source should be positioned at the :start-element of the node element within the property-element. resource-property-element does not consume trailing whitespace after the node element. The only attribute permitted on the resource property-element is rdf:ID, and an error is signalled if other attributes are specified, or rdf:ID is specified more than once.

STRCAT (&REST STRINGS)

strcat string* => string strings, string---strings strcat returns the concatentation of the strings.

SYNTAX-TERM-P (OBJECT)

syntax-term-p object => boolean syntax-term-p returns true if object is a syntax term (a core syntax term, rdf:Description, or rdf:li).

UNIQUE-ATTRIBUTES (ATTRIBUTES SOURCE)

unique-attributes attributes source => uniques attributes, uniques---associaation lists source---a cxml:source Unique-attributes returns an association list that no entries with the same key. The entries of the new association list are those of the original association list, but in the event that a duplicate is detected, an error of type duplicate-attribute is signalled, and various options are provided.

XML-ATTRIBUTE-P (ATTRIBUTE)

xml-attribute-p attribute => boolean attribute---a sax:attribute Xml-attribute-p returns true if attribute has a prefix that begins with "xml", or if the attribute has no prefix and the attribute's local name begins with "xml". or if attribute satisfies xml-lang-attribute-p.

XML-LANG-ATTRIBUTE-P (ATTRIBUTE)

xml-lang-attribute-p attribute => boolean attribute---a sax:attribute xml-lang-attribute-p returns true if attribute has a local-name "name" and a namespace-uri +xml-namespace+.

XML-WHITESPACE-P (STRING)

xml-whitespace-p string => boolean string---a string-designator xml-whitespace-p returns true if every element of the string is an XML whitespace character (i.e., is #x20, #x9, #xD, or #xA), or if string is the empty string.

MACRO

Private

DEFINE-PREFIXED-NAME (NAME PREFIX SUFFIX)

define-prefixed-name name prefix suffix name---a symbol, not evaluated prefix, suffix---evaluated to produce strings Define-prefixed-term defines name as a constant. The value of the constant is an interned puri URI generated by concatenating the strings designated by prefix and suffix.

DEFINE-RDF-TERM (NAME SUFFIX)

define-rdf-term name suffix name---a symbol, not evaluated suffix---evaluated to produce a string designator define-rdf-term defines name as a constant. The value of the new constant is a PURI uri constructed by concatenating +rdf-namespace+ and the suffix.

DEFINE-RDFS-TERM (NAME SUFFIX)

define-rdfs-term name suffix name---a symbol, not evaluated suffix---evaluated to produce a string designator define-rdfs-term defines name as a constant. The value of the new constant is a PURI uri constructed by concatenating +rdfs-namepsace+ and the string designated by suffix.

DOALIST (((KEY VALUE &OPTIONAL (PAIR (MAKE-SYMBOL PAIR))) LIST &OPTIONAL (RESULT NIL)) &BODY BODY)

doalist ((key value [pair]) list-form [result-form]) {tag | statement}* => result* key, value, pair---symbols list-form, result-form,, statement---forms tag---a go tag; not evaluated results---if a return or return from form is executed, the values passed from that form; otherwise, the values returned by the result-form or nil if there is no result form. Doalist iterates over the keys and values (and conses) in an association list. The body of doalist is like a tagbody. doalist is similar to a dolist, but rather than binding a single variable to each element of a list, doalist binds key and value to the car and cdr of each cons in an association list, and pair to the cdr.

EXPECTING-ELEMENT ((SOURCE &OPTIONAL (LNAME NIL LNAMEP) (URI NIL URIP)) &BODY BODY)

expecting-element (source [lname [uri]]) form* expecting-element is a wrapper around klacks:expecting element that ensures proper binding of the *current-xml-lang* variable, so that plain literals can properly inherit the value of xml:lang attributes. Within this RDF/XML parser, expecting-element should always be used rather than klacks:expecting-element.

WITH-ALIST-RESTARTS ((THING ALIST) RESTARTABLE-FORM &BODY BODY)

with-alist-restarts (thing alist) form &body body thing---a symbol alist---an association list restartable-form---a form body---forms With-alist-restarts evaluates restartable form within a dynamic context in which a restart is established for each entry in alist. If the restart corresponding to an entry is invoked, then thing is bound to the entry's cons cell, and body is evaluated, and the result of body is the result of the form. If restartable-form does not signal an error, then the result is the result of restartable form.

WITH-XML-LANG (LANG &BODY BODY)

with-xml-lang lang form* With-xml-lang evalutes lang to generate a new language, and evalutes body with a new binding of *current-xml-lang*. If the result of evalating lang is null, then *current-xml-lang* is rebound to its current value, if it is "", then *current-xml-lang* is bound to nil, otherwise, *current-xml-lang* is bound to the new language.

GENERIC-FUNCTION

Private

Undocumented

ATTRIBUTE (CONDITION)

ATTRIBUTES (CONDITION)

CHARACTERS (CONDITION)

NAME (CONDITION)

PARSE-TYPE (CONDITION)

PREFIX (CONDITION)

SOURCE (CONDITION)

TAG (CONDITION)

URI (CONDITION)

VALUE (CONDITION)

SLOT-ACCESSOR

Public

BLANK-NODE-ID (BLANK-NODE)

The blank-node-id blank-node => id blank-node---a blank-node id---a string Blank-node-id returns the ID of the blank-node. Blank-node-ids are intended to be used for readability purposes. Blank-nodes should be compared directly using object equality. That two blank-nodes have ids that are string= does not mean that they represent the same RDF blank-node.

LITERAL-DATATYPE (TYPED-LITERAL)

The literal-datatype typed-literal => datatype typed-literal---a typed-literal datatype---an interned PURI uri Literal-datatype returns the datatype of a typed-literal. The datatype URI is interned, and may be compared with eq.

LITERAL-LANGUAGE (PLAIN-LITERAL)

The literal-language plain-literal => result plain-literal---a plain-literal result---a string or nil Literal-language return the language tag of the plain-literal, if there is one, and nil if no language tag is associated with the literal.

LITERAL-STRING (LITERAL)

The literal-string literal => string literal---a literal string---a string Literal-string returns the lexical form of the literal.

VARIABLE

Public

*COERCE-DATATYPED-EMPTY-PROPERTIES*

A boolean (whose default value is false) that controls whether an empty property element that contains a datatype attribute (a case which is prohibited by the RDF/XML Syntax Specification) is coerced to a typed literal with the specified datatype and the empty string "" as a lexical form. Also see the condition type datatyped-empty-property and the keyword argument coerce-datatyped-empty-properties to the function parse-document.

*PARSE-URIS-STRICTLY*

A boolean (whose default value is true) that controls whether URIs are parsed strictly. This determines whether, within parse-document, a handler is established for conditions of type puri:uri-parse-error which will attempt to parse malformed URIs in a non-strict way. Also see the restart function parse-uri-non-strictly, and the parse-uris-strictly keyword argument to parse-document.

*WARN-ON-NON-NAMESPACED-NAMES*

A boolean (whose default value is true) that controls whether a warning is signalled when a permitted non-namespaced attribute is encountered. The only attributes which may appear without namespaces are ID, about, resource, parseType, and type. New documents should not use unqualified forms, though they may appear in legacy documents. See Section 6.1.4 of the RDF/XML Syntax Specification.

*WARN-ON-PARSE-TYPE-OTHER*

A boolean (whose default value is false) that controls whether a warning is signalled when an element is encountered that specifies the rdf:parseType attribute with a value other than "Literal", "Resource", or "Collection". Such an element is treated as though the value were "Literal", and this situation is not an error. Nonetheless, it seems likely that one might be interested in knowing when it occurs.

*WARN-ON-RDF-PREFIXED-NON-RDF-NAMES*

According to to Section 5.1, The RDF Namespace and Vocabulary of the RDF/XML Syntax Specification, warnings SHOULD be generated when a name is encountered that begins with the RDF namespace name, but is not an RDF name. If *warn-on-rdf-prefixed-non-rdf-names* is true (the default), then such warnings are generated, but are muffled otherwise.

+RDF-NAMESPACE+

The string prefix of RDF terms: http://www.w3.org/1999/02/22-rdf-syntax-ns# .

+RDFS-NAMESPACE+

The string prefix of RDFS terms: http://www.w3.org/2000/01/rdf-schema#

Undocumented

+RDF-ABOUT+

+RDF-ABOUT-EACH+

+RDF-ABOUT-EACH-PREFIX+

+RDF-ALT+

+RDF-BAG+

+RDF-BAG-ID+

+RDF-DATATYPE+

+RDF-DESCRIPTION+

+RDF-FIRST+

+RDF-ID+

+RDF-LI+

+RDF-LIST+

+RDF-NIL+

+RDF-NODE-ID+

+RDF-OBJECT+

+RDF-PARSE-TYPE+

+RDF-PREDICATE+

+RDF-PROPERTY+

+RDF-RDF+

+RDF-RESOURCE+

+RDF-REST+

+RDF-SEQ+

+RDF-STATEMENT+

+RDF-SUBJECT+

+RDF-TYPE+

+RDF-VALUE+

+RDF-XML-LITERAL+

+RDFS-CLASS+

+RDFS-COMMENT+

+RDFS-CONTAINER+

+RDFS-CONTAINER-MEMBERSHIP-PROPERTY+

+RDFS-DATATYPE+

+RDFS-DOMAIN+

+RDFS-IS-DEFINED-BY+

+RDFS-LABEL+

+RDFS-LITERAL+

+RDFS-MEMBER+

+RDFS-RANGE+

+RDFS-RESOURCE+

+RDFS-SEE-ALSO+

+RDFS-SUBCLASS-OF+

+RDFS-SUBPROPERTY-OF+

Private

*BLANK-NODES*

An equal hash table that is used for `interning' blank node IDs within the scope of a single graph. Initially nil, but should be bound for each graph being processed.

*CURRENT-XML-LANG*

The most recent xml:lang attribute that was specified in the RDF/XML text. The initial value is nil, and *current-xml-lang* is always rebound to nil when document parsing begins.

*ELEMENT-IDS*

During parsing, an 'equal hash table that functions as a set of the IDs that have been processed. Duplicate IDs in an RDF/XML document are prohibited, i.e., it is an error for two elements to have the same value on an rdf:ID attribute.

*LI-COUNTER*

A list of li-counters. With each expecting-element', a new counter is pushed onto *li-counter*, and so incrementing the counter of an element's parent is done by (incf (cadr *li-counter*)).

*OBJECT*

The predicate of the triples being processed.

*PLAIN-LITERALS*

An equal hash-table used for interning plain literals, that is, literals with a string component and an optional language tag.

*PREDICATE*

The predicate of the triples being processed.

*SUBJECT*

The subject of the triples being processed.

*TRIPLE-RECEIVER*

A function that receives the triples.

*TYPED-LITERALS*

An equal hash-table used for interning typed literals, that is, literals with a string component and a datatype.

+XML-NAMESPACE+

The string form of the URI XML namespace.

CLASS

Public

BLANK-NODE (&OPTIONAL (ID NIL IDP) (NAMESPACE *BLANK-NODES*))

The blank-node class represents blank nodes in a graph. Blanks nodes are local to a graph, and can be identified within a graph by their ID. The blank-node id is used for refering to the same blank node in an RDF/XML document, and so in general, blank-nodes ought to compared using object equality, i.e., eq.

LITERAL

The literal class is the superclass of both the plain-literal and the typed literal. Every literal has some lexical form, and the slot storing this form is defined in the literal class, and may be read with literal-string.

PLAIN-LITERAL

The plain-literal class is the class comprising all plain-literals. These literals have a lexical form, inherited from the superclass literal, and an optional language tag. The language tag, when provided, should be of the form specified by RFC 3066, and is normalized to lowercase.

TYPED-LITERAL

The typed-literal class is the class comprising all typed-literals. These literals have a lexical form, inherited from the superclass literal, and a required datatype. The datatype is a puri:uri.

CONDITION

Public

BAD-NODE-ELEMENT-URI

Errors of type bad-node-element-uri are signalled when a URI that is not a node-element-uri is specified in a position where a node-element-uri is expected.

BAD-PROPERTY-ELEMENT-URI

Errors of type bad-property-element-uri are signalled when a URI that is not a property-element-uri is specified in a position where a property-element-uri is expected.

BAD-URI

Errors that are subclasses of bad-uri are signalled when a URI appears in a place that a URI is required, but the provided URI is not a valid URI for that place.

DATATYPED-EMPTY-PROPERTY

Errors of type datatyped-empty-property are signaled when the parser is attempting to parser an empty property, but an rdf:datatype attribute is specified. rdf:datatype is not a permissible attribute on on empty properties, but it is expected that this case will most likely arise when the intent was to generate a literal element with an empty string. When this type of error is signalled, it is expected that one of the available restarts will make an attempt to parse the element as a literal with a null string. This issue is also in the errata of the RDF/XML syntax specification.

DUPLICATE-ATTRIBUTE

Errors of type duplicate-attribute are signalled when attributes are specified more than once and the XML parser did not flag the error. This happens when, according to the RDF/XML specification, certain non-namespaced attributes are interpreted as being in the RDF namespace. A duplicate attribute can appear, for instance, when rdf:ID is specified in conjunction with ID, which is interpreted as rdf:ID.

ILLEGAL-NAMESPACE-NAME

According to Section 5.1 of the RDF/XML Syntax Specification, Within RDF/XML documents it is not permitted to use XML namespaces whose namespace name is the RDF namespace URI reference concatenated with additional characters.

INVALID-ATTRIBUTE-VALUE

Conditions of type invalid-attribute-value are signalled when an attribute value is not appropriate for the particular attribute. This kind of situation may happen, for instance, if a xml:lang value is not RFC 3066 compliant, or if an rdf:ID or rdf:nodeID value is not an XML NCName. Note that these situations are distinct from those in which an attribute appears where it should not.

INVALID-LANGUAGE-TAG

Language tags in RDF/XML (and more generally, XML) must be in accordance with RFC 3066. When a language tag is specified that is not of the proper form, an error of type invalid-language-tag is signalled.

MUTUALLY-EXCLUSIVE-ATTRIBUTES

Some elements are permitted to contain one of a set of attributes, but no more than one of the set. That is, there are attributes that are permitted on an element, but are mutually exclusive. This class of error is signalled when such attributes are encountered.

NON-NAMESPACED-ATTRIBUTE

Certain attribute, namely rdf:ID, rdf:about, rdf:resource, rdf:parseType, and rdf:type are permitted to appear without a namespace specified. These attributes are automatically treated as though they had appeared with the RDF namespace prefix. Any other attributes without namespaces, however, must not appear.

NON-NAMESPACED-NAME

According to 6.1.4 of the RDF/XML Syntax Specification, the attributes ID, about, resource, parseType, and type may appear without a namespace prefix, and are interpreted as the corresponding RDF names. Also, "new documents SHOULD NOT use these unqualified attributes, and applications MAY choose to warn when the unqualified form is seen in a document." non-namespaced-name is the class of warnings that are signalled in such situations.

NON-NC-NAME-ID

Errors of type non-nc-name-id are raised when attributes rdf:ID or rdf:nodeID appear with values that are not valid NCNames.

OTHER-PARSE-TYPE

The rdf:parseType attribute has three explicitly meaning values, "Resource", "Literal", and "Collection". If rdf:parseType is encountered with a different value, the element is processed as though the value had been "Literal". The specification does not indicate that a warning should be signalled, and so such warnings are not generated in the default case, but if the user requests warnings on such attribute values, a warning of type other-parse-type is signalled.

PROHIBITED-ATTRIBUTE

At various places in RDF/XML, the set of attributes permissible on an element is restricted. When an attribute appears on an element but is not allowed there, an prohibited-attribute error is signalled.

RDF-PREFIXED-NON-RDF-NAME

According to "Section 5.1 The RDF Namespace and Vocabulary" of the RDF/XML Syntax Specification, certain names are defined as RDF names, and these begin with the RDF namespace name, but "any other names [beginning with the RDF namespace name] are not defined and SHOULD generate a warning when encountered, but should otherwise behave normally." rdf-prefixed-non-rdf-name is the class of warnings that are signalled in such situations.

RDFXML-ERROR

The class of errors signalled by the RDF/XML parser.

RDFXML-WARNING

The class of warnings signalled by the RDF/XML parser.

REPEATED-ID

Errors of type repeated-id are signalled when the value of an rdf:ID on an element is the same as the value of an rdf:ID attribute on another element. rdf:IDs should be unique within the a document.

UNEXPECTED-CHARACTERS

Excess whitespace is always permitted between elements, but arbitrary character data is not. When non-whitespace character data is encountered where whitespace is expected, an error of type unexpected characters is signalled.