Yay json-ld expansion works again

parent d61afedb
......@@ -279,6 +279,14 @@ fold instead of fold-right >:)"
;; @@: could just use atlist-tail if we didn't care about precision
(length (jsobj->unique-alist jsobj))))
;; for debugging
(define-syntax-rule (pk-values print-these ... body)
(call-with-values
(lambda () body)
(lambda vals
(pk print-these ... '*pk-values:* vals)
(apply values vals))))
;;; =============
......@@ -908,7 +916,8 @@ Does a multi-value-return of (expanded-iri active-context defined)"
(throw 'json-ld-error
#:code "colliding keywords"))
(receive (expanded-value active-context)
(call-with-values
(lambda ()
(match expanded-property
;; 7.4.3
("@id"
......@@ -926,19 +935,18 @@ Does a multi-value-return of (expanded-iri active-context defined)"
(iri-expansion active-context value
#:vocab #t #:document-relative #t))
(((? string? _) ...)
(match
(fold-right
(lambda (item prev)
(match prev
((array-result . active-context)
(receive (active-context expanded)
(let lp ((items value)
(result '())
(active-context active-context))
(match items
(() (values result active-context))
((item remaining-items ...)
(call-with-values
(lambda ()
(iri-expansion active-context item
#:document-relative #t)
(cons (cons expanded array-result) active-context)))))
(cons '() active-context)
value)
((array-result . active-context)
(values array-result active-context))))
#:document-relative #t))
(lambda* (expanded active-context #:optional _)
(lp remaining-items expanded active-context)))))))
(_ (throw 'json-ld-error #:code "invalid type value"))))
;; 7.4.5
......@@ -1042,7 +1050,8 @@ Does a multi-value-return of (expanded-iri active-context defined)"
(jsobj-set result "@reverse" jsobj-nil))
expanded-value))
(else result))
active-context))))
active-context)))))
(lambda* (expanded-value active-context #:optional _) ; ignore defined here
(return
(if (eq? expanded-value #nil)
;; return as-is
......@@ -1050,7 +1059,7 @@ Does a multi-value-return of (expanded-iri active-context defined)"
;; otherwise, set expanded-property member of result
;; to expanded-value
(jsobj-set result expanded-property expanded-value))
active-context)))
active-context))))
;; 7.5
;; If key's container mapping in active-context is @language and
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment