3 <!-- Entity definitions for commonly used idioms -->
4 <!-- TODO - Now it accepts these, but will not expand them in place! -->
5 <!-- Seems we can not use many special characters in these: <> % etc -->
6 <!ENTITY workfull "FOOBAR" >
10 MINUS { ?wobj a bf:Work }
11 MINUS { ?wobj a bf:Instance }
15 MINUS { ?wobj1 a bf:Work }
16 MINUS { ?wobj1 a bf:Instance }
20 MINUS { ?wobj2 a bf:Work }
21 MINUS { ?wobj2 a bf:Instance }
37 <filters xmlns="http://indexdata.com/metaproxy">
38 <filter type="sparql">
39 <!-- Which sparql server to use, our demo, or your local installation -->
40 <!--defaults uri="http://bibframe.indexdata.com/sparql/"/-->
41 <defaults uri="http://localhost:8890/sparql/"/>
43 <!-- work database -->
44 <db path="work" schema="sparql-results">
45 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
46 <prefix>bf: http://bibframe.org/vocab/</prefix>
47 <!-- The search clause just finds ?works, present is done below -->
48 <form>SELECT DISTINCT ?work </form>
49 <criteria>?work a bf:Work</criteria>
51 <!-- bf.uri is a simple way to get to a work -->
52 <index type="bf.uri"> ?work a bf:Work FILTER( ?work = %u ) </index>
54 <!-- Title indexes -->
55 <!-- These are messy, there are so many ways to get to a title -->
57 <!-- Main title. Looks logical, but in practice we have seen only a very
58 small number of these -->
59 <index type="bf.title">
60 ?work bf:title %v FILTER(contains(%v, %s))
63 <!-- worktitle seems to be the most common way to store the title of a work -->
64 <index type="bf.worktitle">
65 ?work bf:workTitle ?wt .
66 ?wt bf:titleValue %v FILTER(contains(%v, %s))
69 <!-- Combining the two above, since users are not likely to know how
70 a given title has been indexed -->
71 <index type="bf.maintitle">
73 ?work bf:workTitle ?wt .
74 ?wt bf:titleValue %v FILTER(contains(%v, %s))
76 ?work bf:title %v FILTER(contains(%v, %s))
81 <!-- the worktitle can also contain a subtitle and a parttitle -->
82 <index type="bf.subtitle">?work bf:workTitle ?wt .
83 ?wt bf:subtitle %v FILTER(contains(%v, %s))
86 <index type="bf.parttitle">
87 ?work bf:workTitle ?wt .
88 ?wt bf:partTitle %v FILTER(contains(%v, %s))
91 <!-- work.titlevariation - this could also have sub- and partTitles -->
92 <index type="bf.titlevariation">
93 ?work bf:titleVariation ?tv .
94 ?tv bf:titleValue %v FILTER(contains(%v, %s))
97 <!-- Instance titles -->
98 <index type="bf.instancetitle">
99 ?inst bf:instanceOf ?work .
100 ?inst bf:instanceTitle ?it .
101 ?it bf:titleValue %v FILTER(contains(%v, %s))
104 <!-- Combined title index. There are so many ways titles can be expresses
105 in Bibframe, this seems to cover most of what we have seen -->
106 <index type="bf.anytitle">
107 { ?work bf:workTitle ?wt .
108 { ?wt bf:titleValue %v FILTER(contains(%v, %s)) } UNION
109 { ?wt bf:subtitle %v FILTER(contains(%v, %s)) } UNION
110 { ?wt bf:partTitle %v FILTER(contains(%v, %s)) }
112 ?work bf:titleVariation ?tv .
113 ?tv bf:titleValue %v FILTER(contains(%v, %s))
115 ?inst bf:instanceOf ?work .
116 ?inst bf:instanceTitle ?it .
117 ?it bf:titleValue %v FILTER(contains(%v, %s))
119 ?work bf:title %v FILTER(contains(%v, %s))
123 <!-- Author indexes. Much simpler than titles. -->
124 <index type="bf.creator">
125 ?work bf:creator ?c .
126 ?c bf:label %v FILTER(contains(%v, %s))
129 <index type="bf.contributor">
130 ?work bf:contributor ?c .
131 ?c bf:label %v FILTER(contains(%v, %s))
134 <index type="bf.anyauthor">
136 ?work bf:creator ?c .
137 ?c bf:label %v FILTER(contains(%v, %s))
139 ?work bf:contributor ?c .
140 ?c bf:label %v FILTER(contains(%v, %s))
145 <index type="bf.subject">
146 ?work bf:subject ?subject .
147 ?subject bf:label %v FILTER(contains(%v, %s))
150 <!-- Indexes for persons, organizations, etc -->
151 <!-- The person (etc) may be in any relation to the work, subject,
152 creator, etc, as long as there is a direct link -->
153 <index type="bf.person">
155 ?person a bf:Person .
156 ?person bf:label %v FILTER(contains(%v, %s))
158 <!-- TODO - make many more like the person above -->
160 <!-- Present formats -->
161 <!-- BF-L is just the links -->
162 <present type="BF-L">
163 CONSTRUCT { ?work ?rel ?subj }
167 ?work ?rel ?subj FILTER( str(?work) = %s )
171 <!-- BF-F expands all links, except to instances and other works -->
172 <present type="BF-F">
173 CONSTRUCT { ?work ?rel ?obj .
182 MINUS { ?obj a bf:Work }
183 MINUS { ?obj a bf:Instance }
187 MINUS { ?obj1 a bf:Work }
188 MINUS { ?obj1 a bf:Instance }
192 MINUS { ?obj2 a bf:Work }
193 MINUS { ?obj2 a bf:Instance }
195 ?work ?rel ?obj FILTER( str(?work) = %s )
199 <!-- full, with instances. Experimental! -->
200 <present type="BF-FI">
201 CONSTRUCT { %u ?rel ?wobj1 .
202 ?wobj1 ?wrel1 ?wobj2 .
203 ?wobj2 ?wrel2 ?wobj3 .
204 ?inst ?irel1 ?iobj1 .
205 ?iobj1 ?irel2 ?iobj2 .
206 ?iobj2 ?irel3 ?iobj3 }
210 OPTIONAL { <!-- note, this is not in the final construct
211 the linking triplet will get included like any others -->
212 ?inst bf:instanceOf %u
214 &workfull; <!-- This does not seem to get expanded!! TODO -->
217 MINUS { ?wobj a bf:Work }
218 MINUS { ?wobj a bf:Instance }
222 MINUS { ?wobj1 a bf:Work }
223 MINUS { ?wobj1 a bf:Instance }
227 MINUS { ?wobj2 a bf:Work }
228 MINUS { ?wobj2 a bf:Instance }
245 <!-- Instance database -->
247 <db path="instance" schema="sparql-results">
248 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
249 <prefix>bf: http://bibframe.org/vocab/</prefix>
250 <!-- The search clause just finds ?insts, present is done below -->
251 <form>SELECT DISTINCT ?inst </form>
252 <criteria>?inst a bf:Instance</criteria>
254 <!-- bf.uri is a simple way to get to a work -->
255 <index type="bf.uri"> ?inst a bf:Instance FILTER( ?inst = %u ) </index>
257 <!-- Title indexes -->
258 <!-- These are messy, there are so many ways to get to a title -->
260 <!-- Main title. Looks logical. Many instances seem to have a title -->
261 <index type="bf.title">
262 ?inst bf:title %v FILTER(contains(%v, %s))
265 <!-- instancetitle is also pretty common -->
266 <index type="bf.instancetitle">
267 ?inst bf:instanceTitle ?it .
268 ?it bf:titleValue %v FILTER(contains(%v, %s))
271 <index type="bf.titlestatement">
272 ?inst bf:titleStatement %v FILTER(contains(%v, %s))
275 <!-- Combining the two above, since users are not likely to know how
276 a given title has been indexed -->
277 <index type="bf.maintitle">
279 ?inst bf:instanceTitle ?it .
280 ?it bf:titleValue %v FILTER(contains(%v, %s))
282 ?inst bf:title %v FILTER(contains(%v, %s))
287 <!-- the instancetitle can also contain a subtitle and a parttitle -->
288 <index type="bf.subtitle">
289 ?inst bf:instanceTitle ?it .
290 ?it bf:subtitle %v FILTER(contains(%v, %s))
293 <index type="bf.parttitle">
294 ?inst bf:instanceTitle ?it .
295 ?it bf:partTitle %v FILTER(contains(%v, %s))
297 <!-- We could also go to the works, and get those titles... -->
299 <!-- Combining any kind of title into one index -->
300 <index type="bf.anytitle">
302 ?inst bf:title %v FILTER(contains(%v, %s))
304 ?inst bf:titleStatement %v FILTER(contains(%v, %s))
306 ?inst ?titlerel ?it . <!-- any kind of link -->
307 ?it a bf:Title <!-- to something that is a title -->
309 ?it bf:titleValue %v FILTER(contains(%v, %s))
311 ?it bf:partTitle %v FILTER(contains(%v, %s))
313 ?it bf:subtitle %v FILTER(contains(%v, %s))
318 <!-- Author indexes. Many instances don't have any, works do -->
319 <index type="bf.creator">
320 ?inst bf:creator ?c .
321 ?c bf:label %v FILTER(contains(%v, %s))
324 <index type="bf.workcreator">
325 ?inst bf:instanceOf ?work .
326 ?work bf:creator ?c .
327 ?c bf:label %v FILTER(contains(%v, %s))
330 <index type="bf.workcontributor">
331 ?inst bf:instanceOf ?work .
332 ?work bf:contributor ?c .
333 ?c bf:label %v FILTER(contains(%v, %s))
336 <index type="bf.contributor">
337 ?inst bf:contributor ?c .
338 ?c bf:label %v FILTER(contains(%v, %s))
341 <index type="bf.anyauthor">
343 ?inst bf:creator ?c .
344 ?c bf:label %v FILTER(contains(%v, %s))
346 ?inst bf:contributor ?c .
347 ?c bf:label %v FILTER(contains(%v, %s))
349 ?inst bf:instanceOf ?work .
350 ?work bf:creator ?c .
351 ?c bf:label %v FILTER(contains(%v, %s))
353 ?inst bf:instanceOf ?work .
354 ?work bf:contributor ?c .
355 ?c bf:label %v FILTER(contains(%v, %s))
359 <!-- BF-L is just the links -->
360 <present type="BF-L">
361 CONSTRUCT { ?inst ?rel ?subj }
363 ?inst a bf:Instance .
365 ?inst ?rel ?subj FILTER( str(?inst) = %s )
369 <!-- Full instance, with the related work too -->
370 <present type="BF-F">
373 ?iobj1 ?irel2 ?iobj2 .
374 ?iobj2 ?irel3 ?iobj3 .
375 ?work ?wrel1 ?wobj1 .
376 ?wobj1 ?wrel2 ?wobj2 .
384 MINUS { ?iobj1 a bf:Work }
385 MINUS { ?iobj1 a bf:Instance }
388 MINUS { ?iobj2 a bf:Work }
389 MINUS { ?iobj2 a bf:Instance }
394 %u bf:instanceOf ?work
397 MINUS { ?wobj1 a bf:Work }
398 MINUS { ?wobj1 a bf:Instance }
401 MINUS { ?wobj2 a bf:Work }
402 MINUS { ?wobj2 a bf:Instance }
405 MINUS { ?wobj3 a bf:Work }
406 MINUS { ?wobj3 a bf:Instance }
416 <!-- Small databases -->
418 <!-- "small" contains all the things common to all small databases -->
419 <!-- It is only to be used as an include, it is not searchable, since -->
420 <!-- it has no schema atribute -->
421 <!-- It is divided into "smallindex", "smallbody", and a "small" that includes
422 both, so that title searches can include the body, but have different indexes -->
424 <db path="smallindex">
425 <index type="any">?thing bf:label %v FILTER(contains(%v, %s))</index>
426 <index type="1016">?thing bf:label %v FILTER(contains(%v, %s))</index>
429 <db path="smallbody">
430 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
431 <prefix>bf: http://bibframe.org/vocab/</prefix>
432 <form>SELECT DISTINCT ?thing </form>
433 <criteria>?thing ?rel ?obj</criteria>
434 <present type="BF-L">
435 CONSTRUCT { %u ?rel ?obj }
440 <!-- Experimental, to get just the URIs out, in proper rdf. Probably not useful
442 CONSTRUCT { %u bf:uri %u }
448 <present type="BF-F">
449 <!-- I don't think we need more than one level for these simple
451 CONSTRUCT { %u ?rel ?obj .
456 OPTIONAL { ?obj ?rel1 ?obj1 }
460 <db path="small" include="smallindex smallbody"/>
462 <db path="place" schema="sparql-results" include="small" >
463 <criteria>?thing a bf:Place</criteria>
464 <index type="bf.place">?thing bf:label %v FILTER(contains(%v, %s))</index>
466 <db path="person" schema="sparql-results" include="small" >
467 <criteria>?thing a bf:Person</criteria>
468 <index type="bf.person">?thing bf:label %v FILTER(contains(%v, %s))</index>
470 <db path="meeting" schema="sparql-results" include="small" >
471 <criteria>?thing a bf:Meeting</criteria>
472 <index type="bf.meeting">?thing bf:label %v FILTER(contains(%v, %s))</index>
474 <db path="agent" schema="sparql-results" include="small" >
475 <criteria>?thing a bf:Agent</criteria>
476 <index type="bf.agent">?thing bf:label %v FILTER(contains(%v, %s))</index>
478 <db path="event" schema="sparql-results" include="small" >
479 <criteria>?thing a bf:Event</criteria>
480 <index type="bf.event">?thing bf:label %v FILTER(contains(%v, %s))</index>
482 <db path="organization" schema="sparql-results" include="small" >
483 <criteria>?thing a bf:Organization</criteria>
484 <index type="bf.organization">?thing bf:label %v FILTER(contains(%v, %s))</index>
486 <db path="topic" schema="sparql-results" include="small" >
487 <criteria>?thing a bf:Topic</criteria>
488 <index type="bf.topic">?thing bf:label %v FILTER(contains(%v, %s))</index>
491 <!-- Title search, probably not needed. -->
492 <db path="title" schema="sparql-results" include="smallbody" >
493 <criteria>?thing a bf:Title</criteria>
495 { ?thing bf:titleValue %v FILTER(contains(%v, %s)) } UNION
496 { ?thing bf:subtitle %v FILTER(contains(%v, %s)) } UNION
497 { ?thing bf:partTitle %v FILTER(contains(%v, %s)) }
500 { ?thing bf:titleValue %v FILTER(contains(%v, %s)) } UNION
501 { ?thing bf:subtitle %v FILTER(contains(%v, %s)) } UNION
502 { ?thing bf:partTitle %v FILTER(contains(%v, %s)) }
504 <index type="bf.title">?thing bf:titleValue %v FILTER(contains(%v, %s))</index>
505 <index type="bf.subtitle">?thing bf:subtitle %v FILTER(contains(%v, %s))</index>
506 <index type="bf.parttitle">?thing bf:partTitle %v FILTER(contains(%v, %s))</index>
509 <!-- A hack to be able to look at any triplet in the base -->
510 <!-- TODO - Switch to the new system, probably using "small" -->
511 <db path="node" schema="sparql-results">
512 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
513 <prefix>bf: http://bibframe.org/vocab/</prefix>
514 <form>SELECT ?node ?rel ?obj</form>
515 <index type="any">?node ?rel ?obj FILTER( str(?node) = %s )</index>
517 <!-- A way to see which triplets refers to a given uri. -->
518 <!-- TODO - Switch to the new system, probably using "small" -->
519 <db path="ref" schema="sparql-results">
520 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
521 <prefix>bf: http://bibframe.org/vocab/</prefix>
522 <form>SELECT ?node ?rel ?obj</form>
523 <index type="any">?node ?rel ?obj FILTER( str(?obj) = %s )</index>
527 <message>http</message>
528 <category apdu="true"/>
530 <filter type="http_client">
531 <x-forwarded-for>true</x-forwarded-for>