summaryrefslogtreecommitdiff
path: root/schemantic/rdf.scm
diff options
context:
space:
mode:
Diffstat (limited to 'schemantic/rdf.scm')
-rw-r--r--schemantic/rdf.scm85
1 files changed, 20 insertions, 65 deletions
diff --git a/schemantic/rdf.scm b/schemantic/rdf.scm
index 68329a7..ededcd5 100644
--- a/schemantic/rdf.scm
+++ b/schemantic/rdf.scm
@@ -4,73 +4,33 @@
(define-module (schemantic rdf)
#:use-module (oop goops)
-
#:use-module (oop goops describe) ; only for dev/debug
- #:use-module (web uri)
- #:use-module (ice-9 optargs)
- #:use-module (ice-9 exceptions)
+ #:use-module (schemantic iri)
+ #:use-module (schemantic literal)
+ #:use-module (schemantic xsd)
- #:export (<iri>
- make-iri
- iri?
- iri-value
-
- <literal>
- literal?
- literal-value
- literal-lexical
- literal-canonical
- literal-datatype
-
- <triple>
+ #:export (<triple>
make-triple
triple?
triple-subject
triple-predicate
- triple-object
-
- define-namespace))
-
-;; IRI
-
-(define-class <iri> ()
- (value #:init-keyword #:value #:getter iri-value))
-
-(define-method (initialize (self <iri>) initargs)
- (let-keywords initargs #f (value)
- (cond
- ((string? value) (next-method self (list #:value value)))
- ((uri? value) (next-method self (list #:value (uri->string value))))
- ((iri? value) (next-method self (list #:value (iri-value value))))
- (else (raise-exception
- (make-exception
- (make-programming-error)
- (make-exception-with-message "can not cast to iri")))))))
-
-(define-method (equal? (x <iri>) (y <iri>))
- (equal? (iri-value x) (iri-value y)))
-
-(define (make-iri value)
- "Returns a new iri with value"
- (make <iri> #:value value))
-
-(define (iri? x)
- "Returns true if x is an iri"
- (is-a? x <iri>))
-
-;; Literal
-
-(define-class <literal> ())
-
-(define (literal? x)
- (is-a? x <literal>))
-
-(define-generic literal-value)
-(define-generic literal-lexical)
-(define-generic literal-canonical)
-(define-generic literal-datatype)
-
+ triple-object)
+
+ #:re-export (<iri>
+ make-iri
+ iri?
+ iri-value
+ define-namespace
+
+ <literal>
+ make-literal
+ make-generic-literal
+ literal?
+ literal-value
+ literal-lexical
+ literal-canonical
+ literal-datatype))
;; Triple
@@ -88,8 +48,3 @@
(define (triple? x)
(is-a? x <triple>))
-;; Syntax for defining new namespace
-
-(define-syntax-rule (define-namespace name uri)
- (define (name id)
- (make-iri (string-append uri id))))