Towards LOC-7: Config example and experiments
[mp-sparql-moved-to-github.git] / bibframe / triplestore.xml
1 <filters  xmlns="http://indexdata.com/metaproxy">
2   <filter type="sparql">
3       <!-- Which sparql server to use, our demo, or your local installation -->
4     <!--defaults uri="http://bibframe.indexdata.com/sparql/"/-->
5     <defaults uri="http://localhost:8890/sparql/"/>
6
7     <!-- New structure: Any search in work returns just a list of records.
8          Present will make another request to the backend to get the fields
9          we want, depending on the schema. That part is not yet implemented -->
10     <db path="work" schema="sparql-results">
11       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
12       <prefix>bf: http://bibframe.org/vocab/</prefix>
13       <form>SELECT DISTINCT ?work
14       </form>
15       <criteria>?work a bf:Work</criteria>
16       <!-- TODO: Many more indexes like the ones below-->
17       <index type="bf.title">?work bf:workTitle ?wt .
18           ?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
19       <index type="bf.creator">?work bf:creator ?c .
20           ?c bf:label %v FILTER(contains(%v, %s))</index>
21       <index type="bf.subject">?work bf:subject ?subject .
22           ?subject bf:label %v FILTER(contains(%v, %s))</index>
23       <!-- TODO: Define a query to return detailed information for each
24       schema. For example
25       <present shema="BF-L" results="sparql-results" >
26         <query>
27           SELECT ?sub ?rel ?obj
28           WHERE ?work ?rel ?obj FILTER( str(?work) = %s )
29         </query>
30            - or possibly "FILTER ( ?work = <%u> )" if we define %u to
31            expand to the unquoted URI of the work.
32            - Even better, with %u we can say something like
33               SELECT %u ?rel ?obj
34       </present>
35       -->
36     </db>
37
38     <!-- Experiments while waiting for the present queries to be implemented -->
39     <db path="onework-l" schema="sparql-results">
40       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
41       <prefix>bf: http://bibframe.org/vocab/</prefix>
42       <form>SELECT ?work ?rel ?subj
43       </form>
44       <criteria>?work a bf:Work</criteria>
45       <criteria>?work ?rel ?obj</criteria>
46       <index type="any">?work ?rel ?obj FILTER( str(?work) = %s )</index>
47     </db>
48     <db path="onework-l-rdf" schema="rdf">
49       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
50       <prefix>bf: http://bibframe.org/vocab/</prefix>
51       <form>CONSTRUCT { ?work ?rel ?subj }
52       </form>
53       <criteria>?work a bf:Work</criteria>
54       <criteria>?work ?rel ?subj</criteria>
55       <index type="any">?work ?rel ?obj FILTER( str(?work) = %s )</index>
56     </db>
57
58     <!-- This is the old "work" db that will not scale. May be removed -->
59     <db path="concatwork" schema="sparql-results">
60       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
61       <prefix>bf: http://bibframe.org/vocab/</prefix>
62       <form>SELECT
63               ?work
64               (sql:GROUP_DIGEST (?wtitle, ' ; ', 1000, 1)) AS ?title
65               (sql:GROUP_DIGEST (?creatorlabel, ' ; ', 1000, 1))AS ?creator
66               (sql:GROUP_DIGEST (?subjectlabel, ' ; ', 1000, 1))AS ?subject
67       </form>
68       <criteria>?work a bf:Work</criteria>
69
70       <criteria> OPTIONAL {
71           ?work bf:workTitle ?wt .
72           ?wt bf:titleValue ?wtitle }
73       </criteria>
74       <criteria> OPTIONAL {
75           ?work bf:creator ?creator .
76           ?creator bf:label ?creatorlabel }
77       </criteria>
78       <criteria>OPTIONAL {
79           ?work bf:subject ?subject .
80           ?subject bf:label ?subjectlabel }
81       </criteria>
82       <index type="4">?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
83       <index type="1003">?creator bf:label %v FILTER(contains(%v, %s))</index>
84       <index type="21">?subject bf:label %v FILTER(contains(%v, %s))</index>
85       <index type="1016"> {
86             ?work ?op1 ?child .
87             ?child ?op2 %v FILTER(contains(STR(%v), %s))
88           }
89       </index>
90       <modifier>GROUP BY $work</modifier>
91     </db>
92
93     <db path="works" schema="rdf">  <!-- May be removed, will not scale -->
94       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
95       <prefix>bf: http://bibframe.org/vocab/</prefix>
96       <form>CONSTRUCT { 
97           ?work bf:title ?wtitle . 
98           ?work bf:instanceTitle ?title .
99           ?work bf:author ?creator . 
100           ?work bf:subject ?subjectlabel }
101       </form>
102       <criteria>?work a bf:Work</criteria>
103
104       <criteria>?work bf:workTitle ?wt</criteria>
105       <criteria>?wt bf:titleValue ?wtitle</criteria>
106       <index type="4">?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
107       <criteria>?work bf:creator ?creator</criteria>
108       <criteria>?creator bf:label ?creatorlabel</criteria>
109       <index type="1003">?creator bf:label %v FILTER(contains(%v, %s))</index>
110       <criteria>?work bf:subject ?subject</criteria>
111       <criteria>?subject bf:label ?subjectlabel</criteria>
112       <index type="21">?subject bf:label %v FILTER(contains(%v, %s))</index>
113     </db>
114
115     <!-- Instance searches, need to be refined later -->
116     <db path="instance" schema="sparql-results">
117       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
118       <prefix>bf: http://bibframe.org/vocab/</prefix>
119       <form>SELECT ?instance ?title ?format</form>
120       <criteria>?instance a bf:Instance</criteria>
121
122       <criteria>?instance bf:title ?title</criteria>
123       <index type="4">?instance bf:title %v FILTER(contains(%v, %s))</index>
124       <criteria>?instance bf:format ?format</criteria>
125       <index type="1013">?instance bf:format %s</index>
126     </db>
127
128     <!-- Simple databases -->
129     <db path="place" schema="sparql-results">
130       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
131       <prefix>bf: http://bibframe.org/vocab/</prefix>
132       <form>SELECT DISTINCT  ?label ?id ?place ?relatedTo ?authorizedAccessPoint </form>
133       <criteria>?place a bf:Place</criteria>
134       <criteria>?place bf:label ?label</criteria>
135       <criteria>OPTIONAL { ?place bf:identifier ?id}</criteria>
136       <criteria>OPTIONAL { ?place bf:relatedTo ?relatedTo}</criteria>
137       <criteria>OPTIONAL { ?place bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
138       <index type="bf.place">?place bf:label %v FILTER(contains(%v, %s))</index>
139       <index type="any">?place bf:label %v FILTER(contains(%v, %s))</index>
140     </db>
141     <db path="person" schema="sparql-results">
142       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
143       <prefix>bf: http://bibframe.org/vocab/</prefix>
144       <form>SELECT DISTINCT  ?label ?id ?person ?relatedTo ?authorizedAccessPoint </form>
145       <criteria>?person a bf:Person</criteria>
146       <criteria>?person bf:label ?label</criteria>
147       <criteria>OPTIONAL { ?person bf:identifier ?id}</criteria>
148       <criteria>OPTIONAL { ?person bf:relatedTo ?relatedTo}</criteria>
149       <criteria>OPTIONAL { ?person bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
150       <index type="bf.person">?person bf:label %v FILTER(contains(%v, %s))</index>
151       <index type="any">?person bf:label %v FILTER(contains(%v, %s))</index>
152     </db>
153     <db path="meeting" schema="sparql-results">
154       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
155       <prefix>bf: http://bibframe.org/vocab/</prefix>
156       <form>SELECT DISTINCT  ?label ?id ?meeting ?relatedTo ?authorizedAccessPoint </form>
157       <criteria>?meeting a bf:Meeting</criteria>
158       <criteria>?meeting bf:label ?label</criteria>
159       <criteria>OPTIONAL { ?meeting bf:identifier ?id}</criteria>
160       <criteria>OPTIONAL { ?meeting bf:relatedTo ?relatedTo}</criteria>
161       <criteria>OPTIONAL { ?meeting bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
162       <index type="bf.meeting">?meeting bf:label %v FILTER(contains(%v, %s))</index>
163       <index type="any">?meeting bf:label %v FILTER(contains(%v, %s))</index>
164     </db>
165     <db path="agent" schema="sparql-results">
166       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
167       <prefix>bf: http://bibframe.org/vocab/</prefix>
168       <form>SELECT DISTINCT  ?label ?id ?agent ?relatedTo ?authorizedAccessPoint </form>
169       <criteria>?agent a bf:Agent</criteria>
170       <criteria>?agent bf:label ?label</criteria>
171       <criteria>OPTIONAL { ?agent bf:identifier ?id}</criteria>
172       <criteria>OPTIONAL { ?agent bf:relatedTo ?relatedTo}</criteria>
173       <criteria>OPTIONAL { ?agent bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
174       <index type="bf.agent">?agent bf:label %v FILTER(contains(%v, %s))</index>
175       <index type="any">?agent bf:label %v FILTER(contains(%v, %s))</index>
176     </db>
177     <db path="event" schema="sparql-results">
178       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
179       <prefix>bf: http://bibframe.org/vocab/</prefix>
180       <form>SELECT DISTINCT  ?label ?id ?event ?relatedTo ?authorizedAccessPoint </form>
181       <criteria>?event a bf:Event</criteria>
182       <criteria>?event bf:label ?label</criteria>
183       <criteria>OPTIONAL { ?event bf:identifier ?id}</criteria>
184       <criteria>OPTIONAL { ?event bf:relatedTo ?relatedTo}</criteria>
185       <criteria>OPTIONAL { ?event bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
186       <index type="bf.event">?event bf:label %v FILTER(contains(%v, %s))</index>
187       <index type="any">?event bf:label %v FILTER(contains(%v, %s))</index>
188     </db>
189     <db path="organization" schema="sparql-results">
190       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
191       <prefix>bf: http://bibframe.org/vocab/</prefix>
192       <form>SELECT DISTINCT  ?label ?id ?organization ?relatedTo ?authorizedAccessPoint </form>
193       <criteria>?organization a bf:Organization</criteria>
194       <criteria>?organization bf:label ?label</criteria>
195       <criteria>OPTIONAL { ?organization bf:identifier ?id}</criteria>
196       <criteria>OPTIONAL { ?organization bf:relatedTo ?relatedTo}</criteria>
197       <criteria>OPTIONAL { ?organization bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
198       <index type="bf.organization">?organization bf:label %v FILTER(contains(%v, %s))</index>
199       <index type="any">?organization bf:label %v FILTER(contains(%v, %s))</index>
200     </db>
201     <db path="topic" schema="sparql-results">
202       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
203       <prefix>bf: http://bibframe.org/vocab/</prefix>
204       <form>SELECT DISTINCT  ?label ?id ?topic ?relatedTo ?authorizedAccessPoint </form>
205       <criteria>?topic a bf:Topic</criteria>
206       <criteria>?topic bf:label ?label</criteria>
207       <criteria>OPTIONAL { ?topic bf:identifier ?id}</criteria>
208       <criteria>OPTIONAL { ?topic bf:relatedTo ?relatedTo}</criteria>
209       <criteria>OPTIONAL { ?topic bf:authorizedAccessPoint ?authorizedAccessPoint}</criteria>
210       <index type="bf.topic">?topic bf:label %v FILTER(contains(%v, %s))</index>
211       <index type="any">?topic bf:label %v FILTER(contains(%v, %s))</index>
212     </db>
213
214     <!-- Title search, probably not needed. Will need to be rewritten to the same
215     system as the work search above, with separate present query -->
216     <db path="title" schema="sparql-results">
217         <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
218         <prefix>bf: http://bibframe.org/vocab/</prefix>
219         <form>SELECT DISTINCT ?title ?titleValue 
220             ?formDesignation ?partNumber ?partTitle ?subtitle 
221             ?titleAttribute ?titleQualifier ?titleSource 
222             ?titleType ?titleVariationDate</form>
223         <criteria>?title a bf:Title</criteria>
224         <criteria>OPTIONAL { ?title bf:titleValue ?titleValue}</criteria>
225         <criteria>OPTIONAL { ?title bf:formDesignation ?formDesignation}</criteria>
226         <criteria>OPTIONAL { ?title bf:partNumber ?partNumber}</criteria>
227         <criteria>OPTIONAL { ?title bf:partTitle ?partTitle}</criteria>
228         <criteria>OPTIONAL { ?title bf:subtitle ?subtitle}</criteria>
229         <criteria>OPTIONAL { ?title bf:titleAttribute ?titleAttribute}</criteria>
230         <criteria>OPTIONAL { ?title bf:titleQualifier ?titleQualifier}</criteria>
231         <criteria>OPTIONAL { ?title bf:titleSource ?titleSource}</criteria>
232         <criteria>OPTIONAL { ?title bf:titleType ?titleType}</criteria>
233         <criteria>OPTIONAL { ?title bf:titleVariationDate ?titleVariationDate}</criteria>
234         <index type="bf.title">?title bf:titleValue %v FILTER(contains(%v, %s))</index>
235         <index type="bf.subtitle">?title bf:subtitle %v FILTER(contains(%v, %s))</index>
236         <index type="bf.parttitle">?title bf:partTitle %v FILTER(contains(%v, %s))</index>
237         <index type="any">?title ?rel  %v FILTER(contains(str(%v), %s))</index>
238     </db>
239     <!-- A hack to be able to look at any triplet in the base -->
240     <db path="node" schema="sparql-results">
241       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
242       <prefix>bf: http://bibframe.org/vocab/</prefix>
243       <form>SELECT ?node ?rel ?obj</form>
244       <index type="any">?node ?rel ?obj FILTER( str(?node) = %s )</index>
245     </db>
246     <!-- A way to see which triplets refers to a given uri. -->
247     <db path="ref" 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       <form>SELECT ?node ?rel ?obj</form>
251       <index type="any">?node ?rel ?obj FILTER( str(?obj) = %s )</index>
252     </db>
253   </filter>
254   <filter type="log">
255     <message>http</message>
256     <category apdu="true"/>
257   </filter>
258   <filter type="http_client">
259     <x-forwarded-for>true</x-forwarded-for>
260   </filter>
261 </filters>