Add rdf:XMLLiteral for test support

Julien LepillerSat Apr 04 21:11:37+0200 2020

fcad0d8

Add rdf:XMLLiteral for test support

rdf/rdf.scm

1818
(define-module (rdf rdf)
1919
  #:use-module (srfi srfi-1)
2020
  #:use-module (srfi srfi-9)
21+
  #:use-module (sxml simple)
2122
  #:use-module (ice-9 match)
2223
  #:export (rdf-datatype
2324
            make-rdf-datatype

3031
            rdf-datatype-value->lexical
3132
3233
            rdf:langString
34+
            rdf:XMLLiteral
3335
3436
            rdf-dataset
3537
            make-rdf-dataset

104106
    string-downcase
105107
    identity))
106108
109+
(define rdf:XMLLiteral
110+
  (make-rdf-datatype
111+
    '("http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral")
112+
    "RDF provides for XML content as a possible literal value.  Such content
113+
is indicated in an RDF graph using a literal whose datatype is set to
114+
rdf:XMLLiteral.  This datatype is defined as non-normative because it depends
115+
on [DOM4], a specification that has not yet reached W3C Recommendation status."
116+
    (lambda (l)
117+
      (false-if-exception (xml->sxml l)))
118+
    (lambda (v)
119+
      (false-if-exception (sxml->xml v)))
120+
    xml->sxml
121+
    sxml->xml))
122+
107123
;; From the specification:
108124
;;   An RDF dataset is a collection of RDF graphs, and comprises:
109125
;;

test-modules/online.scm

157157
              (recognized
158158
                (map
159159
                  (lambda (iri)
160-
                    (let loop ((types xsd:datatypes))
160+
                    (let loop ((types (cons* rdf:XMLLiteral rdf:langString
161+
                                             xsd:datatypes)))
161162
                      (match types
162-
                        (() #f)
163+
                        (() (throw 'didnotrecognize iri))
163164
                        ((type types ...)
164165
                         (if (member iri (rdf-datatype-iris type))
165166
                             (pk 'recognized-type type)