[isidorus-cvs] r388 - trunk/src/TM-SPARQL

Lukas Giessmann lgiessmann at common-lisp.net
Sun Feb 6 09:48:58 UTC 2011


Author: lgiessmann
Date: Sun Feb  6 04:48:58 2011
New Revision: 388

Log:
TM-SPARQL: added type checking when processing special-uris to avoid exception at runtime

Modified:
   trunk/src/TM-SPARQL/sparql_special_uris.lisp

Modified: trunk/src/TM-SPARQL/sparql_special_uris.lisp
==============================================================================
--- trunk/src/TM-SPARQL/sparql_special_uris.lisp	(original)
+++ trunk/src/TM-SPARQL/sparql_special_uris.lisp	Sun Feb  6 04:48:58 2011
@@ -26,20 +26,27 @@
   (:documentation "Returns lists representing triples that handles special
                    predicate uris defined in tmsparql.")
   (:method ((construct SPARQL-Triple) &key (revision d:*TM-REVISION*))
-    (let ((pred (predicate construct)))
+    (let ((pred (predicate construct))
+	  (subj-value (value (subject construct))))
       (if (variable-p pred)
 	  (filter-for-special-uris construct :revision revision)
-	  (cond ((has-identifier (value pred) *tms-reifier*)
+	  (cond ((and (has-identifier (value pred) *tms-reifier*)
+		      (typep subj-value 'd:ReifiableConstructC))
 		 (filter-for-reifier construct :revision revision))
-		((has-identifier (value pred) *tms-scope*)
+		((and (has-identifier (value pred) *tms-scope*)
+		      (typep subj-value 'd:ScopableC))
 		 (filter-for-special-uris construct :revision revision))
-		((has-identifier (value pred) *tms-value*)
+		((and (has-identifier (value pred) *tms-value*)
+		      (typep subj-value 'd:TopicC))
 		 (filter-for-values construct :revision revision))
-		((has-identifier (value pred) *tms-topicProperty*)
+		((and (has-identifier (value pred) *tms-topicProperty*)
+		      (typep subj-value 'd:TopicC))
 		 (filter-for-topicProperties construct :revision revision))
-		((has-identifier (value pred) *tms-role*)
+		((and (has-identifier (value pred) *tms-role*)
+		      (typep subj-value 'd:AssociationC))
 		 nil) ;TODO: implement
-		((has-identifier (value pred) *tms-player*)
+		((and (has-identifier (value pred) *tms-player*)
+		      (typep subj-value 'd:RoleC))
 		 nil) ;TODO: implement
 		)))))
 




More information about the Isidorus-cvs mailing list