Uploaded image for project: 'VIVO'
  1. VIVO
  2. VIVO-1400

Have optional "precise subquery" elements in list views for triple stores that perform better with more selective queries

    Details

    • Attachments:
      0
    • Comments:
      0

      Description

      Currently, many of the list views have CONSTRUCT queries using UNIONS to create a smaller dataset, because the OPTIONALs in the select perform badly on SDB.

      The reason for the bad performance is because for SDB, you are joining to views that have large datasets (e.g. OPTIONAL { ?x rdfs:label ?label } - is creating a temporary table of all of the labels in the system.

      If the OPTIONAL element contains enough of the outer query to limit the labels joined to, the large temporary table performance loss is removed.

      e.g. instead of 

      SELECT ?label WHERE { ?x a foaf:Agent . OPTIONAL { ?x rdfs:label ?label . } }

      you have: 

      SELECT ?label WHERE {

        ?x a foaf:Agent .

        OPTIONAL {

          ?x a foaf:Agent .

          ?x rdfs:label ?label .

        }

      }

       

      Not all triple stores benefit from this, so by enabling the precise subquery to be wrapped in a tag:

      SELECT ?label WHERE {

        ?x a foaf:Agent .

        OPTIONAL {

          <precise-subquery>?x a foaf:Agent .</precise-subquery>

          ?x rdfs:label ?label .

        }

      }

       

      The precise-subquery can then be filtered out for triple stores that work best with the simple optionals, but retained for those - like SDB - that benefit from the extra precision.

      When the precise subquery is retained, this is in effect generating queries similar to the CONSTRUCT / UNION queries.

      By using the <precise-subquery>, most of the CONSTRUCT queries can then be removed, achieving optimal performance on all triple stores.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                grahamtriggs Graham Triggs
                Reporter:
                grahamtriggs Graham Triggs
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: