+<?xml version="1.0"?>
+
<filters xmlns="http://indexdata.com/metaproxy">
- <filter type="sparql">
- <!-- Which sparql server to use, our demo, or your local installation -->
- <!--defaults uri="http://bibframe.indexdata.com/sparql/"/-->
- <defaults uri="http://localhost:8890/sparql/"/>
-
- <!-- New structure: Any search in work returns just a list of records.
- Present will make another request to the backend to get the fields
- we want, depending on the schema. That part is not yet implemented -->
- <db path="work" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT DISTINCT ?work
- </form>
- <criteria>?work a bf:Work</criteria>
- <!-- TODO: Many more indexes like the ones below-->
- <index type="bf.title">?work bf:workTitle ?wt .
- ?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
- <index type="bf.creator">?work bf:creator ?c .
- ?c bf:label %v FILTER(contains(%v, %s))</index>
- <index type="bf.subject">?work bf:subject ?subject .
- ?subject bf:label %v FILTER(contains(%v, %s))
- </index>
- <uri type="BF-L">
- CONSTRUCT { ?work ?rel ?subj }
- WHERE {
- ?work a bf:Work .
- ?work ?rel ?subj .
- ?work ?rel ?obj FILTER( str(?work) = %s )
- }
- </uri>
- <!-- TODO: Define a query to return detailed information for each
- schema. For example
- <present shema="BF-L" results="sparql-results" >
- <query>
- SELECT ?sub ?rel ?obj
- WHERE ?work ?rel ?obj FILTER( str(?work) = %s )
- </query>
- - or possibly "FILTER ( ?work = <%u> )" if we define %u to
- expand to the unquoted URI of the work.
- - Even better, with %u we can say something like
- SELECT %u ?rel ?obj
- </present>
- -->
- </db>
-
- <!-- Experiments while waiting for the present queries to be implemented -->
- <db path="onework-l" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT ?work ?rel ?subj
- </form>
- <criteria>?work a bf:Work</criteria>
- <criteria>?work ?rel ?obj</criteria>
- <index type="any">?work ?rel ?obj FILTER( str(?work) = %s )</index>
- </db>
- <!-- Returns a decent-looking rdf (except that mp says 0 hits)
- with no links expanded -->
- <db path="onework-l-rdf" schema="rdf">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>CONSTRUCT { ?work ?rel ?obj }
- </form>
- <criteria>?work a bf:Work</criteria>
- <criteria>?work ?rel ?obj</criteria>
- <index type="any">?work ?rel ?obj FILTER( str(?work) = %s )</index>
- </db>
- <!-- Expand some links -->
- <db path="onework-e-rdf" schema="rdf">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>CONSTRUCT { ?work ?rel ?obj.
- ?creator ?crRel ?crObj .
- ?subj ?subRel ?subObj }
- </form>
- <criteria>?work a bf:Work</criteria>
- <criteria>?work ?rel ?obj</criteria>
- <criteria>OPTIONAL { ?work bf:creator ?creator .
- ?creator ?crRel ?crObj }
- </criteria>
- <criteria>OPTIONAL { ?work bf:subject ?subj .
- ?subj ?subRel ?subObj }
- </criteria>
- <index type="any">?work ?rel ?obj FILTER( str(?work) = %s )</index>
- </db>
- <!-- Expand all things a couple of levels.
- In all the data I have seen, two levels is enough. So we do three
- Lnks to Works and Instances are explicitly excluded from this expansion,
- and need to be handled separately. This is to avoid looping.
- -->
-
- <db path="onework-f-rdf" schema="rdf">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>CONSTRUCT { ?work ?rel ?obj .
- ?obj ?rel1 ?obj1 .
- ?obj1 ?rel2 ?obj2 .
- ?obj2 ?rel3 ?obj3
+ <filter type="sparql">
+
+ <!-- Which sparql server to use, our demo, or your local installation -->
+ <!--defaults uri="http://bibframe.indexdata.com/sparql/"/-->
+ <defaults uri="http://localhost:8890/sparql/"/>
+
+ <!-- "thing" database that will be included all real databases -->
+ <db path="thing"> <!-- no schema, so it is not directly searchable -->
+ <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
+ <prefix>bf: http://bibframe.org/vocab/</prefix>
+ <form>SELECT DISTINCT ?thing </form>
+
+ <!-- Common indexes -->
+
+ <!-- bf.uri is a simple way to get to a thing -->
+ <index type="bf.uri">
+ ?thing %v_rel %v_obj FILTER( ?thing = %u )
+ </index>
+
+ <!-- bf.type is a simple way to search for types -->
+ <!-- for example, a bf.Work can also be bf:Text or bf:Audio -->
+ <index type="bf.type">
+ ?thing a %t
+ </index>
+
+ <!-- Find all nodes that refer to the given uri -->
+ <!-- useful after finding uris in the "small" bases -->
+ <!-- direct references only -->
+ <index type="bf.ref">
+ ?thing %v_rel %u
+ </index>
+
+
+ <!-- The BF-L present format is the same for everything -->
+ <!-- Each db is supposed to provide a dedicated BF-V present format -->
+ <present type="BF-L">
+ CONSTRUCT {
+ %u ?rel ?subj
+ }
+ WHERE {
+ %u ?rel ?subj .
+ }
+ </present>
+
+ </db>
+
+ <!-- "smallindex" db that will be included in work and instance -->
+ <!-- It provides the small indexes like bf.person, bf.place, etc -->
+ <!-- These match a person, etc, no matter what the relation to that -->
+ <!-- is, as long as there is a direct link -->
+ <!-- The %v gets assigned a new variable name, like ?v0. -->
+ <!-- The %vx gets the same ?v0, with the x suffixed to it, by regular -->
+ <!-- This way, we use a different variable for each index clause, and -->
+ <!-- do not get into trouble if we have an AND between two of the same kind -->
+ <db path="smallindex">
+ <index type="bf.person">
+ ?thing ?rel %vx .
+ %vx a bf:Person .
+ %vx bf:label %v FILTER(contains(%v, %s))
+ </index>
+ <index type="bf.topic">
+ ?thing ?rel %vx .
+ %vx a bf:Topic .
+ %vx bf:label %v FILTER(contains(%v, %s))
+ </index>
+ <index type="bf.place">
+ ?thing ?rel %vx .
+ %vx a bf:Place .
+ %vx bf:label %v FILTER(contains(%v, %s))
+ </index>
+ <index type="bf.agent">
+ ?thing ?rel %vx .
+ %vx a bf:Agent .
+ %vx bf:label %v FILTER(contains(%v, %s))
+ </index>
+ <index type="bf.meeting">
+ ?thing ?rel %vx .
+ %vx a bf:Meeting .
+ %vx bf:label %v FILTER(contains(%v, %s))
+ </index>
+ <index type="bf.organization">
+ ?thing ?rel %vx .
+ %vx a bf:Organization .
+ %vx bf:label %v FILTER(contains(%v, %s))
+ </index>
+ <index type="bf.event">
+ ?thing ?rel %vx .
+ %vx a bf:Event .
+ %vx bf:label %v FILTER(contains(%v, %s))
+ </index>
+ </db>
+
+ <!-- work database -->
+
+ <db path="work" schema="sparql-results" include="thing smallindex">
+
+ <!-- The search clause just finds ?things, present is done below -->
+ <criteria>?thing a bf:Work</criteria>
+
+ <!-- Title indexes -->
+ <!-- These are messy, there are so many ways to get to a title -->
+
+ <!-- Main title. Looks logical, but in practice we have not seen -->
+ <!-- many of these -->
+ <index type="bf.title">
+ ?thing bf:title %v FILTER(contains(%v, %s))
+ </index>
+
+ <!-- worktitle.titleValue seems to be the most common way to -->
+ <!-- store the title of a work -->
+ <index type="bf.worktitle">
+ ?thing bf:workTitle %v_wt .
+ %v_wt bf:titleValue %v FILTER(contains(%v, %s))
+ </index>
+
+ <!-- Combining the two above, since users are not likely -->
+ <!-- to know how a given title has been indexed -->
+ <!-- TODO is "maintitle" a good name for this? I made it up myself -->
+ <index type="bf.maintitle">
+ {
+ ?thing bf:workTitle %v_wt .
+ %v_wt bf:titleValue %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:title %v FILTER(contains(%v, %s))
+ }
+ </index>
+
+ <!-- the worktitle can also contain a subtitle and a parttitle -->
+ <index type="bf.subtitle">
+ ?thing bf:workTitle %v_wt .
+ %v_wt bf:subtitle %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.parttitle">
+ ?thing bf:workTitle %v_wt .
+ %v_wt bf:partTitle %v FILTER(contains(%v, %s))
+ </index>
+
+ <!-- work.titlevariation - this could also have sub- and partTitles -->
+ <index type="bf.titlevariation">
+ ?thing bf:titleVariation %v_tv .
+ %v_tv bf:titleValue %v FILTER(contains(%v, %s))
+ </index>
+
+ <!-- Instance titles -->
+ <index type="bf.instancetitle">
+ %v_inst bf:instanceOf ?thing .
+ %v_inst bf:instanceTitle %v_tit .
+ %v_tit bf:titleValue %v FILTER(contains(%v, %s))
+ </index>
+
+ <!-- Combined title index. There are so many ways titles can be expresses
+ in Bibframe, this seems to cover most of what we have seen -->
+ <index type="bf.anytitle">
+ {
+ ?thing bf:title %v FILTER(contains(%v, %s))
+ } UNION { <!-- any kind of link -->
+ ?thing ?titlerel %v_ti . <!-- mostly workTitle, but others too -->
+ %v_ti a bf:Title <!-- to something that is a title -->
+ {
+ %v_ti bf:titleValue %v FILTER(contains(%v, %s))
+ } UNION {
+ %v_ti bf:partTitle %v FILTER(contains(%v, %s))
+ } UNION {
+ %v_ti bf:subtitle %v FILTER(contains(%v, %s))
+ }
+ } UNION {
+ %v_inst bf:instanceOf ?thing .
+ %v_inst bf:instanceTitle %v_ti .
+ %v_ti bf:titleValue %v FILTER(contains(%v, %s))
+ }
+ </index>
+
+ <!-- Author indexes. Much simpler than titles. -->
+ <index type="bf.creator">
+ ?thing bf:creator %v_c .
+ %v_c bf:label %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.contributor">
+ ?thing bf:contributor %v_c .
+ %v_c bf:label %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.anyauthor"> <!-- TODO - Is this a good name? -->
+ {
+ ?thing bf:creator %v_c .
+ %v_c bf:label %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:contributor %v_c .
+ %v_c bf:label %v FILTER(contains(%v, %s))
+ }
+ </index>
+
+ <!-- Subjects -->
+ <!-- Note that these refer to anything with a bf:subject relation -->
+ <!-- The actual item is likely to be something like topic person etc -->
+ <index type="bf.subject">
+ ?thing bf:subject %v_su .
+ %v_su bf:label %v FILTER(contains(%v, %s))
+ </index>
+
+ <!-- contentCategory can be searched with complete URIs like -->
+ <!-- http://id.loc.gov/vocabulary/contentTypes/txt -->
+ <index type="bf.contentcategory">
+ ?thing bf:contentCategory %u
+ </index>
+
+ <!-- Find the work that has a given Instance -->
+ <index type="bf.instance">
+ %v_inst bf:instanceOf ?thing FILTER ( %v_inst = %u)
+ </index>
+
+ <!-- Present formats -->
+ <!-- BF-L comes from the "thing" template -->
+ <!-- BF-V expands all links, even to instances but not other works -->
+ <present type="BF-V">
+ CONSTRUCT {
+ %u ?wrel1 ?wobj1 .
+ ?wobj1 ?wrel2 ?wobj2 .
+ ?wobj2 ?wrel3 ?wobj3 .
+ ?inst ?irel1 ?iobj1 .
+ ?iobj1 ?irel2 ?iobj2 .
+ ?iobj2 ?irel3 ?iobj3
+ }
+ WHERE {
+ %u a bf:Work .
+ %u ?wrel1 ?wobj1 .
+
+ OPTIONAL {
+ ?wobj1 ?wrel2 ?wobj2
+ MINUS { ?wobj1 a bf:Work }
+ MINUS { ?wobj1 a bf:Instance }
+ OPTIONAL {
+ ?wobj2 ?wrel3 ?wobj3
+ MINUS { ?wobj2 a bf:Work }
+ MINUS { ?wobj2 a bf:Instance }
+ }
+ }
+ <!-- Link to the instance(s) -->
+ OPTIONAL {
+ ?inst bf:instanceOf %u .
+ ?inst ?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 }
+ }
+ }
+ }
+ }
+ </present>
+ </db>
+
+ <!-- Instance database -->
+
+ <db path="instance" schema="sparql-results" include="thing smallindex">
+ <criteria>?thing a bf:Instance</criteria>
+
+ <!-- Title indexes -->
+ <!-- These are messy, there are so many ways to get to a title -->
+
+ <!-- Main title. Looks logical. Many instances seem to have a title -->
+ <index type="bf.title">
+ ?thing bf:title %v FILTER(contains(%v, %s))
+ </index>
+
+ <!-- instancetitle is also pretty common -->
+ <index type="bf.instancetitle">
+ ?thing bf:instanceTitle %v_it .
+ %v_it bf:titleValue %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.titlestatement">
+ ?thing bf:titleStatement %v FILTER(contains(%v, %s))
+ </index>
+
+ <!-- Combining the two above, since users are not likely to know how
+ a given title has been indexed -->
+ <index type="bf.maintitle">
+ {
+ ?thing bf:instanceTitle %v_it .
+ %v_it bf:titleValue %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:title %v FILTER(contains(%v, %s))
+ }
+ </index>
+
+
+ <!-- the instancetitle can also contain a subtitle and a parttitle -->
+ <index type="bf.subtitle">
+ ?thing bf:instanceTitle %v_it .
+ %v_it bf:subtitle %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.parttitle">
+ ?thing bf:instanceTitle %v_it .
+ %v_it bf:partTitle %v FILTER(contains(%v, %s))
+ </index>
+ <!-- We could also go to the works, and get those titles... -->
+
+ <!-- Combining any kind of title into one index -->
+ <index type="bf.anytitle">
+ {
+ ?thing bf:title %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:titleStatement %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing ?titlerel %v_it . <!-- any kind of link -->
+ %v_it a bf:Title <!-- to something that is a title -->
+ {
+ %v_it bf:titleValue %v FILTER(contains(%v, %s))
+ } UNION {
+ %v_it bf:partTitle %v FILTER(contains(%v, %s))
+ } UNION {
+ %v_it bf:subtitle %v FILTER(contains(%v, %s))
+ }
+ }
+ </index>
+
+ <!-- Author indexes. Many instances don't have any, works do -->
+ <index type="bf.creator">
+ ?thing bf:creator %v_cr .
+ %v_cr bf:label %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.workcreator">
+ ?thing bf:instanceOf %v_work .
+ %v_work bf:creator %v_cr .
+ %v_cr bf:label %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.workcontributor">
+ ?thing bf:instanceOf %v_work .
+ %v_work bf:contributor %v_co .
+ %v_co bf:label %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.contributor">
+ ?thing bf:contributor %v_co .
+ %v_co bf:label %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.anyauthor">
+ {
+ ?thing bf:creator %v_cr .
+ %v_cr bf:label %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:contributor %v_co .
+ %v_co bf:label %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:instanceOf %v_work .
+ %v_work bf:creator %v_wcr .
+ %v_wcr bf:label %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:instanceOf %v_work .
+ %v_work bf:contributor %v_wco .
+ %v_wco bf:label %v FILTER(contains(%v, %s))
+ }
+ </index>
+
+ <!-- isbn index. The Instance may contain a isbn10 or isbn13. -->
+ <!-- These can be literal values like -->
+ <!-- http://isbn.example.org/1906833214 which we need to search -->
+ <!-- by our usual substring match. Or they can be links to Identivfiers -->
+ <!-- which will have a proper identifierValue on which we can do -->
+ <!-- an exact match. -->
+ <index type="bf.isbn">
+ {
+ ?thing bf:isbn10 %v
+ FILTER(isUri(%v) && contains(str(%v), %s))
+ } UNION {
+ ?thing bf:isbn13 %v
+ FILTER(isUri(%v) && contains(str(%v), %s))
+ } UNION {
+ {
+ ?thing bf:isbn10 %v_isbn
+ } UNION {
+ ?thing bf:isbn13 %v_isbn
+ }
+ %v_isbn a bf:Identifier .
+ %v_isbn bf:identifierValue %v FILTER( %v = %s )
+ }
+ </index>
+
+ <!-- lccn number, a simpler index for id numbers -->
+ <index type="bf.lccn">
+ ?thing bf:lccn %v_lccn .
+ %v_lccn a bf:Identifier .
+ %v_lccn bf:identifierValue %v FILTER( %v = %s )
+ </index>
+
+ <!-- Find the instances of a given work -->
+ <index type="bf.work">
+ ?thing bf:instanceOf %u
+ </index>
+
+
+ <!-- Present formats. BF-L comes from "thing" -->
+ <!-- Full instance, with the related work too -->
+ <present type="BF-V">
+ 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 { ?iobj2 a bf:Work }
+ MINUS { ?iobj2 a bf:Instance } .
+ OPTIONAL {
+ ?iobj2 ?irel3 ?iobj3
+ MINUS { ?iobj3 a bf:Work }
+ MINUS { ?iobj3 a bf:Instance }
+ }
+ }
+ OPTIONAL { <!-- Work -->
+ %u bf:instanceOf ?work .
+ ?work ?wrel1 ?wobj1 .
+ OPTIONAL {
+ ?wobj1 ?wrel2 ?wobj2
+ MINUS { ?wobj1 a bf:Work }
+ MINUS { ?wobj1 a bf:Instance } .
+ OPTIONAL {
+ ?wobj2 ?wrel3 ?wobj3
+ MINUS { ?wobj2 a bf:Work }
+ MINUS { ?wobj2 a bf:Instance }
+ }
}
- </form>
- <criteria>?work a bf:Work</criteria>
-
- <criteria>?work ?rel ?obj </criteria>
- <criteria>OPTIONAL {
- ?obj ?rel1 ?obj1
- MINUS { ?obj a bf:Work }
- } </criteria>
- <criteria>OPTIONAL {
- ?obj1 ?rel2 ?obj2
- MINUS { ?obj1 a bf:Work }
- } </criteria>
- <criteria>OPTIONAL {
- ?obj2 ?rel3 ?obj3
- MINUS { ?obj2 a bf:Work }
- } </criteria>
- <index type="any">?work ?rel ?obj FILTER( str(?work) = %s )</index>
- </db>
- <!-- Describe a work. Results may vary between back ends -->
- <!-- On virtuoso, seems to return the same as onework-l-rdf above -->
- <db path="onework-d-rdf" schema="rdf">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>DESCRIBE ?work
- </form>
- <criteria>?work a bf:Work</criteria>
- <criteria>?work ?rel ?obj</criteria>
- <criteria>OPTIONAL { ?work bf:creator ?creator .
- ?creator ?crRel ?crObj }
- </criteria>
- <criteria>OPTIONAL { ?work bf:subject ?subj .
- ?subj ?subRel ?subObj }
- </criteria>
- <index type="any">?work ?rel ?obj FILTER( str(?work) = %s )</index>
- </db>
-
- <!-- This is the old "work" db that will not scale. May be removed -->
- <db path="concatwork" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT
- ?work
- (sql:GROUP_DIGEST (?wtitle, ' ; ', 1000, 1)) AS ?title
- (sql:GROUP_DIGEST (?creatorlabel, ' ; ', 1000, 1))AS ?creator
- (sql:GROUP_DIGEST (?subjectlabel, ' ; ', 1000, 1))AS ?subject
- </form>
- <criteria>?work a bf:Work</criteria>
-
- <criteria> OPTIONAL {
- ?work bf:workTitle ?wt .
- ?wt bf:titleValue ?wtitle }
- </criteria>
- <criteria> OPTIONAL {
- ?work bf:creator ?creator .
- ?creator bf:label ?creatorlabel }
- </criteria>
- <criteria>OPTIONAL {
- ?work bf:subject ?subject .
- ?subject bf:label ?subjectlabel }
- </criteria>
- <index type="4">?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
- <index type="1003">?creator bf:label %v FILTER(contains(%v, %s))</index>
- <index type="21">?subject bf:label %v FILTER(contains(%v, %s))</index>
- <index type="1016"> {
- ?work ?op1 ?child .
- ?child ?op2 %v FILTER(contains(STR(%v), %s))
- }
- </index>
- <modifier>GROUP BY $work</modifier>
- </db>
-
- <db path="works" schema="rdf"> <!-- May be removed, will not scale -->
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>CONSTRUCT {
- ?work bf:title ?wtitle .
- ?work bf:instanceTitle ?title .
- ?work bf:author ?creator .
- ?work bf:subject ?subjectlabel }
- </form>
- <criteria>?work a bf:Work</criteria>
-
- <criteria>?work bf:workTitle ?wt</criteria>
- <criteria>?wt bf:titleValue ?wtitle</criteria>
- <index type="4">?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
- <criteria>?work bf:creator ?creator</criteria>
- <criteria>?creator bf:label ?creatorlabel</criteria>
- <index type="1003">?creator bf:label %v FILTER(contains(%v, %s))</index>
- <criteria>?work bf:subject ?subject</criteria>
- <criteria>?subject bf:label ?subjectlabel</criteria>
- <index type="21">?subject bf:label %v FILTER(contains(%v, %s))</index>
- </db>
-
- <!-- Instance searches, need to be refined later -->
- <db path="instance" schema="sparql-results">
- <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>
- </db>
-
- <!-- Simple databases -->
- <db path="place" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT DISTINCT ?label ?id ?place ?relatedTo ?authorizedAccessPoint </form>
- <criteria>?place a bf:Place</criteria>
- <criteria>?place bf:label ?label</criteria>
- <criteria>OPTIONAL { ?place bf:identifier ?id}</criteria>
- <criteria>OPTIONAL { ?place bf:relatedTo ?relatedTo}</criteria>
- <criteria>OPTIONAL { ?place bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
- <index type="bf.place">?place bf:label %v FILTER(contains(%v, %s))</index>
- <index type="any">?place bf:label %v FILTER(contains(%v, %s))</index>
- </db>
- <db path="person" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT DISTINCT ?label ?id ?person ?relatedTo ?authorizedAccessPoint </form>
- <criteria>?person a bf:Person</criteria>
- <criteria>?person bf:label ?label</criteria>
- <criteria>OPTIONAL { ?person bf:identifier ?id}</criteria>
- <criteria>OPTIONAL { ?person bf:relatedTo ?relatedTo}</criteria>
- <criteria>OPTIONAL { ?person bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
- <index type="bf.person">?person bf:label %v FILTER(contains(%v, %s))</index>
- <index type="any">?person bf:label %v FILTER(contains(%v, %s))</index>
- </db>
- <db path="meeting" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT DISTINCT ?label ?id ?meeting ?relatedTo ?authorizedAccessPoint </form>
- <criteria>?meeting a bf:Meeting</criteria>
- <criteria>?meeting bf:label ?label</criteria>
- <criteria>OPTIONAL { ?meeting bf:identifier ?id}</criteria>
- <criteria>OPTIONAL { ?meeting bf:relatedTo ?relatedTo}</criteria>
- <criteria>OPTIONAL { ?meeting bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
- <index type="bf.meeting">?meeting bf:label %v FILTER(contains(%v, %s))</index>
- <index type="any">?meeting bf:label %v FILTER(contains(%v, %s))</index>
- </db>
- <db path="agent" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT DISTINCT ?label ?id ?agent ?relatedTo ?authorizedAccessPoint </form>
- <criteria>?agent a bf:Agent</criteria>
- <criteria>?agent bf:label ?label</criteria>
- <criteria>OPTIONAL { ?agent bf:identifier ?id}</criteria>
- <criteria>OPTIONAL { ?agent bf:relatedTo ?relatedTo}</criteria>
- <criteria>OPTIONAL { ?agent bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
- <index type="bf.agent">?agent bf:label %v FILTER(contains(%v, %s))</index>
- <index type="any">?agent bf:label %v FILTER(contains(%v, %s))</index>
- </db>
- <db path="event" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT DISTINCT ?label ?id ?event ?relatedTo ?authorizedAccessPoint </form>
- <criteria>?event a bf:Event</criteria>
- <criteria>?event bf:label ?label</criteria>
- <criteria>OPTIONAL { ?event bf:identifier ?id}</criteria>
- <criteria>OPTIONAL { ?event bf:relatedTo ?relatedTo}</criteria>
- <criteria>OPTIONAL { ?event bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
- <index type="bf.event">?event bf:label %v FILTER(contains(%v, %s))</index>
- <index type="any">?event bf:label %v FILTER(contains(%v, %s))</index>
- </db>
- <db path="organization" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT DISTINCT ?label ?id ?organization ?relatedTo ?authorizedAccessPoint </form>
- <criteria>?organization a bf:Organization</criteria>
- <criteria>?organization bf:label ?label</criteria>
- <criteria>OPTIONAL { ?organization bf:identifier ?id}</criteria>
- <criteria>OPTIONAL { ?organization bf:relatedTo ?relatedTo}</criteria>
- <criteria>OPTIONAL { ?organization bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
- <index type="bf.organization">?organization bf:label %v FILTER(contains(%v, %s))</index>
- <index type="any">?organization bf:label %v FILTER(contains(%v, %s))</index>
- </db>
- <db path="topic" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT DISTINCT ?label ?id ?topic ?relatedTo ?authorizedAccessPoint </form>
- <criteria>?topic a bf:Topic</criteria>
- <criteria>?topic bf:label ?label</criteria>
- <criteria>OPTIONAL { ?topic bf:identifier ?id}</criteria>
- <criteria>OPTIONAL { ?topic bf:relatedTo ?relatedTo}</criteria>
- <criteria>OPTIONAL { ?topic bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
- <index type="bf.topic">?topic bf:label %v FILTER(contains(%v, %s))</index>
- <index type="any">?topic bf:label %v FILTER(contains(%v, %s))</index>
- </db>
-
- <!-- Title search, probably not needed. Will need to be rewritten to the same
- system as the work search above, with separate present query -->
- <db path="title" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT DISTINCT ?title ?titleValue
- ?formDesignation ?partNumber ?partTitle ?subtitle
- ?titleAttribute ?titleQualifier ?titleSource
- ?titleType ?titleVariationDate</form>
- <criteria>?title a bf:Title</criteria>
- <criteria>OPTIONAL { ?title bf:titleValue ?titleValue}</criteria>
- <criteria>OPTIONAL { ?title bf:formDesignation ?formDesignation}</criteria>
- <criteria>OPTIONAL { ?title bf:partNumber ?partNumber}</criteria>
- <criteria>OPTIONAL { ?title bf:partTitle ?partTitle}</criteria>
- <criteria>OPTIONAL { ?title bf:subtitle ?subtitle}</criteria>
- <criteria>OPTIONAL { ?title bf:titleAttribute ?titleAttribute}</criteria>
- <criteria>OPTIONAL { ?title bf:titleQualifier ?titleQualifier}</criteria>
- <criteria>OPTIONAL { ?title bf:titleSource ?titleSource}</criteria>
- <criteria>OPTIONAL { ?title bf:titleType ?titleType}</criteria>
- <criteria>OPTIONAL { ?title bf:titleVariationDate ?titleVariationDate}</criteria>
- <index type="bf.title">?title bf:titleValue %v FILTER(contains(%v, %s))</index>
- <index type="bf.subtitle">?title bf:subtitle %v FILTER(contains(%v, %s))</index>
- <index type="bf.parttitle">?title bf:partTitle %v FILTER(contains(%v, %s))</index>
- <index type="any">?title ?rel %v FILTER(contains(str(%v), %s))</index>
- </db>
- <!-- A hack to be able to look at any triplet in the base -->
- <db path="node" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT ?node ?rel ?obj</form>
- <index type="any">?node ?rel ?obj FILTER( str(?node) = %s )</index>
- </db>
- <!-- A way to see which triplets refers to a given uri. -->
- <db path="ref" schema="sparql-results">
- <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
- <prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT ?node ?rel ?obj</form>
- <index type="any">?node ?rel ?obj FILTER( str(?obj) = %s )</index>
- </db>
- </filter>
- <filter type="log">
- <message>http</message>
- <category apdu="true"/>
- </filter>
- <filter type="http_client">
- <x-forwarded-for>true</x-forwarded-for>
- </filter>
+ }
+ }
+ </present>
+
+ </db>
+
+ <!-- Small databases -->
+
+ <!-- "small" contains all the things common to all small databases -->
+ <!-- It is only to be used as an include, it is not searchable, since -->
+ <!-- it has no schema atribute -->
+ <!-- It is divided into "smallbody", and a "small" that includes -->
+ <!-- the general indexes, so that title searches can include the body, -->
+ <!-- but have different "any" indexes -->
+
+ <db path="smallbody" include="thing">
+ <present type="BF-V">
+ <!-- I don't think we need more than one level -->
+ <!--for these simple databases -->
+ CONSTRUCT {
+ %u ?rel ?obj .
+ ?obj ?rel1 ?obj1 .
+ }
+ WHERE {
+ %u ?rel ?obj .
+ OPTIONAL { ?obj ?rel1 ?obj1 }
+ }
+ </present>
+ </db>
+
+ <!-- The combined "small" database defaults -->
+ <db path="small" include="smallbody">
+ <index type="any">
+ ?thing bf:label %v FILTER(contains(%v, %s))
+ </index>
+ <index type="1016">
+ ?thing bf:label %v FILTER(contains(%v, %s))
+ </index>
+ </db>
+
+ <!-- Various "small" databases, leaning heavily on the defaults above -->
+ <db path="place" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Place</criteria>
+ <index type="bf.place">
+ ?thing bf:label %v FILTER(contains(%v, %s))
+ </index>
+ </db>
+
+ <db path="person" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Person</criteria>
+ <index type="bf.person">
+ ?thing bf:label %v FILTER(contains(%v, %s))
+ </index>
+ </db>
+
+ <db path="meeting" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Meeting</criteria>
+ <index type="bf.meeting">
+ ?thing bf:label %v FILTER(contains(%v, %s))
+ </index>
+ </db>
+
+ <db path="agent" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Agent</criteria>
+ <index type="bf.agent">
+ ?thing bf:label %v FILTER(contains(%v, %s))
+ </index>
+ </db>
+
+ <db path="event" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Event</criteria>
+ <index type="bf.event">
+ ?thing bf:label %v FILTER(contains(%v, %s))
+ </index>
+ </db>
+
+ <db path="organization" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Organization</criteria>
+ <index type="bf.organization">
+ ?thing bf:label %v FILTER(contains(%v, %s))
+ </index>
+ </db>
+
+ <db path="topic" schema="sparql-results" include="small" >
+ <criteria>?thing a bf:Topic</criteria>
+ <index type="bf.topic">
+ ?thing bf:label %v FILTER(contains(%v, %s))
+ </index>
+ </db>
+
+ <!-- Title search, for seatching Title objects. -->
+ <!-- Not sure if this is needed, but it is a nice example -->
+ <db path="title" schema="sparql-results" include="smallbody" >
+ <criteria>?thing a bf:Title</criteria>
+
+ <index type="any">
+ {
+ ?thing bf:titleValue %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:subtitle %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:partTitle %v FILTER(contains(%v, %s))
+ }
+ </index>
+
+ <index type="1016">
+ {
+ ?thing bf:titleValue %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:subtitle %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:partTitle %v FILTER(contains(%v, %s))
+ }
+ </index>
+
+ <index type="bf.title">
+ ?thing bf:titleValue %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.subtitle">
+ ?thing bf:subtitle %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.parttitle">
+ ?thing bf:partTitle %v FILTER(contains(%v, %s))
+ </index>
+ </db>
+
+ <!-- A hack to be able to look at any triplet in the base -->
+ <!-- The indexes bf.uri and bf.ref can also come in handy here -->
+ <db path="node" schema="sparql-results" include="smallbody">
+ <index type="any">
+ ?thing ?rel ?obj FILTER( str(?thing) = %s )
+ </index>
+ </db>
+ </filter>
+
+ <filter type="log">
+ <message>http</message>
+ </filter>
+
+ <filter type="http_client">
+ <x-forwarded-for>true</x-forwarded-for>
+ </filter>
</filters>