Checkout submodules as necessary MPSPARQL-23
[mp-sparql-moved-to-github.git] / bibframe / triplestore.xml
index a278f41..a3fb568 100644 (file)
@@ -17,7 +17,7 @@
 
             <!-- bf.uri is a simple way to get to a thing -->
             <index type="bf.uri">
-                ?thing  rdf:type ?any FILTER( ?thing  = %u )
+                ?thing  %v_rel %v_obj FILTER( ?thing  = %u )
             </index>
 
             <!-- bf.type is a simple way to search for types -->
                 ?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 +56,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 .
                     %v_inst bf:instanceTitle %v_ti .
                     %v_ti bf:titleValue %v FILTER(contains(%v, %s))
-                } UNION {
                 }
             </index>
 
                 ?thing bf:contentCategory %u
             </index>
 
+            <!-- Find the work that has a given Instance -->
+            <index type="bf.instance">
+                %v_inst bf:instanceOf ?thing FILTER ( %v_inst = %u)
+            </index>
+
             <!-- Present formats -->
             <!-- BF-L comes from the "thing" template -->
             <!-- BF-V expands all links, even to instances but not other works -->
                 }
             </index>
 
+            <!-- lccn number, a simpler index for id numbers -->
+            <index type="bf.lccn">
+                ?thing bf:lccn %v_lccn .
+                %v_lccn a bf:Identifier  .
+                %v_lccn bf:identifierValue  %v FILTER( %v = %s )
+            </index>
+
+            <!-- Find the instances of a given work -->
+            <index type="bf.work">
+                ?thing bf:instanceOf %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 -->
-        <!-- TODO - Switch to the new system, probably using "small" -->
-        <db path="node" 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 ?node ?rel ?obj</form>
-            <index type="any">?node ?rel ?obj FILTER( str(?node) = %s )</index>
-        </db>
-        <!-- A way to see which triplets refers to a given uri. -->
-        <!-- TODO - Switch to the new system, probably using "small" -->
-        <db path="ref" 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 ?node ?rel ?obj</form>
-            <index type="any">?node ?rel ?obj FILTER( str(?obj) = %s )</index>
+        <!-- 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>
         </db>
+
     </filter>
 
     <filter type="log">
         <message>http</message>
-        <category apdu="true"/>
     </filter>
 
     <filter type="http_client">