Details

    • Type: Sub-task
    • Status: Open
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Static Query Optimizer
    • Labels:
      None

      Description

      I am looking at the following query:

      base <http://localhost:8000/>
      prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
      prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
      prefix syapse: <http://localhost:8000/graph/syapse#>
      prefix sys: <http://localhost:8000/bdm/api/kbobject/sys:>
      
      SELECT DISTINCT ?p
      
      WHERE {
        { SELECT DISTINCT ?p ?r ?pLabel  {
        ?t rdfs:subClassOf + syapse:RecordOrRecordPart .
        ?t rdfs:subClassOf ?domain .
        ?p rdfs:domain ?domain .
        ?p rdfs:range ?r .
        ?p rdfs:label ?pLabel .
         }
        }
              {
                 ?p syapse:hasLiteralProperty ?q .
      #  { select distinct ?p {
        ?record syapse:partlet ?x .
        ?x ?p ?key .
        ?record sys:assignedProject ?project .
            ?project syapse:member <http://localhost:8000/bdm/api/syuser/13> .
      #  }}
              }  UNION {
                 ?r rdfs:subClassOf + syapse:Record .
       # { select distinct ?p {
        ?record syapse:partlet ?x .
        ?x ?p ?key .
        ?record sys:assignedProject ?project .
            ?project syapse:member <http://localhost:8000/bdm/api/syuser/13> .
            ?key sys:assignedProject ?projectk .
            ?projectk syapse:member <http://localhost:8000/bdm/api/syuser/13> .
       # }}
      
              } UNION {
                 ?r owl:oneOf ?rr .
       # { select distinct ?p {
        ?record syapse:partlet ?x .
        ?x ?p ?key .
         ?record sys:assignedProject ?project .
         ?project syapse:member <http://localhost:8000/bdm/api/syuser/13> .
       # }}
      
              }
        BIND ( LCASE(?pLabel) AS ?pLabelLC )
      
      }
      ORDER BY ?pLabelLC
      
      

      On my dataset the query above takes 3 minutes, whereas uncommenting the commented out lines, which has no logical impact but merely duplicates a distinctness criteria from the outer query, takes 3 seconds. Is it possible to generalize and automate such a rewrite?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              michaelschmidt michaelschmidt
              Reporter:
              jeremycarroll jeremycarroll
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: