Fix augmenting RDFS and RDF consistency

Julien LepillerSun Apr 05 14:51:48+0200 2020

4bcc017

Fix augmenting RDFS and RDF consistency

rdf/entailment/rdf.scm

4242
      ((a b ...)
4343
       (and (null? (filter
4444
                     (lambda (t)
45-
                       ((rdf-vocabulary-compatible? vocabulary) a t))
45+
                       (not ((rdf-vocabulary-compatible? vocabulary) a t)))
4646
                     b))
4747
            (compatible? b)))))
4848

rdf/entailment/rdfs.scm

4242
           (valid-subclasses? graph)))
4343
      ((_ graph ...)
4444
       (valid-subclasses? graph))))
45-
  (and (valid-subclasses? (augment (recognize graph vocabulary) vocabulary))
46-
       (rdf:consistent-graph? graph vocabulary)))
45+
  (let ((graph (augment (recognize graph vocabulary) vocabulary)))
46+
    (and (valid-subclasses? graph)
47+
         (rdf:consistent-graph? graph vocabulary))))
4748
4849
;; G entails E if E has an instance (where blank nodes are replaced by literals
4950
;; or IRIs) that is a subgraph of G.

266267
              (map
267268
                (lambda (t)
268269
                  (make-rdf-triple t (rdf-iri "type") (rdfs-iri "Datatype")))
269-
                (rdf-vocabulary-datatypes voc))))
270+
                (rdf-vocabulary-datatypes voc))
271+
              g))
270272
         (g (append
271273
              (append-map rdfs-axioms-container (rdf-container-properties g))
272274
              g)))

293295
                           added? augment-set)
294296
               (let ((p (rdf-triple-predicate t)))
295297
                 (cond
296-
                   ((is-iri? p "subClassOf")
298+
                   ((is-iri? p (rdfs-iri "subClassOf"))
297299
                    (inner-loop (cons t graph) (cons t subclasses) subprops
298300
                                ranges domains types #t augment-set))
299-
                   ((is-iri? p "subPropertyOf")
301+
                   ((is-iri? p (rdfs-iri "subPropertyOf"))
300302
                    (inner-loop (cons t graph) subclasses (cons t subprops)
301303
                                ranges domains types #t augment-set))
302-
                   ((is-iri? p "range")
304+
                   ((is-iri? p (rdfs-iri "range"))
303305
                    (inner-loop (cons t graph) subclasses subprops
304306
                                (cons t ranges) domains types #t augment-set))
305-
                   ((is-iri? p "domain")
307+
                   ((is-iri? p (rdfs-iri "domain"))
306308
                    (inner-loop (cons t graph) subclasses subprops
307309
                                ranges (cons t domains) types #t augment-set))
308-
                   ((is-iri? p "type")
310+
                   ((is-iri? p (rdf-iri "type"))
309311
                    (inner-loop (cons t graph) subclasses subprops
310312
                                ranges domains (cons t types) #t augment-set))
311313
                   (else

rdf/rdf.scm

187187
;;     be well-formed according to section 2.2.9 of [BCP47].
188188
189189
(define-record-type rdf-literal
190-
  (make-rdf-literal lexical-form type language-tag)
190+
  (make-rdf-literal lexical-form type langtag)
191191
  rdf-literal?
192192
  (lexical-form rdf-literal-lexical-form)
193193
  (type         rdf-literal-type)
194-
  (language-tag rdf-literal-language-tag))
194+
  (langtag      rdf-literal-langtag))
195195
196196
;; From the specification:
197197
;;   Blank nodes are disjoint from IRIs and literals.  Otherwise, the set of