Towards LOC-7: Config example and experiments
authorHeikki Levanto <heikki@indexdata.dk>
Tue, 28 Apr 2015 09:29:08 +0000 (11:29 +0200)
committerHeikki Levanto <heikki@indexdata.dk>
Tue, 28 Apr 2015 09:29:08 +0000 (11:29 +0200)
bibframe/triplestore.xml

index 3f7d34c..6518c1f 100644 (file)
@@ -3,9 +3,62 @@
       <!-- Which sparql server to use, our demo, or your local installation -->
     <!--defaults uri="http://bibframe.indexdata.com/sparql/"/-->
     <defaults uri="http://localhost:8890/sparql/"/>
+
+    <!-- New structure: Any search in work returns just a list of records.
+         Present will make another request to the backend to get the fields
+         we want, depending on the schema. That part is not yet implemented -->
     <db path="work" schema="sparql-results">
       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
       <prefix>bf: http://bibframe.org/vocab/</prefix>
+      <form>SELECT DISTINCT ?work
+      </form>
+      <criteria>?work a bf:Work</criteria>
+      <!-- TODO: Many more indexes like the ones below-->
+      <index type="bf.title">?work bf:workTitle ?wt .
+          ?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
+      <index type="bf.creator">?work bf:creator ?c .
+          ?c bf:label %v FILTER(contains(%v, %s))</index>
+      <index type="bf.subject">?work bf:subject ?subject .
+          ?subject bf:label %v FILTER(contains(%v, %s))</index>
+      <!-- TODO: Define a query to return detailed information for each
+      schema. For example
+      <present shema="BF-L" results="sparql-results" >
+        <query>
+          SELECT ?sub ?rel ?obj
+          WHERE ?work ?rel ?obj FILTER( str(?work) = %s )
+        </query>
+           - or possibly "FILTER ( ?work = <%u> )" if we define %u to
+           expand to the unquoted URI of the work.
+           - Even better, with %u we can say something like
+              SELECT %u ?rel ?obj
+      </present>
+      -->
+    </db>
+
+    <!-- Experiments while waiting for the present queries to be implemented -->
+    <db path="onework-l" schema="sparql-results">
+      <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
+      <prefix>bf: http://bibframe.org/vocab/</prefix>
+      <form>SELECT ?work ?rel ?subj
+      </form>
+      <criteria>?work a bf:Work</criteria>
+      <criteria>?work ?rel ?obj</criteria>
+      <index type="any">?work ?rel ?obj FILTER( str(?work) = %s )</index>
+    </db>
+    <db path="onework-l-rdf" schema="rdf">
+      <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
+      <prefix>bf: http://bibframe.org/vocab/</prefix>
+      <form>CONSTRUCT { ?work ?rel ?subj }
+      </form>
+      <criteria>?work a bf:Work</criteria>
+      <criteria>?work ?rel ?subj</criteria>
+      <index type="any">?work ?rel ?obj FILTER( str(?work) = %s )</index>
+    </db>
+
+    <!-- This is the old "work" db that will not scale. May be removed -->
+    <db path="concatwork" schema="sparql-results">
+      <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
+      <prefix>bf: http://bibframe.org/vocab/</prefix>
       <form>SELECT
               ?work
               (sql:GROUP_DIGEST (?wtitle, ' ; ', 1000, 1)) AS ?title
@@ -36,7 +89,8 @@
       </index>
       <modifier>GROUP BY $work</modifier>
     </db>
-    <db path="works" schema="rdf">
+
+    <db path="works" schema="rdf">  <!-- May be removed, will not scale -->
       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
       <prefix>bf: http://bibframe.org/vocab/</prefix>
       <form>CONSTRUCT { 
       <criteria>?subject bf:label ?subjectlabel</criteria>
       <index type="21">?subject bf:label %v FILTER(contains(%v, %s))</index>
     </db>
+
+    <!-- Instance searches, need to be refined later -->
     <db path="instance" schema="sparql-results">
       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
       <prefix>bf: http://bibframe.org/vocab/</prefix>
       <criteria>?instance bf:format ?format</criteria>
       <index type="1013">?instance bf:format %s</index>
     </db>
+
+    <!-- Simple databases -->
     <db path="place" schema="sparql-results">
       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
       <prefix>bf: http://bibframe.org/vocab/</prefix>
       <index type="bf.topic">?topic bf:label %v FILTER(contains(%v, %s))</index>
       <index type="any">?topic bf:label %v FILTER(contains(%v, %s))</index>
     </db>
+
+    <!-- Title search, probably not needed. Will need to be rewritten to the same
+    system as the work search above, with separate present query -->
     <db path="title" schema="sparql-results">
         <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
         <prefix>bf: http://bibframe.org/vocab/</prefix>