summaryrefslogtreecommitdiff
path: root/schemantic/xsd.scm
diff options
context:
space:
mode:
Diffstat (limited to 'schemantic/xsd.scm')
-rw-r--r--schemantic/xsd.scm27
1 files changed, 27 insertions, 0 deletions
diff --git a/schemantic/xsd.scm b/schemantic/xsd.scm
new file mode 100644
index 0000000..ecc3bf2
--- /dev/null
+++ b/schemantic/xsd.scm
@@ -0,0 +1,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