2 Replies Latest reply on Jan 14, 2015 5:56 PM by user8897213

    Why is my SPARQL query so slow when I use property restrictions?

    user8897213

      This is my query:

       

      PREFIX rdfs:   <http://www.w3.org/2000/01/rdf-schema#>

      PREFIX rdl:    <http://data.aibel.com/rdl/>

      PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

      PREFIX owl:   <http://www.w3.org/2002/07/owl#>

      PREFIX ORACLE_SEM_HT_NS: <http://oracle.com/semtech#GET_EXACT_VALUES>

      PREFIX ORACLE_SEM_FS_NS: <http://oracle.com/semtech#timeout=50,qid=123>

      select ?annulus ?annulusLabel ?od ?wt {

        ?annulus a owl:Class ; rdfs:label ?annulusLabel ;

          rdfs:subClassOf/rdfs:subClassOf rdl:X101001915 ; # Circular Cross Section Object

          rdfs:subClassOf [ a owl:Restriction ; owl:onProperty rdl:X101001912 ; # Specified Outside Diameter_mm

            owl:hasValue ?od ] ;

          rdfs:subClassOf [ a owl:Restriction ; owl:onProperty rdl:X101001913 ; # Specified Wall Thickness_mm

            owl:hasValue ?wt ] .

      }

      limit 100

       

      I tried exactly the same query in the Protégé SPARQL tab, with 27000 classes loaded. I get the desired list of results immediately, as soon as I click "Execute". Removing the "limit 100" directive makes Protégé return more results, within about two seconds.

      On my Oracle joseki enpoint is times out. How can I awoid the full table scan on  MDSYS.RDF_LINK$ ?

       

       

      Thanks

      Per Øyvind

        • 1. Re: Why is my SPARQL query so slow when I use property restrictions?
          alwu-Oracle

          What is the hardware configuration? Please list the SGA, PGA, and your I/O subsystem. Are you using a VM?

          Assume the hardware used is a balanced one, we can try the following and see if we can finish a reduced query in the designated time constraint.

           

          e.g.

           

          Run this first:

          prefix ...

          select  ... {

            ?annulus a owl:Class ; rdfs:label ?annulusLabel ;

          }

          limit 100

           

          Run this the second,

          select ?annulus ?annulusLabel ?od ?wt {

            ?annulus a owl:Class ; rdfs:label ?annulusLabel ;

              rdfs:subClassOf/rdfs:subClassOf rdl:X101001915

          }

          limit 100

           

          Run this the third,

          select ... {

            ?annulus a owl:Class ; rdfs:label ?annulusLabel ;

              rdfs:subClassOf/rdfs:subClassOf rdl:X101001915 ;

              rdfs:subClassOf [ a owl:Restriction ; owl:onProperty rdl:X101001912 ;

                owl:hasValue ?od ] ;

          }

           

          Please record the SQL Monitor report and please also take a snapshot before and after running the query, and generate an AWR report. It is very useful to see the top waits. All these will be very helpful for Oracle to understand what is going on.

           

          Thanks,


          Zhe Wu

          • 2. Re: Why is my SPARQL query so slow when I use property restrictions?
            user8897213

            Hi

             

            alter session set optimizer_features_enable = '10.2.0.4';

             

            This setting had a huge impact. On '12.1.0.2' the query never finish. With '10.2.0.4' setting it takes less than 5 seconds.

             

             

            Per Øyvind