From: Chris Hanson Date: Thu, 22 Jun 2006 18:35:27 +0000 (+0000) Subject: Add unparser for RDF literals. X-Git-Tag: 20090517-FFI~996 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=68c9d88d4e811c96857c7ba72e920231ca0f1154;p=mit-scheme.git Add unparser for RDF literals. --- diff --git a/v7/src/xml/rdf-struct.scm b/v7/src/xml/rdf-struct.scm index 22bb05652..7813679a5 100644 --- a/v7/src/xml/rdf-struct.scm +++ b/v7/src/xml/rdf-struct.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: rdf-struct.scm,v 1.7 2006/06/22 04:48:28 cph Exp $ +$Id: rdf-struct.scm,v 1.8 2006/06/22 18:35:27 cph Exp $ Copyright 2006 Massachusetts Institute of Technology @@ -49,10 +49,9 @@ USA. (define-guarantee rdf-bnode "RDF bnode") (set-record-type-unparser-method! - (standard-unparser-method 'RDF-BNODE - (lambda (bnode port) - (write-char #\space port) - (write (rdf-bnode-name bnode) port)))) + (simple-unparser-method 'RDF-BNODE + (lambda (bnode) + (rdf-bnode-name bnode)))) (define (make-rdf-bnode #!optional name) (%make-rdf-bnode @@ -75,6 +74,14 @@ USA. (define-guarantee rdf-literal "RDF literal") +(set-record-type-unparser-method! + (simple-unparser-method 'RDF-LITERAL + (lambda (literal) + (list (let ((s (rdf-literal-text literal))) + (if (fix:<= (string-length s) 64) + s + (string-append (string-head s 60) " ..."))))))) + (define (make-rdf-literal text type) (guarantee-utf8-string text 'RDF-LITERAL) (%make-rdf-literal text