summaryrefslogtreecommitdiff
path: root/schemantic/xsd.scm
blob: ecc3bf2b2c1644b5eedd715459666111998afb88 (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
26
27
; SPDX-FileCopyrightText: 2020 pukkamustard <pukkamustard@posteo.net>
;
; SPDX-License-Identifier: GPL-3.0-or-later

(define-module (schemantic xsd)
  #:use-module (oop goops)

  #:use-module (schemantic iri)
  #:use-module (schemantic literal)
  #:use-module ((schemantic ns) #:select (xsd))

  #:export (<xsd:string>
            <xsd:integer>))

(define-class <xsd:string> (<literal>))
(define-method (literal-lexical (x <xsd:string>)) (literal-value x))
(define-method (literal-canonical (x <xsd:string>)) (literal-value x))
(define-method (literal-datatype (x <xsd:string>)) (xsd "string"))
(define-method (make-literal (s <string>)) (make <xsd:string> #:value s))

(define-class <xsd:integer> (<literal>))
(define-method (literal-lexical (x <xsd:integer>)) (number->string (literal-value x)))
(define-method (literal-canonical (x <xsd:integer>)) (number->string (literal-value x)))
(define-method (literal-datatype (x <xsd:integer>)) (xsd "integer"))
(define-method (make-literal (s <integer>)) (make <xsd:integer> #:value s))

;; TODO add the other XSD datatypes