+ <!-- Small databases -->
+
+ <!-- "small" contains all the things common to all small databases -->
+ <!-- It is only to be used as an include, it is not searchable, since -->
+ <!-- it has no schema atribute -->
+ <!-- It is divided into "smallindex", "smallbody", and a "small" that includes
+ both, so that title searches can include the body, but have different indexes -->
+
+ <db path="smallindex">
+ <index type="any">?thing bf:label %v FILTER(contains(%v, %s))</index>
+ <index type="1016">?thing bf:label %v FILTER(contains(%v, %s))</index>
+ </db>
+
+ <db path="smallbody">
+ <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>
+ <criteria>?thing ?rel ?obj</criteria>
+ <present type="BF-L">
+ CONSTRUCT { %u ?rel ?obj }
+ WHERE {
+ %u ?rel ?obj .
+ }
+ </present>
+ <!-- Experimental, to get just the URIs out, in proper rdf. Probably not useful
+ <uri type="BF-U">
+ CONSTRUCT { %u bf:uri %u }
+ WHERE {
+ %u bf:label ?lbl .
+ }
+ </uri>
+ -->
+ <present type="BF-F">
+ <!-- I don't think we need more than one level for these simple
+ databases -->
+ CONSTRUCT { %u ?rel ?obj .
+ ?obj ?rel1 ?obj1 .
+ }
+ WHERE {
+ %u ?rel ?obj .
+ OPTIONAL { ?obj ?rel1 ?obj1 }
+ }
+ </present>
+ </db>
+ <db path="small" include="smallindex smallbody"/>
+
+ <db path="place" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Place</criteria>
+ <index type="bf.place">?thing bf:label %v FILTER(contains(%v, %s))</index>
+ </db>
+ <db path="person" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Person</criteria>
+ <index type="bf.person">?thing bf:label %v FILTER(contains(%v, %s))</index>
+ </db>
+ <db path="meeting" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Meeting</criteria>
+ <index type="bf.meeting">?thing bf:label %v FILTER(contains(%v, %s))</index>
+ </db>
+ <db path="agent" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Agent</criteria>
+ <index type="bf.agent">?thing bf:label %v FILTER(contains(%v, %s))</index>
+ </db>
+ <db path="event" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Event</criteria>
+ <index type="bf.event">?thing bf:label %v FILTER(contains(%v, %s))</index>
+ </db>
+ <db path="organization" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Organization</criteria>
+ <index type="bf.organization">?thing bf:label %v FILTER(contains(%v, %s))</index>
+ </db>
+ <db path="topic" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Topic</criteria>
+ <index type="bf.topic">?thing bf:label %v FILTER(contains(%v, %s))</index>
+ </db>
+
+ <!-- Title search, probably not needed. -->
+ <db path="title" schema="sparql-results" include="smallbody" >
+ <criteria>?thing a bf:Title</criteria>
+ <index type="any">
+ { ?thing bf:titleValue %v FILTER(contains(%v, %s)) } UNION
+ { ?thing bf:subtitle %v FILTER(contains(%v, %s)) } UNION
+ { ?thing bf:partTitle %v FILTER(contains(%v, %s)) }
+ </index>
+ <index type="1016">
+ { ?thing bf:titleValue %v FILTER(contains(%v, %s)) } UNION
+ { ?thing bf:subtitle %v FILTER(contains(%v, %s)) } UNION
+ { ?thing bf:partTitle %v FILTER(contains(%v, %s)) }
+ </index>
+ <index type="bf.title">?thing bf:titleValue %v FILTER(contains(%v, %s))</index>
+ <index type="bf.subtitle">?thing bf:subtitle %v FILTER(contains(%v, %s))</index>
+ <index type="bf.parttitle">?thing bf:partTitle %v FILTER(contains(%v, %s))</index>
+ </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>