- <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/"/-->
-
- <!-- Any search in work returns just a list of records.
- Present will make another request for each record to get the level
- of details we want, depending on the schema. -->
- <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>
-
- <!-- bf.uri is a simple way to get to a work -->
- <index type="bf.uri"> ?work a bf:Work FILTER( ?work = %u ) </index>
-
- <!-- Title indexes, directly via work.workTitle -->
- <index type="bf.title">
- ?work bf:workTitle ?wt .
- ?wt bf:titleValue %v FILTER(contains(%v, %s))
- </index>
-
- <index type="bf.subtitle">?work bf:workTitle ?wt .
- ?wt bf:subtitle %v FILTER(contains(%v, %s))
- </index>
-
- <index type="bf.parttitle">
- ?work bf:workTitle ?wt .
- ?wt bf:partTitle %v FILTER(contains(%v, %s))
- </index>
-
- <!-- work.titlevariation - this could also have sub- and partTitles -->
- <index type="bf.titlevariation">
- ?work bf:titleVariation ?tv .
- ?tv bf:titleValue %v FILTER(contains(%v, %s))
- </index>
-
- <!-- Instance titles -->
- <index type="bf.instancetitle">
- ?inst bf:instanceOf ?work .
- ?inst bf:instanceTitle ?it .
- ?it 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">
- { ?work bf:workTitle ?wt .
- { ?wt bf:titleValue %v FILTER(contains(%v, %s)) } UNION
- { ?wt bf:subtitle %v FILTER(contains(%v, %s)) } UNION
- { ?wt bf:partTitle %v FILTER(contains(%v, %s)) }
- } UNION {
- ?work bf:titleVariation ?tv .
- ?tv bf:titleValue %v FILTER(contains(%v, %s))
- } UNION {
- ?inst bf:instanceOf ?work .
- ?inst bf:instanceTitle ?it .
- ?it bf:titleValue %v FILTER(contains(%v, %s))
- }
- </index>
-
- <!-- Author indexes -->
- <index type="bf.creator">
- ?work bf:creator ?c .
- ?c bf:label %v FILTER(contains(%v, %s))
- </index>
-
- <index type="bf.contributor">
- ?work bf:contributor ?c .
- ?c bf:label %v FILTER(contains(%v, %s))
- </index>
-
- <!-- Subjects -->
- <index type="bf.subject">?work bf:subject ?subject .
- ?subject bf:label %v FILTER(contains(%v, %s))
- </index>
-
- <!-- Present formats. BF-L is just the links -->
- <present type="BF-L">
- CONSTRUCT { ?work ?rel ?subj }
- WHERE {
- ?work a bf:Work .
- ?work ?rel ?subj .
- ?work ?rel ?obj FILTER( str(?work) = %s )
- }
- </present>
-
- <!-- BF-F expands all links, except to instances -->
- <present type="BF-F">
- CONSTRUCT { ?work ?rel ?obj .
+ <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 rdf:type ?any FILTER( ?thing = %u ) </index>
+
+
+ <!-- The BF-L present format is the same for everything -->
+ <!-- Each db is supposed to provide a dedicated BF-F present format -->
+ <present type="BF-L">
+ CONSTRUCT {
+ ?thing ?rel ?subj
+ }
+ WHERE {
+ ?thing ?rel ?subj .
+ ?thing ?rel ?subj FILTER( str(?thing) = %s )
+ }
+ </present>
+
+ </db>
+
+ <!-- "smallindex" db that will be included in work and instance -->
+ <!-- It provides the small indexes like bf.person, bf.place, etc -->
+ <db path="smallindex">
+ <!-- Indexes for persons, organizations, etc -->
+ <!-- The person (etc) may be in any relation to the thing, -->
+ <!-- subject, creator, etc, as long as there is a direct link -->
+ <index type="bf.person">
+ ?thing ?rel ?person .
+ ?person a bf:Person .
+ ?person bf:label %v FILTER(contains(%v, %s))
+ </index>
+ <!-- TODO - make many more like the person above -->
+ </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 ?wt .
+ ?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 ?wt .
+ ?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 ?wt .
+ ?wt bf:subtitle %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.parttitle">
+ ?thing bf:workTitle ?wt .
+ ?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 ?tv .
+ ?tv bf:titleValue %v FILTER(contains(%v, %s))
+ </index>
+
+ <!-- Instance titles -->
+ <index type="bf.instancetitle">
+ ?inst bf:instanceOf ?thing .
+ ?inst bf:instanceTitle ?it .
+ ?it 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 -->
+ <!-- TODO - See the anytitle in instance for a more flexible way -->
+ <index type="bf.anytitle">
+ {
+ ?thing bf:workTitle ?wt .
+ { ?wt bf:titleValue %v FILTER(contains(%v, %s)) } UNION
+ { ?wt bf:subtitle %v FILTER(contains(%v, %s)) } UNION
+ { ?wt bf:partTitle %v FILTER(contains(%v, %s)) }
+ } UNION {
+ ?thing bf:titleVariation ?tv .
+ ?tv bf:titleValue %v FILTER(contains(%v, %s))
+ } UNION {
+ ?inst bf:instanceOf ?thing .
+ ?inst bf:instanceTitle ?it .
+ ?it bf:titleValue %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:title %v FILTER(contains(%v, %s))
+ }
+ </index>
+
+ <!-- Author indexes. Much simpler than titles. -->
+ <index type="bf.creator">
+ ?thing bf:creator ?c .
+ ?c bf:label %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.contributor">
+ ?thing bf:contributor ?c .
+ ?c bf:label %v FILTER(contains(%v, %s))
+ </index>
+
+ <index type="bf.anyauthor"> <!-- TODO - Is this a good name? -->
+ {
+ ?thing bf:creator ?c .
+ ?c bf:label %v FILTER(contains(%v, %s))
+ } UNION {
+ ?thing bf:contributor ?c .
+ ?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 ?subject .
+ ?subject bf:label %v FILTER(contains(%v, %s))
+ </index>
+
+
+ <!-- Present formats -->
+ <!-- BF-L comes from the "thing" template -->
+ <!-- BF-F expands all links, except to instances and other works -->
+ <present type="BF-F">
+ CONSTRUCT {
+ ?thing ?rel ?obj .