3 <filters xmlns="http://indexdata.com/metaproxy">
6 <!-- Which sparql server to use, our demo, or your local installation -->
7 <!--defaults uri="http://bibframe.indexdata.com/sparql/"/-->
8 <defaults uri="http://localhost:8890/sparql/"/>
10 <!-- "thing" database that will be included all real databases -->
11 <db path="thing"> <!-- no schema, so it is not directly searchable -->
12 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
13 <prefix>bf: http://bibframe.org/vocab/</prefix>
14 <form>SELECT DISTINCT ?thing </form>
16 <!-- Common indexes -->
18 <!-- bf.uri is a simple way to get to a thing -->
20 ?thing rdf:type ?any FILTER( ?thing = %u )
23 <!-- bf.type is a simple way to search for types -->
24 <!-- for example, a bf.Work can also be bf:Text or bf:Audio -->
25 <index type="bf.type">
29 <!-- The BF-L present format is the same for everything -->
30 <!-- Each db is supposed to provide a dedicated BF-V present format -->
42 <!-- "smallindex" db that will be included in work and instance -->
43 <!-- It provides the small indexes like bf.person, bf.place, etc -->
44 <!-- These match a person, etc, no matter what the relation to that -->
45 <!-- is, as long as there is a direct link -->
46 <!-- The %v gets assigned a new variable name, like ?v0. -->
47 <!-- The %vx gets the same ?v0, with the x suffixed to it, by regular -->
48 <!-- This way, we use a different variable for each index clause, and -->
49 <!-- do not get into trouble if we have an AND between two of the same kind -->
50 <db path="smallindex">
51 <index type="bf.personX">
54 %vx bf:label %v FILTER(contains(%v, %s))
56 <index type="bf.topic">
59 %vx bf:label %v FILTER(contains(%v, %s))
61 <index type="bf.place">
64 %vx bf:label %v FILTER(contains(%v, %s))
66 <index type="bf.agent">
69 %vx bf:label %v FILTER(contains(%v, %s))
71 <index type="bf.meeting">
74 %vx bf:label %v FILTER(contains(%v, %s))
76 <index type="bf.organization">
78 %vx a bf:Organization .
79 %vx bf:label %v FILTER(contains(%v, %s))
81 <index type="bf.event">
84 %vx bf:label %v FILTER(contains(%v, %s))
88 <!-- work database -->
90 <db path="work" schema="sparql-results" include="thing smallindex">
92 <!-- The search clause just finds ?things, present is done below -->
93 <criteria>?thing a bf:Work</criteria>
95 <!-- Title indexes -->
96 <!-- These are messy, there are so many ways to get to a title -->
98 <!-- Main title. Looks logical, but in practice we have not seen -->
99 <!-- many of these -->
100 <index type="bf.title">
101 ?thing bf:title %v FILTER(contains(%v, %s))
104 <!-- worktitle.titleValue seems to be the most common way to -->
105 <!-- store the title of a work -->
106 <index type="bf.worktitle">
107 ?thing bf:workTitle %v_wt .
108 %v_wt bf:titleValue %v FILTER(contains(%v, %s))
111 <!-- Combining the two above, since users are not likely -->
112 <!-- to know how a given title has been indexed -->
113 <!-- TODO is "maintitle" a good name for this? I made it up myself -->
114 <index type="bf.maintitle">
116 ?thing bf:workTitle %v_wt .
117 %v_wt bf:titleValue %v FILTER(contains(%v, %s))
119 ?thing bf:title %v FILTER(contains(%v, %s))
123 <!-- the worktitle can also contain a subtitle and a parttitle -->
124 <index type="bf.subtitle">
125 ?thing bf:workTitle %v_wt .
126 %v_wt bf:subtitle %v FILTER(contains(%v, %s))
129 <index type="bf.parttitle">
130 ?thing bf:workTitle %v_wt .
131 %v_wt bf:partTitle %v FILTER(contains(%v, %s))
134 <!-- work.titlevariation - this could also have sub- and partTitles -->
135 <index type="bf.titlevariation">
136 ?thing bf:titleVariation %v_tv .
137 %v_tv bf:titleValue %v FILTER(contains(%v, %s))
140 <!-- Instance titles -->
141 <index type="bf.instancetitle">
142 %v_inst bf:instanceOf ?thing .
143 %v_inst bf:instanceTitle %v_tit .
144 %v_tit bf:titleValue %v FILTER(contains(%v, %s))
147 <!-- Combined title index. There are so many ways titles can be expresses
148 in Bibframe, this seems to cover most of what we have seen -->
149 <index type="bf.anytitle">
151 ?thing bf:title %v FILTER(contains(%v, %s))
152 } UNION { <!-- any kind of link -->
153 ?thing ?titlerel %v_ti . <!-- mostly workTitle, but others too -->
154 %v_ti a bf:Title <!-- to something that is a title -->
156 %v_ti bf:titleValue %v FILTER(contains(%v, %s))
158 %v_ti bf:partTitle %v FILTER(contains(%v, %s))
160 %v_ti bf:subtitle %v FILTER(contains(%v, %s))
163 %v_inst bf:instanceOf ?thing .
164 %v_inst bf:instanceTitle %v_ti .
165 %v_ti bf:titleValue %v FILTER(contains(%v, %s))
170 <!-- Author indexes. Much simpler than titles. -->
171 <index type="bf.creator">
172 ?thing bf:creator %v_c .
173 %v_c bf:label %v FILTER(contains(%v, %s))
176 <index type="bf.contributor">
177 ?thing bf:contributor %v_c .
178 %v_c bf:label %v FILTER(contains(%v, %s))
181 <index type="bf.anyauthor"> <!-- TODO - Is this a good name? -->
183 ?thing bf:creator %v_c .
184 %v_c bf:label %v FILTER(contains(%v, %s))
186 ?thing bf:contributor %v_c .
187 %v_c bf:label %v FILTER(contains(%v, %s))
192 <!-- Note that these refer to anything with a bf:subject relation -->
193 <!-- The actual item is likely to be something like topic person etc -->
194 <index type="bf.subject">
195 ?thing bf:subject %v_su .
196 %v_su bf:label %v FILTER(contains(%v, %s))
199 <!-- contentCategory can be searched with complete URIs like -->
200 <!-- http://id.loc.gov/vocabulary/contentTypes/txt -->
201 <index type="bf.contentcategory">
202 ?thing bf:contentCategory %u
205 <!-- Present formats -->
206 <!-- BF-L comes from the "thing" template -->
207 <!-- BF-V expands all links, even to instances but not other works -->
208 <present type="BF-V">
211 ?wobj1 ?wrel2 ?wobj2 .
212 ?wobj2 ?wrel3 ?wobj3 .
213 ?inst ?irel1 ?iobj1 .
214 ?iobj1 ?irel2 ?iobj2 .
223 MINUS { ?wobj1 a bf:Work }
224 MINUS { ?wobj1 a bf:Instance }
227 MINUS { ?wobj2 a bf:Work }
228 MINUS { ?wobj2 a bf:Instance }
231 <!-- Link to the instance(s) -->
233 ?inst bf:instanceOf %u .
237 MINUS { ?iobj1 a bf:Work }
238 MINUS { ?iobj1 a bf:Instance }
241 MINUS { ?iobj2 a bf:Work }
242 MINUS { ?iobj2 a bf:Instance }
250 <!-- Instance database -->
252 <db path="instance" schema="sparql-results" include="thing smallindex">
253 <criteria>?thing a bf:Instance</criteria>
255 <!-- Title indexes -->
256 <!-- These are messy, there are so many ways to get to a title -->
258 <!-- Main title. Looks logical. Many instances seem to have a title -->
259 <index type="bf.title">
260 ?thing bf:title %v FILTER(contains(%v, %s))
263 <!-- instancetitle is also pretty common -->
264 <index type="bf.instancetitle">
265 ?thing bf:instanceTitle %v_it .
266 %v_it bf:titleValue %v FILTER(contains(%v, %s))
269 <index type="bf.titlestatement">
270 ?thing bf:titleStatement %v FILTER(contains(%v, %s))
273 <!-- Combining the two above, since users are not likely to know how
274 a given title has been indexed -->
275 <index type="bf.maintitle">
277 ?thing bf:instanceTitle %v_it .
278 %v_it bf:titleValue %v FILTER(contains(%v, %s))
280 ?thing bf:title %v FILTER(contains(%v, %s))
285 <!-- the instancetitle can also contain a subtitle and a parttitle -->
286 <index type="bf.subtitle">
287 ?thing bf:instanceTitle %v_it .
288 %v_it bf:subtitle %v FILTER(contains(%v, %s))
291 <index type="bf.parttitle">
292 ?thing bf:instanceTitle %v_it .
293 %v_it bf:partTitle %v FILTER(contains(%v, %s))
295 <!-- We could also go to the works, and get those titles... -->
297 <!-- Combining any kind of title into one index -->
298 <index type="bf.anytitle">
300 ?thing bf:title %v FILTER(contains(%v, %s))
302 ?thing bf:titleStatement %v FILTER(contains(%v, %s))
304 ?thing ?titlerel %v_it . <!-- any kind of link -->
305 %v_it a bf:Title <!-- to something that is a title -->
307 %v_it bf:titleValue %v FILTER(contains(%v, %s))
309 %v_it bf:partTitle %v FILTER(contains(%v, %s))
311 %v_it bf:subtitle %v FILTER(contains(%v, %s))
316 <!-- Author indexes. Many instances don't have any, works do -->
317 <index type="bf.creator">
318 ?thing bf:creator %v_cr .
319 %v_cr bf:label %v FILTER(contains(%v, %s))
322 <index type="bf.workcreator">
323 ?thing bf:instanceOf %v_work .
324 %v_work bf:creator %v_cr .
325 %v_cr bf:label %v FILTER(contains(%v, %s))
328 <index type="bf.workcontributor">
329 ?thing bf:instanceOf %v_work .
330 %v_work bf:contributor %v_co .
331 %v_co bf:label %v FILTER(contains(%v, %s))
334 <index type="bf.contributor">
335 ?thing bf:contributor %v_co .
336 %v_co bf:label %v FILTER(contains(%v, %s))
339 <index type="bf.anyauthor">
341 ?thing bf:creator %v_cr .
342 %v_cr bf:label %v FILTER(contains(%v, %s))
344 ?thing bf:contributor %v_co .
345 %v_co bf:label %v FILTER(contains(%v, %s))
347 ?thing bf:instanceOf %v_work .
348 %v_work bf:creator %v_wcr .
349 %v_wcr bf:label %v FILTER(contains(%v, %s))
351 ?thing bf:instanceOf %v_work .
352 %v_work bf:contributor %v_wco .
353 %v_wco bf:label %v FILTER(contains(%v, %s))
357 <!-- isbn index. The Instance may contain a isbn10 or isbn13. -->
358 <!-- These can be literal values like -->
359 <!-- http://isbn.example.org/1906833214 which we need to search -->
360 <!-- by our usual substring match. Or they can be links to Identivfiers -->
361 <!-- which will have a proper identifierValue on which we can do -->
362 <!-- an exact match. -->
363 <index type="bf.isbn">
366 FILTER(isUri(%v) && contains(str(%v), %s))
369 FILTER(isUri(%v) && contains(str(%v), %s))
372 ?thing bf:isbn10 %v_isbn
374 ?thing bf:isbn13 %v_isbn
376 %v_isbn a bf:Identifier .
377 %v_isbn bf:identifierValue %v FILTER( %v = %s )
382 <!-- Present formats. BF-L comes from "thing" -->
383 <!-- Full instance, with the related work too -->
384 <present type="BF-V">
387 ?iobj1 ?irel2 ?iobj2 .
388 ?iobj2 ?irel3 ?iobj3 .
389 ?work ?wrel1 ?wobj1 .
390 ?wobj1 ?wrel2 ?wobj2 .
398 MINUS { ?iobj2 a bf:Work }
399 MINUS { ?iobj2 a bf:Instance } .
402 MINUS { ?iobj3 a bf:Work }
403 MINUS { ?iobj3 a bf:Instance }
406 OPTIONAL { <!-- Work -->
407 %u bf:instanceOf ?work .
408 ?work ?wrel1 ?wobj1 .
411 MINUS { ?wobj1 a bf:Work }
412 MINUS { ?wobj1 a bf:Instance } .
415 MINUS { ?wobj2 a bf:Work }
416 MINUS { ?wobj2 a bf:Instance }
425 <!-- Small databases -->
427 <!-- "small" contains all the things common to all small databases -->
428 <!-- It is only to be used as an include, it is not searchable, since -->
429 <!-- it has no schema atribute -->
430 <!-- It is divided into "smallbody", and a "small" that includes -->
431 <!-- the general indexes, so that title searches can include the body, -->
432 <!-- but have different "any" indexes -->
434 <db path="smallbody" include="thing">
435 <present type="BF-V">
436 <!-- I don't think we need more than one level -->
437 <!--for these simple databases -->
444 OPTIONAL { ?obj ?rel1 ?obj1 }
449 <!-- The combined "small" database defaults -->
450 <db path="small" include="smallbody">
452 ?thing bf:label %v FILTER(contains(%v, %s))
455 ?thing bf:label %v FILTER(contains(%v, %s))
459 <!-- Various "small" databases, leaning heavily on the defaults above -->
460 <db path="place" schema="sparql-results" include="small" >
461 <criteria>?thing a bf:Place</criteria>
462 <index type="bf.place">
463 ?thing bf:label %v FILTER(contains(%v, %s))
467 <db path="person" schema="sparql-results" include="small" >
468 <criteria>?thing a bf:Person</criteria>
469 <index type="bf.person">
470 ?thing bf:label %v FILTER(contains(%v, %s))
474 <db path="meeting" schema="sparql-results" include="small" >
475 <criteria>?thing a bf:Meeting</criteria>
476 <index type="bf.meeting">
477 ?thing bf:label %v FILTER(contains(%v, %s))
481 <db path="agent" schema="sparql-results" include="small" >
482 <criteria>?thing a bf:Agent</criteria>
483 <index type="bf.agent">
484 ?thing bf:label %v FILTER(contains(%v, %s))
488 <db path="event" schema="sparql-results" include="small" >
489 <criteria>?thing a bf:Event</criteria>
490 <index type="bf.event">
491 ?thing bf:label %v FILTER(contains(%v, %s))
495 <db path="organization" schema="sparql-results" include="small" >
496 <criteria>?thing a bf:Organization</criteria>
497 <index type="bf.organization">
498 ?thing bf:label %v FILTER(contains(%v, %s))
502 <db path="topic" schema="sparql-results" include="small" >
503 <criteria>?thing a bf:Topic</criteria>
504 <index type="bf.topic">
505 ?thing bf:label %v FILTER(contains(%v, %s))
509 <!-- Title search, for seatching Title objects. -->
510 <!-- Not sure if this is needed, but it is a nice example -->
511 <db path="title" schema="sparql-results" include="smallbody" >
512 <criteria>?thing a bf:Title</criteria>
516 ?thing bf:titleValue %v FILTER(contains(%v, %s))
518 ?thing bf:subtitle %v FILTER(contains(%v, %s))
520 ?thing bf:partTitle %v FILTER(contains(%v, %s))
526 ?thing bf:titleValue %v FILTER(contains(%v, %s))
528 ?thing bf:subtitle %v FILTER(contains(%v, %s))
530 ?thing bf:partTitle %v FILTER(contains(%v, %s))
534 <index type="bf.title">
535 ?thing bf:titleValue %v FILTER(contains(%v, %s))
538 <index type="bf.subtitle">
539 ?thing bf:subtitle %v FILTER(contains(%v, %s))
542 <index type="bf.parttitle">
543 ?thing bf:partTitle %v FILTER(contains(%v, %s))
547 <!-- A hack to be able to look at any triplet in the base -->
548 <!-- TODO - Switch to the new system, probably using "small" -->
549 <db path="node" schema="sparql-results">
550 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
551 <prefix>bf: http://bibframe.org/vocab/</prefix>
552 <form>SELECT ?node ?rel ?obj</form>
553 <index type="any">?node ?rel ?obj FILTER( str(?node) = %s )</index>
555 <!-- A way to see which triplets refers to a given uri. -->
556 <!-- TODO - Switch to the new system, probably using "small" -->
557 <db path="ref" schema="sparql-results">
558 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
559 <prefix>bf: http://bibframe.org/vocab/</prefix>
560 <form>SELECT ?node ?rel ?obj</form>
561 <index type="any">?node ?rel ?obj FILTER( str(?obj) = %s )</index>
566 <message>http</message>
567 <category apdu="true"/>
570 <filter type="http_client">
571 <x-forwarded-for>true</x-forwarded-for>