[isidorus-cvs] r385 - in trunk/src: . TM-SPARQL

Lukas Giessmann lgiessmann at common-lisp.net
Tue Jan 25 17:46:44 UTC 2011


Author: lgiessmann
Date: Tue Jan 25 12:46:43 2011
New Revision: 385

Log:
tm-sparql: added an xtm file that contains all special uris defined by the networkedplanet tmsparql proposal as topic with corresponding PSIs; added a funtion that allos to initialise the tmsparql module, ie. the tmsparql xtm is imported

Added:
   trunk/src/TM-SPARQL/sparql_constants.lisp
   trunk/src/TM-SPARQL/tmsparql_core_psis.xtm
Modified:
   trunk/src/TM-SPARQL/sparql.lisp
   trunk/src/isidorus.asd
   trunk/src/xml-constants.lisp

Modified: trunk/src/TM-SPARQL/sparql.lisp
==============================================================================
--- trunk/src/TM-SPARQL/sparql.lisp	(original)
+++ trunk/src/TM-SPARQL/sparql.lisp	Tue Jan 25 12:46:43 2011
@@ -8,9 +8,12 @@
 ;;+-----------------------------------------------------------------------------
 
 (defpackage :TM-SPARQL
-  (:use :cl :datamodel :base-tools :exceptions :constants)
+  (:use :cl :datamodel :base-tools :exceptions :constants
+	:TM-SPARQL-Constants :xml-importer :xml-constants
+	:isidorus-threading :xml-tools)
   (:export :SPARQL-Query
-	   :result))
+	   :result
+	   :init-tm-sparql))
 
 (in-package :TM-SPARQL)
 
