LOC-6: Drop the "ref" db, integrate into "node"
[mp-sparql-moved-to-github.git] / bibframe / triplestore.xml
index ac5b492..1d02d80 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 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>
+
+            <!-- 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 -->
                     %v_isbn bf:identifierValue  %v FILTER( %v = %s )
                 }
             </index>
-            
+
             <!-- lccn number, a simpler index for id numbers -->
             <index type="bf.lccn">
                 ?thing bf:lccn %v_lccn .
                 %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>
+
+            <!-- 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 -->
             <index type="any">
                 ?thing ?rel ?obj FILTER( str(?thing) = %s )
             </index>
-        </db>
-        <!-- A way to see which triplets refers to a given uri. -->
-        <db path="ref" schema="sparql-results" include="smallbody">
-            <index type="any">
+            <index type="ref"> <!-- return any object that refers to %u-->
                 ?thing ?rel ?obj FILTER( str(?obj) = %s )
             </index>
         </db>
 
     <filter type="log">
         <message>http</message>
+<!--
         <category apdu="true"/>
+-->
     </filter>
-
     <filter type="http_client">
         <x-forwarded-for>true</x-forwarded-for>
     </filter>