Update schema and improve manual page MPSPARQL-29
[mp-sparql-moved-to-github.git] / bibframe / triplestore.xml
index 1d02d80..6a0cefb 100644 (file)
@@ -1,5 +1,38 @@
 <?xml version="1.0"?>
 
+<!-- 
+Mp-sparql example configuration
+
+This config file snippet is typically included from the main Metaproxy
+configuration. It sets up a simple chain that consists of the sparql 
+filter to translate the queries etc, and a http_client filter that is used
+to do the actual communication to the triple store.
+
+This config provides quite many databases, one for each major type of
+records. The most important are "work" and "instance". These have a great
+number of indexes.  There is a number of "small" databases like "person",
+"meeting" and "topic". These have one main index, named after the database
+name, for example "bf.person".  The "node" database can search for any node
+in the database, and "info" returns simple information about available
+databases.
+
+There are other databases defined in this file, but they are only used 
+internally, to be included in the real database definitions. All real,
+searchable databases have
+  schema="sparql-results"
+in the db tag, whereas those for include use only do not.
+
+All databases support the BF-L ("Link") schema, which returns the triples 
+of the nodes found in the database, without expanding anything. Most of them 
+also support BF-V ("Verbose") schema that expands those links to return a set
+of triples that is more or less self contained. A work, its instances, titles
+for all of them, authors, and their names, etc.
+
+
+
+
+-->
+
 <filters  xmlns="http://indexdata.com/metaproxy">
     <filter type="sparql">
 
@@ -9,7 +42,6 @@
 
         <!-- "thing" database that will be included all real databases -->
         <db path="thing">  <!-- no schema, so it is not directly searchable -->
-            <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
             <prefix>bf: http://bibframe.org/vocab/</prefix>
             <form>SELECT DISTINCT ?thing </form>
 
                 ?thing  a %t
             </index>
 
+            <!-- Find all nodes that refer to the given uri -->
+            <!-- useful after finding uris in the "small" bases -->
+            <!-- direct references only -->
+            <index type="bf.ref">
+                ?thing %v_rel %u
+            </index>
+
+
             <!-- The BF-L present format is the same for everything -->
             <!-- Each db is supposed to provide a dedicated BF-V present format -->
             <present type="BF-L">
@@ -48,7 +88,7 @@
         <!-- This way, we use a different variable for each index clause, and -->
         <!-- do not get into trouble if we have an AND between two of the same kind -->
         <db path="smallindex">
-            <index type="bf.personX">
+            <index type="bf.person">
                 ?thing ?rel %vx .
                 %vx a bf:Person .
                 %vx bf:label %v FILTER(contains(%v, %s))
                 %v_inst bf:instanceOf ?thing FILTER ( %v_inst = %u)
             </index>
 
-            <!-- Find all works that refer to the given uri -->
-            <!-- useful after finding uris in the "small" bases -->
-            <!-- direct references only -->
-            <index type="bf.ref">
-                ?thing %v_rel %u
-            </index>
-
             <!-- Present formats -->
             <!-- BF-L comes from the "thing" template -->
             <!-- BF-V expands all links, even to instances but not other works -->
                 ?thing bf:instanceOf %u
             </index>
 
-            <!-- Find all instances that refer to the given uri -->
-            <!-- useful after finding uris in the "small" bases -->
-            <index type="bf.ref">
-                ?thing %v_rel %u
-            </index>
 
             <!-- Present formats. BF-L comes from "thing" -->
             <!-- Full instance, with the related work too -->
         </db>
 
         <!-- A hack to be able to look at any triplet in the base -->
+        <!-- The indexes bf.uri and bf.ref can also come in handy here -->
         <db path="node" schema="sparql-results" include="smallbody">
             <index type="any">
                 ?thing ?rel ?obj FILTER( str(?thing) = %s )
             </index>
-            <index type="ref"> <!-- return any object that refers to %u-->
-                ?thing ?rel ?obj FILTER( str(?obj) = %s )
-            </index>
         </db>
+
     </filter>
 
     <filter type="log">
         <message>http</message>
-<!--
-        <category apdu="true"/>
--->
     </filter>
+
     <filter type="http_client">
         <x-forwarded-for>true</x-forwarded-for>
     </filter>