@@ -19,6 +22,30 @@
 (defvar *equal-operators* nil "A Table taht contains tuples of 
                                classes and equality operators.")
 
+
+(defun init-tm-sparql (&optional (revision (get-revision)))
+  "Imports the file tmsparql_core_psis.xtm. core_psis.xtm has to be imported
+   before."
+  (with-writer-lock
+    (with-tm (revision "tmsparql.xtm" (concat *tms* "topic-map"))
+      (let ((core-dom (cxml:parse-file *tmsparql_core_psis.xtm*
+				       (cxml-dom:make-dom-builder)))
+	    (xtm-id (reverse
+		     (base-tools:string-until
+		      (reverse
+		       (pathname-name
+			xml-constants:*tmsparql_core_psis.xtm*)) "/"))))
+	(elephant:ensure-transaction (:txn-nosync t)
+	  (loop for top-elem across 
+	       (xpath-child-elems-by-qname (dom:document-element core-dom)
+					   *xtm2.0-ns* "topic")
+	     do (let ((top
+		       (from-topic-elem-to-stub top-elem revision
+						:xtm-id xtm-id)))
+		  (add-to-tm xml-importer::tm top))))))))
+
+
+
 (defun init-*equal-operators* ()
   (setf *equal-operators*
 	(list (list :class 'Boolean :operator #'eql)
@@ -1164,8 +1191,5 @@
   ;; filters all entries that are not important for the result
   ;; => an intersection is invoked
   (reduce-results construct (make-result-lists construct))
-;  (dolist (triple (select-group construct))
-;    (dolist (filter (filters construct))
-;      (invoke-filter triple construct filter)))
   (process-filters construct)
   construct)
\ No newline at end of file

Added: trunk/src/TM-SPARQL/sparql_constants.lisp
==============================================================================
--- (empty file)
+++ trunk/src/TM-SPARQL/sparql_constants.lisp	Tue Jan 25 12:46:43 2011
@@ -0,0 +1,35 @@
+;;+-----------------------------------------------------------------------------
+;;+  Isidorus
+;;+  (c) 2008-2010 Marc Kuester, Christoph Ludwig, Lukas Georgieff
+;;+
+;;+  Isidorus is freely distributable under the LLGPL license.
+;;+  You can find a detailed description in trunk/docs/LLGPL-LICENSE.txt and
+;;+  trunk/docs/LGPL-LICENSE.txt.
+;;+-----------------------------------------------------------------------------
+
+(defpackage :TM-SPARQL-Constants
+  (:use :cl :base-tools)
+  (:nicknames tms)
+  (:export :*tms*
+	   :*tms-reifier*
+	   :*tms-role*
+	   :*tms-player*
+	   :*tms-topicProperty*
+	   :*tms-scope*
+	   :*tms-value*))
+
+(in-package :TM-SPARQL-Constants)
+
+(defvar *tms* "http://www.networkedplanet.com/tmsparql/")
+
+(defvar *tms-reifier* (concat *tms* "reifier"))
+
+(defvar *tms-role* (concat *tms* "role"))
+
+(defvar *tms-player* (concat *tms* "player"))
+
+(defvar *tms-topicProperty* (concat *tms* "topicProperty"))
+
+(defvar *tms-scope* (concat *tms* "scope"))
+
+(defvar *tms-value* (concat *tms* "value"))
\ No newline at end of file

Added: trunk/src/TM-SPARQL/tmsparql_core_psis.xtm
==============================================================================
--- (empty file)
+++ trunk/src/TM-SPARQL/tmsparql_core_psis.xtm	Tue Jan 25 12:46:43 2011
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<!-- ======================================================================= -->
+<!--  Isidorus                                                               -->
+<!--  (c) 2008-2010 Marc Kuester, Christoph Ludwig, Lukas Georgieff          -->
+<!--                                                                         -->
+<!--  Isidorus is freely distributable under the LLGPL license.              -->
+<!--  This ajax module uses the frameworks PrototypeJs and Scriptaculous,    -->
+<!--  both are distributed under the MIT license.                            -->
+<!--  You can find a detailed description in trunk/docs/LLGPL-LICENSE.txt,   -->
+<!--  trunk/docs/LGPL-LICENSE.txt and in                                     -->
+<!--  trunk/src/ajax/javascripts/external/MIT-LICENSE.txt.                   -->
+<!-- ======================================================================= -->
+
+
+<!-- this file contains the special uri defined in tmsparql
+     (http://www.networkedplanet.com/ontopic/2009/11/making_topic_maps_sparql.html)
+     as topic with only a psi as element corresponding to those defined in
+     tmsparql -->
+
+<topicMap xmlns="http://www.topicmaps.org/xtm/" version="2.0">
+  <topic id="reifier">
+    <subjectIdentifier href="http://www.networkedplanet.com/tmsparql/reifier"/>
+  </topic>
+
+  <topic id="role">
+    <subjectIdentifier href="http://www.networkedplanet.com/tmsparql/role"/>
+  </topic>
+
+  <topic id="player">
+    <subjectIdentifier href="http://www.networkedplanet.com/tmsparql/player"/>
+  </topic>
+
+  <topic id="topicProperty">
+    <subjectIdentifier href="http://www.networkedplanet.com/tmsparql/topicProperty"/>
+  </topic>
+
+  <topic id="scope">
+    <subjectIdentifier href="http://www.networkedplanet.com/tmsparql/scope"/>
+  </topic>
+
+  <topic id="value">
+    <subjectIdentifier href="http://www.networkedplanet.com/tmsparql/value"/>
+  </topic>
+
+</topicMap>

Modified: trunk/src/isidorus.asd
==============================================================================
--- trunk/src/isidorus.asd	(original)
+++ trunk/src/isidorus.asd	Tue Jan 25 12:46:43 2011
@@ -23,6 +23,7 @@
 		      :depends-on ("base-tools"))
                (:static-file "xml/xtm/core_psis.xtm")
 	       (:static-file "xml/rdf/rdf_core_psis.xtm")
+	       (:static-file "TM-SPARQL/tmsparql_core_psis.xtm")
 	       (:file "xml-constants" 
                       :depends-on ("xml/xtm/core_psis.xtm"
                                    "constants"))
@@ -40,14 +41,21 @@
                                             :depends-on ("exceptions")))
 			:depends-on ("constants" "base-tools"))
 	       (:module "TM-SPARQL"
-			:components ((:file "sparql")
+			:components ((:file "sparql_constants")
+				     (:file "sparql"
+					    :depends-on ("sparql_constants"))
 				     (:file "filter_wrappers"
 					    :depends-on ("sparql"))
 				     (:file "sparql_filter"
 					    :depends-on ("sparql" "filter_wrappers"))
 				     (:file "sparql_parser"
 					    :depends-on ("sparql" "sparql_filter")))
-			:depends-on ("constants" "base-tools" "model"))
+			:depends-on ("constants"
+				     "base-tools"
+				     "model"
+				     "xml-constants"
+				     "xml"
+				     "threading"))
 	       (:module "xml"
 			:components ((:module "xtm"
 					      :components ((:file "tools")

Modified: trunk/src/xml-constants.lisp
==============================================================================
--- trunk/src/xml-constants.lisp	(original)
+++ trunk/src/xml-constants.lisp	Tue Jan 25 12:46:43 2011
@@ -14,7 +14,8 @@
 		*isidorus-system*)
   (:export :*xml-component*
 	   :*core_psis.xtm*
-	   :*rdf_core_psis.xtm*))
+	   :*rdf_core_psis.xtm*
+	   :*tmsparql_core_psis.xtm*))
 
 (in-package :xml-constants)
 
@@ -27,4 +28,8 @@
 
 (defparameter *rdf_core_psis.xtm*
   (asdf:component-pathname
-   (asdf:find-component *isidorus-system* "xml/rdf/rdf_core_psis.xtm")))
\ No newline at end of file
+   (asdf:find-component *isidorus-system* "xml/rdf/rdf_core_psis.xtm")))
+
+(defparameter *tmsparql_core_psis.xtm*
+  (asdf:component-pathname
+   (asdf:find-component *isidorus-system* "TM-SPARQL/tmsparql_core_psis.xtm")))
\ No newline at end of file




More information about the Isidorus-cvs mailing list