- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT ?instance ?title ?format</form>
- <criteria>?instance a bf:Instance</criteria>
- <criteria>?instance bf:title ?title</criteria>
- <index type="4">?instance bf:title %v FILTER(contains(%v, %s))</index>
- <criteria>?instance bf:format ?format</criteria>
- <index type="1013">?instance bf:format %s</index>
+ <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
+ <prefix>bf: http://bibframe.org/vocab/</prefix>
+ <!-- The search clause just finds ?insts, present is done below -->
+ <form>SELECT DISTINCT ?inst </form>
+ <criteria>?inst a bf:Instance</criteria>
+
+ <!-- bf.uri is a simple way to get to a work -->
+ <index type="bf.uri"> ?inst a bf:Instance FILTER( ?inst = %u ) </index>
+
+ <!-- Title indexes -->
+ <!-- These are messy, there are so many ways to get to a title -->
+
+ <!-- Main title. Looks logical, but in practice we have seen only a very
+ small number of these -->
+ <index type="bf.title">
+ ?inst bf:title %v FILTER(contains(%v, %s))
+ </index>
+
+ <!-- worktitle seems to be the most common way to store the title of a work -->
+ <index type="bf.instancetitle">
+ ?inst bf:instanceTitle ?it .
+ ?it bf:titleValue %v FILTER(contains(%v, %s))
+ </index>
+
+ <!-- BF-L is just the links -->
+ <present type="BF-L">
+ CONSTRUCT { ?inst ?rel ?subj }
+ WHERE {
+ ?inst a bf:Instance .
+ ?inst ?rel ?subj .
+ ?inst ?rel ?subj FILTER( str(?inst) = %s )
+ }
+ </present>
+
+ <!-- Full instance, with the related work too -->
+ <present type="BF-F">
+ CONSTRUCT {
+ %u ?irel1 ?iobj1 .
+ ?iobj1 ?irel2 ?iobj2 .
+ ?iobj2 ?irel3 ?iobj3 .
+ ?work ?wrel1 ?wobj1 .
+ ?wobj1 ?wrel2 ?wobj2 .
+ ?wobj2 ?wrel3 ?wobj3
+ }
+ WHERE {
+ %u a bf:Instance .
+ %u ?irel1 ?iobj1
+ OPTIONAL {
+ ?iobj1 ?irel2 ?iobj2
+ MINUS { ?iobj1 a bf:Work }
+ MINUS { ?iobj1 a bf:Instance }
+ OPTIONAL {
+ ?iobj2 ?irel3 ?iobj3
+ MINUS { ?iobj2 a bf:Work }
+ MINUS { ?iobj2 a bf:Instance }
+ }
+ }
+
+ OPTIONAL {
+ %u bf:instanceOf ?work
+ OPTIONAL {
+ ?work ?wrel1 ?wobj1
+ MINUS { ?wobj1 a bf:Work }
+ MINUS { ?wobj1 a bf:Instance }
+ OPTIONAL {
+ ?wobj1 ?wrel2 ?wobj2
+ MINUS { ?wobj2 a bf:Work }
+ MINUS { ?wobj2 a bf:Instance }
+ OPTIONAL {
+ ?wobj2 ?wrel3 ?wobj3
+ MINUS { ?wobj3 a bf:Work }
+ MINUS { ?wobj3 a bf:Instance }
+ }
+ }
+ }
+ }
+ }
+ </present>
+