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">
40 <!-- Which sparql server to use, our demo, or your local installation -->
41 <!--defaults uri="http://bibframe.indexdata.com/sparql/"/-->
42 <defaults uri="http://localhost:8890/sparql/"/>
44 <!-- work database -->
46 <db path="work" schema="sparql-results">
47 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
48 <prefix>bf: http://bibframe.org/vocab/</prefix>
50 <!-- The search clause just finds ?works, present is done below -->
51 <form>SELECT DISTINCT ?work </form>
52 <criteria>?work a bf:Work</criteria>
54 <!-- bf.uri is a simple way to get to a work -->
55 <index type="bf.uri"> ?work a bf:Work FILTER( ?work = %u ) </index>
57 <!-- Title indexes -->
58 <!-- These are messy, there are so many ways to get to a title -->
60 <!-- Main title. Looks logical, but in practice we have not seen -->
61 <!-- many of these -->
62 <index type="bf.title">
63 ?work bf:title %v FILTER(contains(%v, %s))
66 <!-- worktitle.titleValue seems to be the most common way to -->
67 <!-- store the title of a work -->
68 <index type="bf.worktitle">
69 ?work bf:workTitle ?wt .
70 ?wt bf:titleValue %v FILTER(contains(%v, %s))
73 <!-- Combining the two above, since users are not likely -->
74 <!-- to know how a given title has been indexed -->
75 <!-- TODO is "maintitle" a good name for this? I made it up myself -->
76 <index type="bf.maintitle">
78 ?work bf:workTitle ?wt .
79 ?wt bf:titleValue %v FILTER(contains(%v, %s))
81 ?work bf:title %v FILTER(contains(%v, %s))
85 <!-- the worktitle can also contain a subtitle and a parttitle -->
86 <index type="bf.subtitle">?work bf:workTitle ?wt .
87 ?wt bf:subtitle %v FILTER(contains(%v, %s))
90 <index type="bf.parttitle">
91 ?work bf:workTitle ?wt .
92 ?wt bf:partTitle %v FILTER(contains(%v, %s))
95 <!-- work.titlevariation - this could also have sub- and partTitles -->
96 <index type="bf.titlevariation">
97 ?work bf:titleVariation ?tv .
98 ?tv bf:titleValue %v FILTER(contains(%v, %s))
101 <!-- Instance titles -->
102 <index type="bf.instancetitle">
103 ?inst bf:instanceOf ?work .
104 ?inst bf:instanceTitle ?it .
105 ?it bf:titleValue %v FILTER(contains(%v, %s))
108 <!-- Combined title index. There are so many ways titles can be expresses
109 in Bibframe, this seems to cover most of what we have seen -->
110 <!-- TODO - See the anytitle in instance for a more flexible way -->
111 <index type="bf.anytitle">
113 ?work bf:workTitle ?wt .
114 { ?wt bf:titleValue %v FILTER(contains(%v, %s)) } UNION
115 { ?wt bf:subtitle %v FILTER(contains(%v, %s)) } UNION
116 { ?wt bf:partTitle %v FILTER(contains(%v, %s)) }
118 ?work bf:titleVariation ?tv .
119 ?tv bf:titleValue %v FILTER(contains(%v, %s))
121 ?inst bf:instanceOf ?work .
122 ?inst bf:instanceTitle ?it .
123 ?it bf:titleValue %v FILTER(contains(%v, %s))
125 ?work bf:title %v FILTER(contains(%v, %s))
129 <!-- Author indexes. Much simpler than titles. -->
130 <index type="bf.creator">
131 ?work bf:creator ?c .
132 ?c bf:label %v FILTER(contains(%v, %s))
135 <index type="bf.contributor">
136 ?work bf:contributor ?c .
137 ?c bf:label %v FILTER(contains(%v, %s))
140 <index type="bf.anyauthor"> <!-- TODO - Is this a good name? -->
142 ?work bf:creator ?c .
143 ?c bf:label %v FILTER(contains(%v, %s))
145 ?work bf:contributor ?c .
146 ?c bf:label %v FILTER(contains(%v, %s))
151 <!-- Note that these refer to anything with a bf:subject relation -->
152 <!-- The actual item is likely to be something like topic person etc -->
153 <index type="bf.subject">
154 ?work bf:subject ?subject .
155 ?subject bf:label %v FILTER(contains(%v, %s))
158 <!-- Indexes for persons, organizations, etc -->
159 <!-- The person (etc) may be in any relation to the work, -->
160 <!-- subject, creator, etc, as long as there is a direct link -->
161 <index type="bf.person">
163 ?person a bf:Person .
164 ?person bf:label %v FILTER(contains(%v, %s))
166 <!-- TODO - make many more like the person above -->
168 <!-- Present formats -->
169 <!-- BF-L is just the links -->
170 <present type="BF-L">
177 ?work ?rel ?subj FILTER( str(?work) = %s )
181 <!-- BF-F expands all links, except to instances and other works -->
182 <present type="BF-F">
190 &workfull; <!-- This does not seem to get expanded!! TODO -->
196 MINUS { ?obj a bf:Work }
197 MINUS { ?obj a bf:Instance }
201 MINUS { ?obj1 a bf:Work }
202 MINUS { ?obj1 a bf:Instance }
206 MINUS { ?obj2 a bf:Work }
207 MINUS { ?obj2 a bf:Instance }
209 ?work ?rel ?obj FILTER( str(?work) = %s )
210 <!-- TODO Use the %u -->
211 <!-- TODO Use the BF-FI as the BF-F -->
215 <!-- full, with instances. Experimental! -->
216 <present type="BF-FI">
219 ?wobj1 ?wrel1 ?wobj2 .
220 ?wobj2 ?wrel2 ?wobj3 .
221 ?inst ?irel1 ?iobj1 .
222 ?iobj1 ?irel2 ?iobj2 .
231 MINUS { ?wobj a bf:Work }
232 MINUS { ?wobj a bf:Instance }
236 MINUS { ?wobj1 a bf:Work }
237 MINUS { ?wobj1 a bf:Instance }
241 MINUS { ?wobj2 a bf:Work }
242 MINUS { ?wobj2 a bf:Instance }
245 <!-- Link to the instance(s) -->
247 ?inst bf:instanceOf %u
249 <!-- and expand the instance -->
263 <!-- Instance database -->
265 <db path="instance" schema="sparql-results">
266 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
267 <prefix>bf: http://bibframe.org/vocab/</prefix>
268 <!-- The search clause just finds ?insts, present is done below -->
269 <form>SELECT DISTINCT ?inst </form>
270 <criteria>?inst a bf:Instance</criteria>
272 <!-- bf.uri is a simple way to get to a work -->
273 <index type="bf.uri">
274 ?inst a bf:Instance FILTER( ?inst = %u )
277 <!-- Title indexes -->
278 <!-- These are messy, there are so many ways to get to a title -->
280 <!-- Main title. Looks logical. Many instances seem to have a title -->
281 <index type="bf.title">
282 ?inst bf:title %v FILTER(contains(%v, %s))
285 <!-- instancetitle is also pretty common -->
286 <index type="bf.instancetitle">
287 ?inst bf:instanceTitle ?it .
288 ?it bf:titleValue %v FILTER(contains(%v, %s))
291 <index type="bf.titlestatement">
292 ?inst bf:titleStatement %v FILTER(contains(%v, %s))
295 <!-- Combining the two above, since users are not likely to know how
296 a given title has been indexed -->
297 <index type="bf.maintitle">
299 ?inst bf:instanceTitle ?it .
300 ?it bf:titleValue %v FILTER(contains(%v, %s))
302 ?inst bf:title %v FILTER(contains(%v, %s))
307 <!-- the instancetitle can also contain a subtitle and a parttitle -->
308 <index type="bf.subtitle">
309 ?inst bf:instanceTitle ?it .
310 ?it bf:subtitle %v FILTER(contains(%v, %s))
313 <index type="bf.parttitle">
314 ?inst bf:instanceTitle ?it .
315 ?it bf:partTitle %v FILTER(contains(%v, %s))
317 <!-- We could also go to the works, and get those titles... -->
319 <!-- Combining any kind of title into one index -->
320 <index type="bf.anytitle">
322 ?inst bf:title %v FILTER(contains(%v, %s))
324 ?inst bf:titleStatement %v FILTER(contains(%v, %s))
326 ?inst ?titlerel ?it . <!-- any kind of link -->
327 ?it a bf:Title <!-- to something that is a title -->
329 ?it bf:titleValue %v FILTER(contains(%v, %s))
331 ?it bf:partTitle %v FILTER(contains(%v, %s))
333 ?it bf:subtitle %v FILTER(contains(%v, %s))
338 <!-- Author indexes. Many instances don't have any, works do -->
339 <index type="bf.creator">
340 ?inst bf:creator ?c .
341 ?c bf:label %v FILTER(contains(%v, %s))
344 <index type="bf.workcreator">
345 ?inst bf:instanceOf ?work .
346 ?work bf:creator ?c .
347 ?c bf:label %v FILTER(contains(%v, %s))
350 <index type="bf.workcontributor">
351 ?inst bf:instanceOf ?work .
352 ?work bf:contributor ?c .
353 ?c bf:label %v FILTER(contains(%v, %s))
356 <index type="bf.contributor">
357 ?inst bf:contributor ?c .
358 ?c bf:label %v FILTER(contains(%v, %s))
361 <index type="bf.anyauthor">
363 ?inst bf:creator ?c .
364 ?c bf:label %v FILTER(contains(%v, %s))
366 ?inst bf:contributor ?c .
367 ?c bf:label %v FILTER(contains(%v, %s))
369 ?inst bf:instanceOf ?work .
370 ?work bf:creator ?c .
371 ?c bf:label %v FILTER(contains(%v, %s))
373 ?inst bf:instanceOf ?work .
374 ?work bf:contributor ?c .
375 ?c bf:label %v FILTER(contains(%v, %s))
379 <!-- BF-L is just the links -->
380 <present type="BF-L">
385 ?inst a bf:Instance .
387 ?inst ?rel ?subj FILTER( str(?inst) = %s )
391 <!-- Full instance, with the related work too -->
392 <present type="BF-F">
395 ?iobj1 ?irel2 ?iobj2 .
396 ?iobj2 ?irel3 ?iobj3 .
397 ?work ?wrel1 ?wobj1 .
398 ?wobj1 ?wrel2 ?wobj2 .
406 MINUS { ?iobj1 a bf:Work }
407 MINUS { ?iobj1 a bf:Instance }
410 MINUS { ?iobj2 a bf:Work }
411 MINUS { ?iobj2 a bf:Instance }
416 %u bf:instanceOf ?work
419 MINUS { ?wobj1 a bf:Work }
420 MINUS { ?wobj1 a bf:Instance }
423 MINUS { ?wobj2 a bf:Work }
424 MINUS { ?wobj2 a bf:Instance }
427 MINUS { ?wobj3 a bf:Work }
428 MINUS { ?wobj3 a bf:Instance }
438 <!-- Small databases -->
440 <!-- "small" contains all the things common to all small databases -->
441 <!-- It is only to be used as an include, it is not searchable, since -->
442 <!-- it has no schema atribute -->
443 <!-- It is divided into "smallindex", "smallbody", and a "small" that includes
444 both, so that title searches can include the body, but have different indexes -->
446 <db path="smallindex">
448 ?thing bf:label %v FILTER(contains(%v, %s))
451 ?thing bf:label %v FILTER(contains(%v, %s))
455 <db path="smallbody">
456 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
457 <prefix>bf: http://bibframe.org/vocab/</prefix>
458 <form>SELECT DISTINCT ?thing </form>
459 <criteria>?thing ?rel ?obj</criteria>
460 <present type="BF-L">
468 <present type="BF-F">
469 <!-- I don't think we need more than one level -->
470 <!--for these simple databases -->
477 OPTIONAL { ?obj ?rel1 ?obj1 }
482 <!-- The combined "small" database defaults -->
483 <db path="small" include="smallindex smallbody"/>
485 <!-- Various "small" databases, leaning heavily on the defaults above -->
486 <db path="place" schema="sparql-results" include="small" >
487 <criteria>?thing a bf:Place</criteria>
488 <index type="bf.place">
489 ?thing bf:label %v FILTER(contains(%v, %s))
493 <db path="person" schema="sparql-results" include="small" >
494 <criteria>?thing a bf:Person</criteria>
495 <index type="bf.person">
496 ?thing bf:label %v FILTER(contains(%v, %s))
500 <db path="meeting" schema="sparql-results" include="small" >
501 <criteria>?thing a bf:Meeting</criteria>
502 <index type="bf.meeting">
503 ?thing bf:label %v FILTER(contains(%v, %s))
507 <db path="agent" schema="sparql-results" include="small" >
508 <criteria>?thing a bf:Agent</criteria>
509 <index type="bf.agent">
510 ?thing bf:label %v FILTER(contains(%v, %s))
514 <db path="event" schema="sparql-results" include="small" >
515 <criteria>?thing a bf:Event</criteria>
516 <index type="bf.event">
517 ?thing bf:label %v FILTER(contains(%v, %s))
521 <db path="organization" schema="sparql-results" include="small" >
522 <criteria>?thing a bf:Organization</criteria>
523 <index type="bf.organization">
524 ?thing bf:label %v FILTER(contains(%v, %s))
528 <db path="topic" schema="sparql-results" include="small" >
529 <criteria>?thing a bf:Topic</criteria>
530 <index type="bf.topic">
531 ?thing bf:label %v FILTER(contains(%v, %s))
535 <!-- Title search, for seatching Title objects. -->
536 <!-- Not sure if this is needed, but it is a nice example -->
537 <db path="title" schema="sparql-results" include="smallbody" >
538 <criteria>?thing a bf:Title</criteria>
542 ?thing bf:titleValue %v FILTER(contains(%v, %s))
544 ?thing bf:subtitle %v FILTER(contains(%v, %s))
546 ?thing bf:partTitle %v FILTER(contains(%v, %s))
552 ?thing bf:titleValue %v FILTER(contains(%v, %s))
554 ?thing bf:subtitle %v FILTER(contains(%v, %s))
556 ?thing bf:partTitle %v FILTER(contains(%v, %s))
560 <index type="bf.title">
561 ?thing bf:titleValue %v FILTER(contains(%v, %s))
564 <index type="bf.subtitle">
565 ?thing bf:subtitle %v FILTER(contains(%v, %s))
568 <index type="bf.parttitle">
569 ?thing bf:partTitle %v FILTER(contains(%v, %s))
573 <!-- A hack to be able to look at any triplet in the base -->
574 <!-- TODO - Switch to the new system, probably using "small" -->
575 <db path="node" schema="sparql-results">
576 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
577 <prefix>bf: http://bibframe.org/vocab/</prefix>
578 <form>SELECT ?node ?rel ?obj</form>
579 <index type="any">?node ?rel ?obj FILTER( str(?node) = %s )</index>
581 <!-- A way to see which triplets refers to a given uri. -->
582 <!-- TODO - Switch to the new system, probably using "small" -->
583 <db path="ref" schema="sparql-results">
584 <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
585 <prefix>bf: http://bibframe.org/vocab/</prefix>
586 <form>SELECT ?node ?rel ?obj</form>
587 <index type="any">?node ?rel ?obj FILTER( str(?obj) = %s )</index>
592 <message>http</message>
593 <category apdu="true"/>
596 <filter type="http_client">
597 <x-forwarded-for>true</x-forwarded-for>