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 <db path="smallindex">
47 <index type="bf.person">
50 ?person bf:label %v FILTER(contains(%v, %s))
52 <index type="bf.topic">
55 ?topic bf:label %v FILTER(contains(%v, %s))
57 <index type="bf.place">
60 ?place bf:label %v FILTER(contains(%v, %s))
62 <index type="bf.agent">
65 ?person bf:label %v FILTER(contains(%v, %s))
67 <index type="bf.meeting">
68 ?thing ?rel ?meeting .
69 ?meeting a bf:Meeting .
70 ?meeting bf:label %v FILTER(contains(%v, %s))
72 <index type="bf.organization">
73 ?thing ?rel ?organization .
74 ?organization a bf:Organization .
75 ?organization bf:label %v FILTER(contains(%v, %s))
77 <index type="bf.event">
80 ?event bf:label %v FILTER(contains(%v, %s))
84 <!-- work database -->
86 <db path="work" schema="sparql-results" include="thing smallindex">
88 <!-- The search clause just finds ?things, present is done below -->
89 <criteria>?thing a bf:Work</criteria>
91 <!-- Title indexes -->
92 <!-- These are messy, there are so many ways to get to a title -->
94 <!-- Main title. Looks logical, but in practice we have not seen -->
95 <!-- many of these -->
96 <index type="bf.title">
97 ?thing bf:title %v FILTER(contains(%v, %s))
100 <!-- worktitle.titleValue seems to be the most common way to -->
101 <!-- store the title of a work -->
102 <index type="bf.worktitle">
103 ?thing bf:workTitle ?wt .
104 ?wt bf:titleValue %v FILTER(contains(%v, %s))
107 <!-- Combining the two above, since users are not likely -->
108 <!-- to know how a given title has been indexed -->
109 <!-- TODO is "maintitle" a good name for this? I made it up myself -->
110 <index type="bf.maintitle">
112 ?thing bf:workTitle ?wt .
113 ?wt bf:titleValue %v FILTER(contains(%v, %s))
115 ?thing bf:title %v FILTER(contains(%v, %s))
119 <!-- the worktitle can also contain a subtitle and a parttitle -->
120 <index type="bf.subtitle">?thing bf:workTitle ?wt .
121 ?wt bf:subtitle %v FILTER(contains(%v, %s))
124 <index type="bf.parttitle">
125 ?thing bf:workTitle ?wt .
126 ?wt bf:partTitle %v FILTER(contains(%v, %s))
129 <!-- work.titlevariation - this could also have sub- and partTitles -->
130 <index type="bf.titlevariation">
131 ?thing bf:titleVariation ?tv .
132 ?tv bf:titleValue %v FILTER(contains(%v, %s))
135 <!-- Instance titles -->
136 <index type="bf.instancetitle">
137 ?inst bf:instanceOf ?thing .
138 ?inst bf:instanceTitle ?it .
139 ?it bf:titleValue %v FILTER(contains(%v, %s))
142 <!-- Combined title index. There are so many ways titles can be expresses
143 in Bibframe, this seems to cover most of what we have seen -->
144 <index type="bf.anytitle">
146 ?thing bf:title %v FILTER(contains(%v, %s))
147 } UNION { <!-- any kind of link -->
148 ?thing ?titlerel ?ti . <!-- mostly workTitle, but others too -->
149 ?ti a bf:Title <!-- to something that is a title -->
151 ?ti bf:titleValue %v FILTER(contains(%v, %s))
153 ?ti bf:partTitle %v FILTER(contains(%v, %s))
155 ?ti bf:subtitle %v FILTER(contains(%v, %s))
158 ?inst bf:instanceOf ?thing .
159 ?inst bf:instanceTitle ?it .
160 ?it bf:titleValue %v FILTER(contains(%v, %s))
165 <!-- Author indexes. Much simpler than titles. -->
166 <index type="bf.creator">
167 ?thing bf:creator ?c .
168 ?c bf:label %v FILTER(contains(%v, %s))
171 <index type="bf.contributor">
172 ?thing bf:contributor ?c .
173 ?c bf:label %v FILTER(contains(%v, %s))
176 <index type="bf.anyauthor"> <!-- TODO - Is this a good name? -->
178 ?thing bf:creator ?c .
179 ?c bf:label %v FILTER(contains(%v, %s))
181 ?thing bf:contributor ?c .
182 ?c bf:label %v FILTER(contains(%v, %s))
187 <!-- Note that these refer to anything with a bf:subject relation -->
188 <!-- The actual item is likely to be something like topic person etc -->
189 <index type="bf.subject">
190 ?thing bf:subject ?subject .
191 ?subject bf:label %v FILTER(contains(%v, %s))
194 <!-- contentCategory can be searched with complete URIs like -->
195 <!-- http://id.loc.gov/vocabulary/contentTypes/txt -->
196 <index type="bf.contentcategory">
197 ?thing bf:contentCategory %u
200 <!-- Present formats -->
201 <!-- BF-L comes from the "thing" template -->
202 <!-- BF-V expands all links, even to instances but not other works -->
203 <present type="BF-V">
206 ?wobj1 ?wrel2 ?wobj2 .
207 ?wobj2 ?wrel3 ?wobj3 .
208 ?inst ?irel1 ?iobj1 .
209 ?iobj1 ?irel2 ?iobj2 .
218 MINUS { ?wobj1 a bf:Work }
219 MINUS { ?wobj1 a bf:Instance }
222 MINUS { ?wobj2 a bf:Work }
223 MINUS { ?wobj2 a bf:Instance }
226 <!-- Link to the instance(s) -->
228 ?inst bf:instanceOf %u .
232 MINUS { ?iobj1 a bf:Work }
233 MINUS { ?iobj1 a bf:Instance }
236 MINUS { ?iobj2 a bf:Work }
237 MINUS { ?iobj2 a bf:Instance }
245 <!-- Instance database -->
247 <db path="instance" schema="sparql-results" include="thing smallindex">
248 <criteria>?thing a bf:Instance</criteria>
250 <!-- Title indexes -->
251 <!-- These are messy, there are so many ways to get to a title -->
253 <!-- Main title. Looks logical. Many instances seem to have a title -->
254 <index type="bf.title">
255 ?thing bf:title %v FILTER(contains(%v, %s))
258 <!-- instancetitle is also pretty common -->
259 <index type="bf.instancetitle">
260 ?thing bf:instanceTitle ?it .
261 ?it bf:titleValue %v FILTER(contains(%v, %s))
264 <index type="bf.titlestatement">
265 ?thing bf:titleStatement %v FILTER(contains(%v, %s))
268 <!-- Combining the two above, since users are not likely to know how
269 a given title has been indexed -->
270 <index type="bf.maintitle">
272 ?thing bf:instanceTitle ?it .
273 ?it bf:titleValue %v FILTER(contains(%v, %s))
275 ?thing bf:title %v FILTER(contains(%v, %s))
280 <!-- the instancetitle can also contain a subtitle and a parttitle -->
281 <index type="bf.subtitle">
282 ?thing bf:instanceTitle ?it .
283 ?it bf:subtitle %v FILTER(contains(%v, %s))
286 <index type="bf.parttitle">
287 ?thing bf:instanceTitle ?it .
288 ?it bf:partTitle %v FILTER(contains(%v, %s))
290 <!-- We could also go to the works, and get those titles... -->
292 <!-- Combining any kind of title into one index -->
293 <index type="bf.anytitle">
295 ?thing bf:title %v FILTER(contains(%v, %s))
297 ?thing bf:titleStatement %v FILTER(contains(%v, %s))
299 ?thing ?titlerel ?it . <!-- any kind of link -->
300 ?it a bf:Title <!-- to something that is a title -->
302 ?it bf:titleValue %v FILTER(contains(%v, %s))
304 ?it bf:partTitle %v FILTER(contains(%v, %s))
306 ?it bf:subtitle %v FILTER(contains(%v, %s))
311 <!-- Author indexes. Many instances don't have any, works do -->
312 <index type="bf.creator">
313 ?thing bf:creator ?c .
314 ?c bf:label %v FILTER(contains(%v, %s))
317 <index type="bf.workcreator">
318 ?thing bf:instanceOf ?work .
319 ?work bf:creator ?c .
320 ?c bf:label %v FILTER(contains(%v, %s))
323 <index type="bf.workcontributor">
324 ?thing bf:instanceOf ?work .
325 ?work bf:contributor ?c .
326 ?c bf:label %v FILTER(contains(%v, %s))
329 <index type="bf.contributor">
330 ?thing bf:contributor ?c .
331 ?c bf:label %v FILTER(contains(%v, %s))
334 <index type="bf.anyauthor">
336 ?thing bf:creator ?c .
337 ?c bf:label %v FILTER(contains(%v, %s))
339 ?thing bf:contributor ?c .
340 ?c bf:label %v FILTER(contains(%v, %s))
342 ?thing bf:instanceOf ?work .
343 ?work bf:creator ?c .
344 ?c bf:label %v FILTER(contains(%v, %s))
346 ?thing bf:instanceOf ?work .
347 ?work bf:contributor ?c .
348 ?c bf:label %v FILTER(contains(%v, %s))
352 <!-- isbn index. The Instance may contain a isbn10 or isbn13. -->
353 <!-- These can be literal values like -->
354 <!-- http://isbn.example.org/1906833214 which we need to search -->
355 <!-- by our usual substring match. Or they can be links to Identivfiers -->
356 <!-- which will have a proper identifierValue on which we can do -->
357 <!-- an exact match. -->
358 <index type="bf.isbn">
361 FILTER(isUri(%v) && contains(str(%v), %s))
364 FILTER(isUri(%v) && contains(str(%v), %s))
367 ?thing bf:isbn10 ?isbn
369 ?thing bf:isbn13 ?isbn
371 ?isbn a bf:Identifier .
372 ?isbn bf:identifierValue %v FILTER( %v = %s )
377 <!-- Present formats. BF-L comes from "thing" -->
378 <!-- Full instance, with the related work too -->
379 <present type="BF-V">
382 ?iobj1 ?irel2 ?iobj2 .
383 ?iobj2 ?irel3 ?iobj3 .
384 ?work ?wrel1 ?wobj1 .
385 ?wobj1 ?wrel2 ?wobj2 .
393 MINUS { ?iobj2 a bf:Work }
394 MINUS { ?iobj2 a bf:Instance } .
397 MINUS { ?iobj3 a bf:Work }
398 MINUS { ?iobj3 a bf:Instance }
401 OPTIONAL { <!-- Work -->
402 %u bf:instanceOf ?work .
403 ?work ?wrel1 ?wobj1 .
406 MINUS { ?wobj1 a bf:Work }
407 MINUS { ?wobj1 a bf:Instance } .
410 MINUS { ?wobj2 a bf:Work }
411 MINUS { ?wobj2 a bf:Instance }
420 <!-- Small databases -->
422 <!-- "small" contains all the things common to all small databases -->
423 <!-- It is only to be used as an include, it is not searchable, since -->
424 <!-- it has no schema atribute -->
425 <!-- It is divided into "smallbody", and a "small" that includes -->
426 <!-- the general indexes, so that title searches can include the body, -->
427 <!-- but have different "any" indexes -->
429 <db path="smallbody" include="thing">
430 <present type="BF-V">
431 <!-- I don't think we need more than one level -->
432 <!--for these simple databases -->
439 OPTIONAL { ?obj ?rel1 ?obj1 }
444 <!-- The combined "small" database defaults -->
445 <db path="small" include="smallbody">
447 ?thing bf:label %v FILTER(contains(%v, %s))
450 ?thing bf:label %v FILTER(contains(%v, %s))
454 <!-- Various "small" databases, leaning heavily on the defaults above -->
455 <db path="place" schema="sparql-results" include="small" >
456 <criteria>?thing a bf:Place</criteria>
457 <index type="bf.place">
458 ?thing bf:label %v FILTER(contains(%v, %s))
462 <db path="person" schema="sparql-results" include="small" >
463 <criteria>?thing a bf:Person</criteria>
464 <index type="bf.person">
465 ?thing bf:label %v FILTER(contains(%v, %s))
469 <db path="meeting" schema="sparql-results" include="small" >
470 <criteria>?thing a bf:Meeting</criteria>
471 <index type="bf.meeting">
472 ?thing bf:label %v FILTER(contains(%v, %s))
476 <db path="agent" schema="sparql-results" include="small" >
477 <criteria>?thing a bf:Agent</criteria>
478 <index type="bf.agent">
479 ?thing bf:label %v FILTER(contains(%v, %s))
483 <db path="event" schema="sparql-results" include="small" >
484 <criteria>?thing a bf:Event</criteria>
485 <index type="bf.event">
486 ?thing bf:label %v FILTER(contains(%v, %s))
490 <db path="organization" schema="sparql-results" include="small" >
491 <criteria>?thing a bf:Organization</criteria>
492 <index type="bf.organization">
493 ?thing bf:label %v FILTER(contains(%v, %s))
497 <db path="topic" schema="sparql-results" include="small" >
498 <criteria>?thing a bf:Topic</criteria>
499 <index type="bf.topic">
500 ?thing bf:label %v FILTER(contains(%v, %s))
504 <!-- Title search, for seatching Title objects. -->
505 <!-- Not sure if this is needed, but it is a nice example -->
506 <db path="title" schema="sparql-results" include="smallbody" >
507 <criteria>?thing a bf:Title</criteria>
511 ?thing bf:titleValue %v FILTER(contains(%v, %s))
513 ?thing bf:subtitle %v FILTER(contains(%v, %s))
515 ?thing bf:partTitle %v FILTER(contains(%v, %s))
521 ?thing bf:titleValue %v FILTER(contains(%v, %s))
523 ?thing bf:subtitle %v FILTER(contains(%v, %s))
525 ?thing bf:partTitle %v FILTER(contains(%v, %s))
529 <index type="bf.title">
530 ?thing bf:titleValue %v FILTER(contains(%v, %s))
533 <index type="bf.subtitle">
534 ?thing bf:subtitle %v FILTER(contains(%v, %s))
537 <index type="bf.parttitle">
538 ?thing bf:partTitle %v FILTER(contains(%v, %s))
542 <!-- A hack to be able to look at any triplet in the base -->
543 <!-- TODO - Switch to the new system, probably using "small" -->
544 <db path="node" schema="sparql-results">
545 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
546 <prefix>bf: http://bibframe.org/vocab/</prefix>
547 <form>SELECT ?node ?rel ?obj</form>
548 <index type="any">?node ?rel ?obj FILTER( str(?node) = %s )</index>
550 <!-- A way to see which triplets refers to a given uri. -->
551 <!-- TODO - Switch to the new system, probably using "small" -->
552 <db path="ref" schema="sparql-results">
553 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
554 <prefix>bf: http://bibframe.org/vocab/</prefix>
555 <form>SELECT ?node ?rel ?obj</form>
556 <index type="any">?node ?rel ?obj FILTER( str(?obj) = %s )</index>
561 <message>http</message>
562 <category apdu="true"/>
565 <filter type="http_client">
566 <x-forwarded-for>true</x-forwarded-for>