[isidorus-cvs] r422 - in trunk/src: TM-SPARQL unit_tests
Lukas Giessmann
lgiessmann at common-lisp.net
Wed Apr 6 20:53:10 UTC 2011
Author: lgiessmann
Date: Wed Apr 6 16:53:10 2011
New Revision: 422
Log:
TM-SPARQL: fixed a bug when there is a greater amount of variables in filters contained in one select-group
Modified:
trunk/src/TM-SPARQL/sparql.lisp
trunk/src/unit_tests/sparql_test.lisp
Modified: trunk/src/TM-SPARQL/sparql.lisp
==============================================================================
--- trunk/src/TM-SPARQL/sparql.lisp (original)
+++ trunk/src/TM-SPARQL/sparql.lisp Wed Apr 6 16:53:10 2011
@@ -413,7 +413,7 @@
(defgeneric process-filters (construct)
(:documentation "Processes all filters by calling invoke-filter.")
- (:method ((construct SPARQL-Query))
+ (:method ((construct SPARQL-Query))
(dolist (filter (filters construct))
(let* ((filter-variable-names
(get-variables-from-filter-string filter))
@@ -423,20 +423,19 @@
(make-variable-values construct var-name filter-variable-values)))
(setf filter-variable-values
(cast-variable-values construct filter-variable-values))
- (dolist (filter (filters construct))
- (let ((true-values nil))
- (dolist (var-elem filter-variable-values)
- (when (eval (read-from-string (to-lisp-code var-elem filter)))
- (map 'list #'(lambda(list-elem)
- (push list-elem true-values))
- var-elem)))
- (let ((values-to-remove
- (return-false-values filter-variable-values
- (remove-duplicates true-values
- :test #'variable-list=))))
- (dolist (to-del values-to-remove)
- (delete-rows-by-value construct (getf to-del :variable-name)
- (getf to-del :variable-value))))))))
+ (let ((true-values nil))
+ (dolist (var-elem filter-variable-values)
+ (when (eval (read-from-string (to-lisp-code var-elem filter)))
+ (map 'list #'(lambda(list-elem)
+ (push list-elem true-values))
+ var-elem)))
+ (let ((values-to-remove
+ (return-false-values filter-variable-values
+ (remove-duplicates true-values
+ :test #'variable-list=))))
+ (dolist (to-del values-to-remove)
+ (delete-rows-by-value construct (getf to-del :variable-name)
+ (getf to-del :variable-value)))))))
construct))
Modified: trunk/src/unit_tests/sparql_test.lisp
==============================================================================
--- trunk/src/unit_tests/sparql_test.lisp (original)
+++ trunk/src/unit_tests/sparql_test.lisp Wed Apr 6 16:53:10 2011
@@ -2406,7 +2406,8 @@
"SELECT * WHERE {
<http://some.where/tmsparql/author/goethe> ?pred1 ?obj1.
FILTER isLITERAL(?obj1) && !isLITERAL(?pred1) && ?obj1 = 'von Goethe' || ?obj1 = 82
- FILTER ?pred1 = $pred1 && $obj1 = $obj1 && ?pred1 != ?obj1"
+ FILTER ?pred1 = $pred1 && $obj1 = $obj1 && ?pred1 != ?obj1
+ FILTER ?obj1 >= 82 || ?obj1 = 'von Goethe'"
"}"))
(r-1 (tm-sparql:result (make-instance 'TM-SPARQL:SPARQL-Query :query q-1))))
;(is-true (= (length r-1) 2))
More information about the Isidorus-cvs
mailing list