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 <db path="smallindex">
45 <!-- Indexes for persons, organizations, etc -->
46 <!-- The person (etc) may be in any relation to the thing, -->
47 <!-- subject, creator, etc, as long as there is a direct link -->
48 <index type="bf.person">
51 ?person bf:label %v FILTER(contains(%v, %s))
53 <!-- TODO - make many more like the person above -->
56 <!-- work database -->
58 <db path="work" schema="sparql-results" include="thing smallindex">
60 <!-- The search clause just finds ?things, present is done below -->
61 <criteria>?thing a bf:Work</criteria>
63 <!-- Title indexes -->
64 <!-- These are messy, there are so many ways to get to a title -->
66 <!-- Main title. Looks logical, but in practice we have not seen -->
67 <!-- many of these -->
68 <index type="bf.title">
69 ?thing bf:title %v FILTER(contains(%v, %s))
72 <!-- worktitle.titleValue seems to be the most common way to -->
73 <!-- store the title of a work -->
74 <index type="bf.worktitle">
75 ?thing bf:workTitle ?wt .
76 ?wt bf:titleValue %v FILTER(contains(%v, %s))
79 <!-- Combining the two above, since users are not likely -->
80 <!-- to know how a given title has been indexed -->
81 <!-- TODO is "maintitle" a good name for this? I made it up myself -->
82 <index type="bf.maintitle">
84 ?thing bf:workTitle ?wt .
85 ?wt bf:titleValue %v FILTER(contains(%v, %s))
87 ?thing bf:title %v FILTER(contains(%v, %s))
91 <!-- the worktitle can also contain a subtitle and a parttitle -->
92 <index type="bf.subtitle">?thing bf:workTitle ?wt .
93 ?wt bf:subtitle %v FILTER(contains(%v, %s))
96 <index type="bf.parttitle">
97 ?thing bf:workTitle ?wt .
98 ?wt bf:partTitle %v FILTER(contains(%v, %s))
101 <!-- work.titlevariation - this could also have sub- and partTitles -->
102 <index type="bf.titlevariation">
103 ?thing bf:titleVariation ?tv .
104 ?tv bf:titleValue %v FILTER(contains(%v, %s))
107 <!-- Instance titles -->
108 <index type="bf.instancetitle">
109 ?inst bf:instanceOf ?thing .
110 ?inst bf:instanceTitle ?it .
111 ?it bf:titleValue %v FILTER(contains(%v, %s))
114 <!-- Combined title index. There are so many ways titles can be expresses
115 in Bibframe, this seems to cover most of what we have seen -->
116 <index type="bf.anytitle">
118 ?thing bf:title %v FILTER(contains(%v, %s))
119 } UNION { <!-- any kind of link -->
120 ?thing ?titlerel ?ti . <!-- mostly workTitle, but others too -->
121 ?ti a bf:Title <!-- to something that is a title -->
123 ?ti bf:titleValue %v FILTER(contains(%v, %s))
125 ?ti bf:partTitle %v FILTER(contains(%v, %s))
127 ?ti bf:subtitle %v FILTER(contains(%v, %s))
130 ?inst bf:instanceOf ?thing .
131 ?inst bf:instanceTitle ?it .
132 ?it bf:titleValue %v FILTER(contains(%v, %s))
137 <!-- Author indexes. Much simpler than titles. -->
138 <index type="bf.creator">
139 ?thing bf:creator ?c .
140 ?c bf:label %v FILTER(contains(%v, %s))
143 <index type="bf.contributor">
144 ?thing bf:contributor ?c .
145 ?c bf:label %v FILTER(contains(%v, %s))
148 <index type="bf.anyauthor"> <!-- TODO - Is this a good name? -->
150 ?thing bf:creator ?c .
151 ?c bf:label %v FILTER(contains(%v, %s))
153 ?thing bf:contributor ?c .
154 ?c bf:label %v FILTER(contains(%v, %s))
159 <!-- Note that these refer to anything with a bf:subject relation -->
160 <!-- The actual item is likely to be something like topic person etc -->
161 <index type="bf.subject">
162 ?thing bf:subject ?subject .
163 ?subject bf:label %v FILTER(contains(%v, %s))
166 <!-- contentCategory can be searched with complete URIs like -->
167 <!-- http://id.loc.gov/vocabulary/contentTypes/txt -->
168 <index type="bf.contentcategory">
169 ?thing bf:contentCategory %u
172 <!-- Present formats -->
173 <!-- BF-L comes from the "thing" template -->
174 <!-- BF-V expands all links, even to instances but not other works -->
175 <present type="BF-V">
178 ?wobj1 ?wrel2 ?wobj2 .
179 ?wobj2 ?wrel3 ?wobj3 .
180 ?inst ?irel1 ?iobj1 .
181 ?iobj1 ?irel2 ?iobj2 .
190 MINUS { ?wobj1 a bf:Work }
191 MINUS { ?wobj1 a bf:Instance }
194 MINUS { ?wobj2 a bf:Work }
195 MINUS { ?wobj2 a bf:Instance }
198 <!-- Link to the instance(s) -->
200 ?inst bf:instanceOf %u .
204 MINUS { ?iobj1 a bf:Work }
205 MINUS { ?iobj1 a bf:Instance }
208 MINUS { ?iobj2 a bf:Work }
209 MINUS { ?iobj2 a bf:Instance }
217 <!-- Instance database -->
219 <db path="instance" schema="sparql-results" include="thing smallindex">
220 <criteria>?thing a bf:Instance</criteria>
222 <!-- Title indexes -->
223 <!-- These are messy, there are so many ways to get to a title -->
225 <!-- Main title. Looks logical. Many instances seem to have a title -->
226 <index type="bf.title">
227 ?thing bf:title %v FILTER(contains(%v, %s))
230 <!-- instancetitle is also pretty common -->
231 <index type="bf.instancetitle">
232 ?thing bf:instanceTitle ?it .
233 ?it bf:titleValue %v FILTER(contains(%v, %s))
236 <index type="bf.titlestatement">
237 ?thing bf:titleStatement %v FILTER(contains(%v, %s))
240 <!-- Combining the two above, since users are not likely to know how
241 a given title has been indexed -->
242 <index type="bf.maintitle">
244 ?thing bf:instanceTitle ?it .
245 ?it bf:titleValue %v FILTER(contains(%v, %s))
247 ?thing bf:title %v FILTER(contains(%v, %s))
252 <!-- the instancetitle can also contain a subtitle and a parttitle -->
253 <index type="bf.subtitle">
254 ?thing bf:instanceTitle ?it .
255 ?it bf:subtitle %v FILTER(contains(%v, %s))
258 <index type="bf.parttitle">
259 ?thing bf:instanceTitle ?it .
260 ?it bf:partTitle %v FILTER(contains(%v, %s))
262 <!-- We could also go to the works, and get those titles... -->
264 <!-- Combining any kind of title into one index -->
265 <index type="bf.anytitle">
267 ?thing bf:title %v FILTER(contains(%v, %s))
269 ?thing bf:titleStatement %v FILTER(contains(%v, %s))
271 ?thing ?titlerel ?it . <!-- any kind of link -->
272 ?it a bf:Title <!-- to something that is a title -->
274 ?it bf:titleValue %v FILTER(contains(%v, %s))
276 ?it bf:partTitle %v FILTER(contains(%v, %s))
278 ?it bf:subtitle %v FILTER(contains(%v, %s))
283 <!-- Author indexes. Many instances don't have any, works do -->
284 <index type="bf.creator">
285 ?thing bf:creator ?c .
286 ?c bf:label %v FILTER(contains(%v, %s))
289 <index type="bf.workcreator">
290 ?thing bf:instanceOf ?work .
291 ?work bf:creator ?c .
292 ?c bf:label %v FILTER(contains(%v, %s))
295 <index type="bf.workcontributor">
296 ?thing bf:instanceOf ?work .
297 ?work bf:contributor ?c .
298 ?c bf:label %v FILTER(contains(%v, %s))
301 <index type="bf.contributor">
302 ?thing bf:contributor ?c .
303 ?c bf:label %v FILTER(contains(%v, %s))
306 <index type="bf.anyauthor">
308 ?thing bf:creator ?c .
309 ?c bf:label %v FILTER(contains(%v, %s))
311 ?thing bf:contributor ?c .
312 ?c bf:label %v FILTER(contains(%v, %s))
314 ?thing bf:instanceOf ?work .
315 ?work bf:creator ?c .
316 ?c bf:label %v FILTER(contains(%v, %s))
318 ?thing bf:instanceOf ?work .
319 ?work bf:contributor ?c .
320 ?c bf:label %v FILTER(contains(%v, %s))
324 <!-- isbn index. The Instance may contain a isbn10 or isbn13. -->
325 <!-- These can be literal values like -->
326 <!-- http://isbn.example.org/1906833214 which we need to search -->
327 <!-- by our usual substring match. Or they can be links to Identivfiers -->
328 <!-- which will have a proper identifierValue on which we can do -->
329 <!-- an exact match. -->
330 <index type="bf.isbn">
333 FILTER(isUri(%v) && contains(str(%v), %s))
336 FILTER(isUri(%v) && contains(str(%v), %s))
339 ?thing bf:isbn10 ?isbn
341 ?thing bf:isbn13 ?isbn
343 ?isbn a bf:Identifier .
344 ?isbn bf:identifierValue %v FILTER( %v = %s )
349 <!-- Present formats. BF-L comes from "thing" -->
350 <!-- Full instance, with the related work too -->
351 <present type="BF-V">
354 ?iobj1 ?irel2 ?iobj2 .
355 ?iobj2 ?irel3 ?iobj3 .
356 ?work ?wrel1 ?wobj1 .
357 ?wobj1 ?wrel2 ?wobj2 .
365 MINUS { ?iobj2 a bf:Work }
366 MINUS { ?iobj2 a bf:Instance } .
369 MINUS { ?iobj3 a bf:Work }
370 MINUS { ?iobj3 a bf:Instance }
373 OPTIONAL { <!-- Work -->
374 %u bf:instanceOf ?work .
375 ?work ?wrel1 ?wobj1 .
378 MINUS { ?wobj1 a bf:Work }
379 MINUS { ?wobj1 a bf:Instance } .
382 MINUS { ?wobj2 a bf:Work }
383 MINUS { ?wobj2 a bf:Instance }
392 <!-- Small databases -->
394 <!-- "small" contains all the things common to all small databases -->
395 <!-- It is only to be used as an include, it is not searchable, since -->
396 <!-- it has no schema atribute -->
397 <!-- It is divided into "smallbody", and a "small" that includes -->
398 <!-- the general indexes, so that title searches can include the body, -->
399 <!-- but have different "any" indexes -->
401 <db path="smallbody" include="thing">
402 <present type="BF-V">
403 <!-- I don't think we need more than one level -->
404 <!--for these simple databases -->
411 OPTIONAL { ?obj ?rel1 ?obj1 }
416 <!-- The combined "small" database defaults -->
417 <db path="small" include="smallbody">
419 ?thing bf:label %v FILTER(contains(%v, %s))
422 ?thing bf:label %v FILTER(contains(%v, %s))
426 <!-- Various "small" databases, leaning heavily on the defaults above -->
427 <db path="place" schema="sparql-results" include="small" >
428 <criteria>?thing a bf:Place</criteria>
429 <index type="bf.place">
430 ?thing bf:label %v FILTER(contains(%v, %s))
434 <db path="person" schema="sparql-results" include="small" >
435 <criteria>?thing a bf:Person</criteria>
436 <index type="bf.person">
437 ?thing bf:label %v FILTER(contains(%v, %s))
441 <db path="meeting" schema="sparql-results" include="small" >
442 <criteria>?thing a bf:Meeting</criteria>
443 <index type="bf.meeting">
444 ?thing bf:label %v FILTER(contains(%v, %s))
448 <db path="agent" schema="sparql-results" include="small" >
449 <criteria>?thing a bf:Agent</criteria>
450 <index type="bf.agent">
451 ?thing bf:label %v FILTER(contains(%v, %s))
455 <db path="event" schema="sparql-results" include="small" >
456 <criteria>?thing a bf:Event</criteria>
457 <index type="bf.event">
458 ?thing bf:label %v FILTER(contains(%v, %s))
462 <db path="organization" schema="sparql-results" include="small" >
463 <criteria>?thing a bf:Organization</criteria>
464 <index type="bf.organization">
465 ?thing bf:label %v FILTER(contains(%v, %s))
469 <db path="topic" schema="sparql-results" include="small" >
470 <criteria>?thing a bf:Topic</criteria>
471 <index type="bf.topic">
472 ?thing bf:label %v FILTER(contains(%v, %s))
476 <!-- Title search, for seatching Title objects. -->
477 <!-- Not sure if this is needed, but it is a nice example -->
478 <db path="title" schema="sparql-results" include="smallbody" >
479 <criteria>?thing a bf:Title</criteria>
483 ?thing bf:titleValue %v FILTER(contains(%v, %s))
485 ?thing bf:subtitle %v FILTER(contains(%v, %s))
487 ?thing bf:partTitle %v FILTER(contains(%v, %s))
493 ?thing bf:titleValue %v FILTER(contains(%v, %s))
495 ?thing bf:subtitle %v FILTER(contains(%v, %s))
497 ?thing bf:partTitle %v FILTER(contains(%v, %s))
501 <index type="bf.title">
502 ?thing bf:titleValue %v FILTER(contains(%v, %s))
505 <index type="bf.subtitle">
506 ?thing bf:subtitle %v FILTER(contains(%v, %s))
509 <index type="bf.parttitle">
510 ?thing bf:partTitle %v FILTER(contains(%v, %s))
514 <!-- A hack to be able to look at any triplet in the base -->
515 <!-- TODO - Switch to the new system, probably using "small" -->
516 <db path="node" schema="sparql-results">
517 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
518 <prefix>bf: http://bibframe.org/vocab/</prefix>
519 <form>SELECT ?node ?rel ?obj</form>
520 <index type="any">?node ?rel ?obj FILTER( str(?node) = %s )</index>
522 <!-- A way to see which triplets refers to a given uri. -->
523 <!-- TODO - Switch to the new system, probably using "small" -->
524 <db path="ref" schema="sparql-results">
525 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
526 <prefix>bf: http://bibframe.org/vocab/</prefix>
527 <form>SELECT ?node ?rel ?obj</form>
528 <index type="any">?node ?rel ?obj FILTER( str(?obj) = %s )</index>
533 <message>http</message>
534 <category apdu="true"/>
537 <filter type="http_client">
538 <x-forwarded-for>true</x-forwarded-for>