From 68c9d88d4e811c96857c7ba72e920231ca0f1154 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 22 Jun 2006 18:35:27 +0000 Subject: [PATCH] Add unparser for RDF literals. --- v7/src/xml/rdf-struct.scm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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 -- 2.25.1