Support terms with ld-keywords as values
Like “type” → “@type”
This commit is contained in:
parent
29a9814008
commit
0f93516cab
|
@ -125,19 +125,21 @@ IRI values whose prefix hasn’t yet been parsed into CTX."
|
||||||
(let ((unresolvable '()))
|
(let ((unresolvable '()))
|
||||||
(maphash
|
(maphash
|
||||||
(lambda (term val)
|
(lambda (term val)
|
||||||
(let* ((iri
|
(let* ((id (typecase val
|
||||||
(typecase val
|
(string val)
|
||||||
(string (when (iri-p val) val))
|
|
||||||
(hash-table (gethash "@id" val))))
|
(hash-table (gethash "@id" val))))
|
||||||
|
(iri (when (iri-p id) id))
|
||||||
(uncompacted-iri (ignore-errors (uncompact-iri iri ctx)))
|
(uncompacted-iri (ignore-errors (uncompact-iri iri ctx)))
|
||||||
|
(parsed-id (or uncompacted-iri
|
||||||
|
(and (ld-keyword-p id) id)))
|
||||||
(type
|
(type
|
||||||
(typecase val
|
(typecase val
|
||||||
(string nil)
|
(string nil)
|
||||||
(hash-table (gethash "@type" val)))))
|
(hash-table (gethash "@type" val)))))
|
||||||
(cond ((and iri (not uncompacted-iri))
|
(cond ((and id (not parsed-id))
|
||||||
(push (cons term iri) unresolvable))
|
(push (cons term iri) unresolvable))
|
||||||
(T
|
(T
|
||||||
(setf (gethash term ctx) (list :id uncompacted-iri :type type))))))
|
(setf (gethash term ctx) (list :id parsed-id :type type))))))
|
||||||
table)
|
table)
|
||||||
unresolvable))
|
unresolvable))
|
||||||
|
|
||||||
|
@ -151,7 +153,8 @@ IRI values whose prefix hasn’t yet been parsed into CTX."
|
||||||
'("@base" "@container" "@context" "@direction" "@graph" "@id" "@import"
|
'("@base" "@container" "@context" "@direction" "@graph" "@id" "@import"
|
||||||
"@included" "@index" "@json" "@language" "@list" "@nest" "@none"
|
"@included" "@index" "@json" "@language" "@list" "@nest" "@none"
|
||||||
"@prefix" "@propagate" "@protected" "@reverse" "@set" "@type"
|
"@prefix" "@propagate" "@protected" "@reverse" "@set" "@type"
|
||||||
"@value" "@version" "@vocab")))
|
"@value" "@version" "@vocab")
|
||||||
|
:test #'equal))
|
||||||
|
|
||||||
(defun uncompact-iri (iri ctx)
|
(defun uncompact-iri (iri ctx)
|
||||||
"Given a compacted IRI, uncompact it into its normal form, with CTX being a
|
"Given a compacted IRI, uncompact it into its normal form, with CTX being a
|
||||||
|
|
Ŝarĝante…
Reference in New Issue