From c1df4c10492078db363fc4071d4c34b02e264905 Mon Sep 17 00:00:00 2001 From: Heikki Levanto Date: Thu, 7 May 2015 15:22:03 +0200 Subject: [PATCH] Heavy refactoring Created a db "thing" that gets included in every other db, and moved common things there. Changed the search clause to always SELECT DISTINCT ?thing, instead of ?work or ?instance. Moved the BF-L present format into "thing". Created a new "smallindex" so "work" and "instance" can share all the small indexes (person etc). --- bibframe/triplestore.xml | 249 ++++++++++++++++++---------------------------- 1 file changed, 98 insertions(+), 151 deletions(-) diff --git a/bibframe/triplestore.xml b/bibframe/triplestore.xml index 1c1d739..28f34c0 100644 --- a/bibframe/triplestore.xml +++ b/bibframe/triplestore.xml @@ -1,38 +1,4 @@ - - - - - - -]> @@ -41,18 +7,53 @@ - - - + + rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns bf: http://bibframe.org/vocab/ +
SELECT DISTINCT ?thing
+ + + + + + ?thing rdf:type ?any FILTER( ?thing = %u ) + + + + + + CONSTRUCT { + ?thing ?rel ?subj + } + WHERE { + ?thing ?rel ?subj . + ?thing ?rel ?subj FILTER( str(?thing) = %s ) + } + + +
+ + + + + + + + + ?thing ?rel ?person . + ?person a bf:Person . + ?person bf:label %v FILTER(contains(%v, %s)) + + + + + - -
SELECT DISTINCT ?work
- ?work a bf:Work + - - ?work a bf:Work FILTER( ?work = %u ) + + ?thing a bf:Work @@ -60,13 +61,13 @@ - ?work bf:title %v FILTER(contains(%v, %s)) + ?thing bf:title %v FILTER(contains(%v, %s)) - ?work bf:workTitle ?wt . + ?thing bf:workTitle ?wt . ?wt bf:titleValue %v FILTER(contains(%v, %s)) @@ -75,32 +76,32 @@ { - ?work bf:workTitle ?wt . + ?thing bf:workTitle ?wt . ?wt bf:titleValue %v FILTER(contains(%v, %s)) } UNION { - ?work bf:title %v FILTER(contains(%v, %s)) + ?thing bf:title %v FILTER(contains(%v, %s)) } - ?work bf:workTitle ?wt . + ?thing bf:workTitle ?wt . ?wt bf:subtitle %v FILTER(contains(%v, %s)) - ?work bf:workTitle ?wt . + ?thing bf:workTitle ?wt . ?wt bf:partTitle %v FILTER(contains(%v, %s)) - ?work bf:titleVariation ?tv . + ?thing bf:titleVariation ?tv . ?tv bf:titleValue %v FILTER(contains(%v, %s)) - ?inst bf:instanceOf ?work . + ?inst bf:instanceOf ?thing . ?inst bf:instanceTitle ?it . ?it bf:titleValue %v FILTER(contains(%v, %s)) @@ -110,39 +111,39 @@ { - ?work bf:workTitle ?wt . + ?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 { - ?work bf:titleVariation ?tv . + ?thing bf:titleVariation ?tv . ?tv bf:titleValue %v FILTER(contains(%v, %s)) } UNION { - ?inst bf:instanceOf ?work . + ?inst bf:instanceOf ?thing . ?inst bf:instanceTitle ?it . ?it bf:titleValue %v FILTER(contains(%v, %s)) } UNION { - ?work bf:title %v FILTER(contains(%v, %s)) + ?thing bf:title %v FILTER(contains(%v, %s)) } - ?work bf:creator ?c . + ?thing bf:creator ?c . ?c bf:label %v FILTER(contains(%v, %s)) - ?work bf:contributor ?c . + ?thing bf:contributor ?c . ?c bf:label %v FILTER(contains(%v, %s)) { - ?work bf:creator ?c . + ?thing bf:creator ?c . ?c bf:label %v FILTER(contains(%v, %s)) } UNION { - ?work bf:contributor ?c . + ?thing bf:contributor ?c . ?c bf:label %v FILTER(contains(%v, %s)) } @@ -151,46 +152,25 @@ - ?work bf:subject ?subject . + ?thing bf:subject ?subject . ?subject bf:label %v FILTER(contains(%v, %s)) - - - - - ?work ?rel ?person . - ?person a bf:Person . - ?person bf:label %v FILTER(contains(%v, %s)) - - - - - CONSTRUCT { - ?work ?rel ?subj - } - WHERE { - ?work a bf:Work . - ?work ?rel ?subj . - ?work ?rel ?subj FILTER( str(?work) = %s ) - } - - + CONSTRUCT { - ?work ?rel ?obj . + ?thing ?rel ?obj . ?obj ?rel1 ?obj1 . ?obj1 ?rel2 ?obj2 . ?obj2 ?rel3 ?obj3 } WHERE { - &workfull; - ?work a bf:Work . - ?work ?rel ?obj . + ?thing a bf:Work . + ?thing ?rel ?obj . OPTIONAL { ?obj ?rel1 ?obj1 MINUS { ?obj a bf:Work } @@ -206,7 +186,7 @@ MINUS { ?obj2 a bf:Work } MINUS { ?obj2 a bf:Instance } } - ?work ?rel ?obj FILTER( str(?work) = %s ) + ?thing ?rel ?obj FILTER( str(?thing) = %s ) } @@ -262,56 +242,47 @@ - - rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns - bf: http://bibframe.org/vocab/ - -
SELECT DISTINCT ?inst
- ?inst a bf:Instance - - - - ?inst a bf:Instance FILTER( ?inst = %u ) - + + ?thing a bf:Instance - ?inst bf:title %v FILTER(contains(%v, %s)) + ?thing bf:title %v FILTER(contains(%v, %s)) - ?inst bf:instanceTitle ?it . + ?thing bf:instanceTitle ?it . ?it bf:titleValue %v FILTER(contains(%v, %s)) - ?inst bf:titleStatement %v FILTER(contains(%v, %s)) + ?thing bf:titleStatement %v FILTER(contains(%v, %s)) { - ?inst bf:instanceTitle ?it . + ?thing bf:instanceTitle ?it . ?it bf:titleValue %v FILTER(contains(%v, %s)) } UNION { - ?inst bf:title %v FILTER(contains(%v, %s)) + ?thing bf:title %v FILTER(contains(%v, %s)) } - ?inst bf:instanceTitle ?it . + ?thing bf:instanceTitle ?it . ?it bf:subtitle %v FILTER(contains(%v, %s)) - ?inst bf:instanceTitle ?it . + ?thing bf:instanceTitle ?it . ?it bf:partTitle %v FILTER(contains(%v, %s)) @@ -319,11 +290,11 @@ { - ?inst bf:title %v FILTER(contains(%v, %s)) + ?thing bf:title %v FILTER(contains(%v, %s)) } UNION { - ?inst bf:titleStatement %v FILTER(contains(%v, %s)) + ?thing bf:titleStatement %v FILTER(contains(%v, %s)) } UNION { - ?inst ?titlerel ?it . + ?thing ?titlerel ?it . ?it a bf:Title { ?it bf:titleValue %v FILTER(contains(%v, %s)) @@ -337,57 +308,46 @@ - ?inst bf:creator ?c . + ?thing bf:creator ?c . ?c bf:label %v FILTER(contains(%v, %s)) - ?inst bf:instanceOf ?work . + ?thing bf:instanceOf ?work . ?work bf:creator ?c . ?c bf:label %v FILTER(contains(%v, %s)) - ?inst bf:instanceOf ?work . + ?thing bf:instanceOf ?work . ?work bf:contributor ?c . ?c bf:label %v FILTER(contains(%v, %s)) - ?inst bf:contributor ?c . + ?thing bf:contributor ?c . ?c bf:label %v FILTER(contains(%v, %s)) { - ?inst bf:creator ?c . + ?thing bf:creator ?c . ?c bf:label %v FILTER(contains(%v, %s)) } UNION { - ?inst bf:contributor ?c . + ?thing bf:contributor ?c . ?c bf:label %v FILTER(contains(%v, %s)) } UNION { - ?inst bf:instanceOf ?work . + ?thing bf:instanceOf ?work . ?work bf:creator ?c . ?c bf:label %v FILTER(contains(%v, %s)) } UNION { - ?inst bf:instanceOf ?work . + ?thing bf:instanceOf ?work . ?work bf:contributor ?c . ?c bf:label %v FILTER(contains(%v, %s)) } - - - CONSTRUCT { - ?inst ?rel ?subj - } - WHERE { - ?inst a bf:Instance . - ?inst ?rel ?subj . - ?inst ?rel ?subj FILTER( str(?inst) = %s ) - } - - + CONSTRUCT { @@ -440,31 +400,11 @@ - - - - - ?thing bf:label %v FILTER(contains(%v, %s)) - - - ?thing bf:label %v FILTER(contains(%v, %s)) - - + + + - - rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns - bf: http://bibframe.org/vocab/ -
SELECT DISTINCT ?thing
- ?thing ?rel ?obj - - CONSTRUCT { - %u ?rel ?obj - } - WHERE { - %u ?rel ?obj . - } - + @@ -480,7 +420,14 @@ - + + + ?thing bf:label %v FILTER(contains(%v, %s)) + + + ?thing bf:label %v FILTER(contains(%v, %s)) + + -- 1.7.10.4