From 7ca24197492e286182a0d3a7895826fc5f53c5fc Mon Sep 17 00:00:00 2001 From: Heikki Levanto Date: Wed, 6 May 2015 14:18:03 +0200 Subject: [PATCH] Towards LOC-7: beginnings of a proper instance base Present formats BF-L and BF-F seem to work. Needs more indexes --- bibframe/triplestore.xml | 159 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 135 insertions(+), 24 deletions(-) diff --git a/bibframe/triplestore.xml b/bibframe/triplestore.xml index 72c98e7..bc64fab 100644 --- a/bibframe/triplestore.xml +++ b/bibframe/triplestore.xml @@ -37,27 +37,48 @@ - - + + - + rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns bf: http://bibframe.org/vocab/ +
SELECT DISTINCT ?work
?work a bf:Work ?work a bf:Work FILTER( ?work = %u ) - + + + + + ?work bf:title %v FILTER(contains(%v, %s)) + + + + ?work bf:workTitle ?wt . ?wt bf:titleValue %v FILTER(contains(%v, %s)) + + + { + ?work bf:workTitle ?wt . + ?wt bf:titleValue %v FILTER(contains(%v, %s)) + } UNION { + ?work bf:title %v FILTER(contains(%v, %s)) + } + + + + ?work bf:workTitle ?wt . ?wt bf:subtitle %v FILTER(contains(%v, %s)) @@ -94,10 +115,12 @@ ?inst bf:instanceOf ?work . ?inst bf:instanceTitle ?it . ?it bf:titleValue %v FILTER(contains(%v, %s)) + } UNION { + ?work bf:title %v FILTER(contains(%v, %s)) } - + ?work bf:creator ?c . ?c bf:label %v FILTER(contains(%v, %s)) @@ -109,21 +132,33 @@ - ?work bf:subject ?subject . + + ?work 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 ?obj FILTER( str(?work) = %s ) + ?work ?rel ?subj FILTER( str(?work) = %s ) } - + CONSTRUCT { ?work ?rel ?obj . ?obj ?rel1 ?obj1 . @@ -135,15 +170,18 @@ OPTIONAL { ?obj ?rel1 ?obj1 MINUS { ?obj a bf:Work } - } + MINUS { ?obj a bf:Instance } + } OPTIONAL { ?obj1 ?rel2 ?obj2 MINUS { ?obj1 a bf:Work } - } + MINUS { ?obj1 a bf:Instance } + } OPTIONAL { ?obj2 ?rel3 ?obj3 MINUS { ?obj2 a bf:Work } - } + MINUS { ?obj2 a bf:Instance } + } ?work ?rel ?obj FILTER( str(?work) = %s ) } @@ -193,20 +231,93 @@ }
- + + + - rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns - bf: http://bibframe.org/vocab/ -
SELECT ?instance ?title ?format
- ?instance a bf:Instance - ?instance bf:title ?title - ?instance bf:title %v FILTER(contains(%v, %s)) - ?instance bf:format ?format - ?instance bf:format %s + 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 ) + + + + + + + ?inst bf:title %v FILTER(contains(%v, %s)) + + + + + ?inst bf:instanceTitle ?it . + ?it bf:titleValue %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 { + %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 } + } + } + } + } + } + +
- + -- 1.7.10.4