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 %v_rel %v_obj 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))
169 <!-- Author indexes. Much simpler than titles. -->
170 <index type="bf.creator">
171 ?thing bf:creator %v_c .
172 %v_c bf:label %v FILTER(contains(%v, %s))
175 <index type="bf.contributor">
176 ?thing bf:contributor %v_c .
177 %v_c bf:label %v FILTER(contains(%v, %s))
180 <index type="bf.anyauthor"> <!-- TODO - Is this a good name? -->
182 ?thing bf:creator %v_c .
183 %v_c bf:label %v FILTER(contains(%v, %s))
185 ?thing bf:contributor %v_c .
186 %v_c bf:label %v FILTER(contains(%v, %s))
191 <!-- Note that these refer to anything with a bf:subject relation -->
192 <!-- The actual item is likely to be something like topic person etc -->
193 <index type="bf.subject">
194 ?thing bf:subject %v_su .
195 %v_su bf:label %v FILTER(contains(%v, %s))
198 <!-- contentCategory can be searched with complete URIs like -->
199 <!-- http://id.loc.gov/vocabulary/contentTypes/txt -->
200 <index type="bf.contentcategory">
201 ?thing bf:contentCategory %u
204 <!-- Find the work that has a given Instance -->
205 <index type="bf.instance">
206 %v_inst bf:instanceOf ?thing FILTER ( %v_inst = %u)
209 <!-- Find all works that refer to the given uri -->
210 <!-- useful after finding uris in the "small" bases -->
211 <!-- direct references only -->
212 <index type="bf.ref">
216 <!-- Present formats -->
217 <!-- BF-L comes from the "thing" template -->
218 <!-- BF-V expands all links, even to instances but not other works -->
219 <present type="BF-V">
222 ?wobj1 ?wrel2 ?wobj2 .
223 ?wobj2 ?wrel3 ?wobj3 .
224 ?inst ?irel1 ?iobj1 .
225 ?iobj1 ?irel2 ?iobj2 .
234 MINUS { ?wobj1 a bf:Work }
235 MINUS { ?wobj1 a bf:Instance }
238 MINUS { ?wobj2 a bf:Work }
239 MINUS { ?wobj2 a bf:Instance }
242 <!-- Link to the instance(s) -->
244 ?inst bf:instanceOf %u .
248 MINUS { ?iobj1 a bf:Work }
249 MINUS { ?iobj1 a bf:Instance }
252 MINUS { ?iobj2 a bf:Work }
253 MINUS { ?iobj2 a bf:Instance }
261 <!-- Instance database -->
263 <db path="instance" schema="sparql-results" include="thing smallindex">
264 <criteria>?thing a bf:Instance</criteria>
266 <!-- Title indexes -->
267 <!-- These are messy, there are so many ways to get to a title -->
269 <!-- Main title. Looks logical. Many instances seem to have a title -->
270 <index type="bf.title">
271 ?thing bf:title %v FILTER(contains(%v, %s))
274 <!-- instancetitle is also pretty common -->
275 <index type="bf.instancetitle">
276 ?thing bf:instanceTitle %v_it .
277 %v_it bf:titleValue %v FILTER(contains(%v, %s))
280 <index type="bf.titlestatement">
281 ?thing bf:titleStatement %v FILTER(contains(%v, %s))
284 <!-- Combining the two above, since users are not likely to know how
285 a given title has been indexed -->
286 <index type="bf.maintitle">
288 ?thing bf:instanceTitle %v_it .
289 %v_it bf:titleValue %v FILTER(contains(%v, %s))
291 ?thing bf:title %v FILTER(contains(%v, %s))
296 <!-- the instancetitle can also contain a subtitle and a parttitle -->
297 <index type="bf.subtitle">
298 ?thing bf:instanceTitle %v_it .
299 %v_it bf:subtitle %v FILTER(contains(%v, %s))
302 <index type="bf.parttitle">
303 ?thing bf:instanceTitle %v_it .
304 %v_it bf:partTitle %v FILTER(contains(%v, %s))
306 <!-- We could also go to the works, and get those titles... -->
308 <!-- Combining any kind of title into one index -->
309 <index type="bf.anytitle">
311 ?thing bf:title %v FILTER(contains(%v, %s))
313 ?thing bf:titleStatement %v FILTER(contains(%v, %s))
315 ?thing ?titlerel %v_it . <!-- any kind of link -->
316 %v_it a bf:Title <!-- to something that is a title -->
318 %v_it bf:titleValue %v FILTER(contains(%v, %s))
320 %v_it bf:partTitle %v FILTER(contains(%v, %s))
322 %v_it bf:subtitle %v FILTER(contains(%v, %s))
327 <!-- Author indexes. Many instances don't have any, works do -->
328 <index type="bf.creator">
329 ?thing bf:creator %v_cr .
330 %v_cr bf:label %v FILTER(contains(%v, %s))
333 <index type="bf.workcreator">
334 ?thing bf:instanceOf %v_work .
335 %v_work bf:creator %v_cr .
336 %v_cr bf:label %v FILTER(contains(%v, %s))
339 <index type="bf.workcontributor">
340 ?thing bf:instanceOf %v_work .
341 %v_work bf:contributor %v_co .
342 %v_co bf:label %v FILTER(contains(%v, %s))
345 <index type="bf.contributor">
346 ?thing bf:contributor %v_co .
347 %v_co bf:label %v FILTER(contains(%v, %s))
350 <index type="bf.anyauthor">
352 ?thing bf:creator %v_cr .
353 %v_cr bf:label %v FILTER(contains(%v, %s))
355 ?thing bf:contributor %v_co .
356 %v_co bf:label %v FILTER(contains(%v, %s))
358 ?thing bf:instanceOf %v_work .
359 %v_work bf:creator %v_wcr .
360 %v_wcr bf:label %v FILTER(contains(%v, %s))
362 ?thing bf:instanceOf %v_work .
363 %v_work bf:contributor %v_wco .
364 %v_wco bf:label %v FILTER(contains(%v, %s))
368 <!-- isbn index. The Instance may contain a isbn10 or isbn13. -->
369 <!-- These can be literal values like -->
370 <!-- http://isbn.example.org/1906833214 which we need to search -->
371 <!-- by our usual substring match. Or they can be links to Identivfiers -->
372 <!-- which will have a proper identifierValue on which we can do -->
373 <!-- an exact match. -->
374 <index type="bf.isbn">
377 FILTER(isUri(%v) && contains(str(%v), %s))
380 FILTER(isUri(%v) && contains(str(%v), %s))
383 ?thing bf:isbn10 %v_isbn
385 ?thing bf:isbn13 %v_isbn
387 %v_isbn a bf:Identifier .
388 %v_isbn bf:identifierValue %v FILTER( %v = %s )
392 <!-- lccn number, a simpler index for id numbers -->
393 <index type="bf.lccn">
394 ?thing bf:lccn %v_lccn .
395 %v_lccn a bf:Identifier .
396 %v_lccn bf:identifierValue %v FILTER( %v = %s )
399 <!-- Find the instances of a given work -->
400 <index type="bf.work">
401 ?thing bf:instanceOf %u
404 <!-- Find all instances that refer to the given uri -->
405 <!-- useful after finding uris in the "small" bases -->
406 <index type="bf.ref">
410 <!-- Present formats. BF-L comes from "thing" -->
411 <!-- Full instance, with the related work too -->
412 <present type="BF-V">
415 ?iobj1 ?irel2 ?iobj2 .
416 ?iobj2 ?irel3 ?iobj3 .
417 ?work ?wrel1 ?wobj1 .
418 ?wobj1 ?wrel2 ?wobj2 .
426 MINUS { ?iobj2 a bf:Work }
427 MINUS { ?iobj2 a bf:Instance } .
430 MINUS { ?iobj3 a bf:Work }
431 MINUS { ?iobj3 a bf:Instance }
434 OPTIONAL { <!-- Work -->
435 %u bf:instanceOf ?work .
436 ?work ?wrel1 ?wobj1 .
439 MINUS { ?wobj1 a bf:Work }
440 MINUS { ?wobj1 a bf:Instance } .
443 MINUS { ?wobj2 a bf:Work }
444 MINUS { ?wobj2 a bf:Instance }
453 <!-- Small databases -->
455 <!-- "small" contains all the things common to all small databases -->
456 <!-- It is only to be used as an include, it is not searchable, since -->
457 <!-- it has no schema atribute -->
458 <!-- It is divided into "smallbody", and a "small" that includes -->
459 <!-- the general indexes, so that title searches can include the body, -->
460 <!-- but have different "any" indexes -->
462 <db path="smallbody" include="thing">
463 <present type="BF-V">
464 <!-- I don't think we need more than one level -->
465 <!--for these simple databases -->
472 OPTIONAL { ?obj ?rel1 ?obj1 }
477 <!-- The combined "small" database defaults -->
478 <db path="small" include="smallbody">
480 ?thing bf:label %v FILTER(contains(%v, %s))
483 ?thing bf:label %v FILTER(contains(%v, %s))
487 <!-- Various "small" databases, leaning heavily on the defaults above -->
488 <db path="place" schema="sparql-results" include="small" >
489 <criteria>?thing a bf:Place</criteria>
490 <index type="bf.place">
491 ?thing bf:label %v FILTER(contains(%v, %s))
495 <db path="person" schema="sparql-results" include="small" >
496 <criteria>?thing a bf:Person</criteria>
497 <index type="bf.person">
498 ?thing bf:label %v FILTER(contains(%v, %s))
502 <db path="meeting" schema="sparql-results" include="small" >
503 <criteria>?thing a bf:Meeting</criteria>
504 <index type="bf.meeting">
505 ?thing bf:label %v FILTER(contains(%v, %s))
509 <db path="agent" schema="sparql-results" include="small" >
510 <criteria>?thing a bf:Agent</criteria>
511 <index type="bf.agent">
512 ?thing bf:label %v FILTER(contains(%v, %s))
516 <db path="event" schema="sparql-results" include="small" >
517 <criteria>?thing a bf:Event</criteria>
518 <index type="bf.event">
519 ?thing bf:label %v FILTER(contains(%v, %s))
523 <db path="organization" schema="sparql-results" include="small" >
524 <criteria>?thing a bf:Organization</criteria>
525 <index type="bf.organization">
526 ?thing bf:label %v FILTER(contains(%v, %s))
530 <db path="topic" schema="sparql-results" include="small" >
531 <criteria>?thing a bf:Topic</criteria>
532 <index type="bf.topic">
533 ?thing bf:label %v FILTER(contains(%v, %s))
537 <!-- Title search, for seatching Title objects. -->
538 <!-- Not sure if this is needed, but it is a nice example -->
539 <db path="title" schema="sparql-results" include="smallbody" >
540 <criteria>?thing a bf:Title</criteria>
544 ?thing bf:titleValue %v FILTER(contains(%v, %s))
546 ?thing bf:subtitle %v FILTER(contains(%v, %s))
548 ?thing bf:partTitle %v FILTER(contains(%v, %s))
554 ?thing bf:titleValue %v FILTER(contains(%v, %s))
556 ?thing bf:subtitle %v FILTER(contains(%v, %s))
558 ?thing bf:partTitle %v FILTER(contains(%v, %s))
562 <index type="bf.title">
563 ?thing bf:titleValue %v FILTER(contains(%v, %s))
566 <index type="bf.subtitle">
567 ?thing bf:subtitle %v FILTER(contains(%v, %s))
570 <index type="bf.parttitle">
571 ?thing bf:partTitle %v FILTER(contains(%v, %s))
575 <!-- A hack to be able to look at any triplet in the base -->
576 <db path="node" schema="sparql-results" include="smallbody">
578 ?thing ?rel ?obj FILTER( str(?thing) = %s )
581 <!-- A way to see which triplets refers to a given uri. -->
582 <db path="ref" schema="sparql-results" include="smallbody">
584 ?thing ?rel ?obj FILTER( str(?obj) = %s )
590 <message>http</message>
592 <category apdu="true"/>
595 <filter type="http_client">
596 <x-forwarded-for>true</x-forwarded-for>