summaryrefslogtreecommitdiff
path: root/schemantic/rdf/lang-string.scm
blob: a3d1da7319b8c404af6886980e3a00b1d6d42cf0 (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 <literal>) port)
  (format port "<rdf:langString \"~a\"@~a>" (literal-value self) (literal-language self)))