summaryrefslogtreecommitdiff
path: root/schemantic/rdf/lang-string.scm
blob: ee700913cffc9554a9039b87e17ae494610d08a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
; SPDX-FileCopyrightText: 2020 pukkamustard <pukkamustard@posteo.net>
;
; SPDX-License-Identifier: GPL-3.0-or-later

(define-module (schemantic rdf lang-string)
  #:use-module (oop goops)

  #:use-module (schemantic literal)
  #:use-module ((schemantic ns) #:select (rdf))

  #:export (<rdf:langString>
            make-lang-string))

(define-class <rdf:langString> (<literal>)
  (language #:init-keyword #:language #:getter literal-language))

(define-method (literal-datatype (l <rdf:langString>)) (rdf "langString"))
(define-method (literal-lexical (l <rdf:langString>)) (literal-value l))
(define-method (literal-canonical (l <rdf:langString>)) (literal-value l))

(define* (make-lang-string value #:key language)
  (make <rdf:langString> #:value value #:language language))

(define-method (write (self <rdf:langString>) port)
  (format port "<rdf:langString \"~a\"@~a>" (literal-value self) (literal-language self)))