Merge branch 'master' of ssh://git.indexdata.com:222/home/git/pub/mp-sparql
authorHeikki Levanto <heikki@indexdata.dk>
Wed, 29 Apr 2015 10:26:22 +0000 (12:26 +0200)
committerHeikki Levanto <heikki@indexdata.dk>
Wed, 29 Apr 2015 10:26:22 +0000 (12:26 +0200)
1  2 
bibframe/triplestore.xml

diff --combined bibframe/triplestore.xml
        <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>
+           ?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" >
        <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 ?subj }
 +      <form>CONSTRUCT { ?work ?rel ?obj }
        </form>
        <criteria>?work a bf:Work</criteria>
 -      <criteria>?work ?rel ?subj</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
 +                        }
 +      </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>