3 Replies Latest reply on Feb 19, 2014 4:51 PM by alwu-Oracle

    SEM_MATCH Performance

    Pinar Gocebe

      Hi All,

       

      For my project I created a RDF VIEW with R2RML mapping. A part of this mapping is below.

       

      .......
      
      <#TripleMap_HISTORY>
            a       rr:TriplesMap ;
            rr:logicalTable [ rr:sqlQuery "SELECT HISTORY.ID, HISTORY.ENTRANCE_DATE, HISTORY.EXIT_DATE, HISTORY.CONTAINER_ID FROM HISTORY WHERE HISTORY.CONTAINER_ID = EQUIPMENT.ID" ] ;
            rr:subjectMap [
            rr:class arles:History ;
            rr:template "http://data.arkas.com/arles/history/{ID}"
            ] ;
         rr:predicateObjectMap [
            rr:objectMap [
            rr:column "ENTRANCE_DATE";
            ] ;
            rr:predicate arles:entranceDate
            ] ;
         rr:predicateObjectMap [
            rr:objectMap [
            rr:column "EXIT_DATE";
            ] ;
            rr:predicate arles:exitDate
            ] ;
         rr:predicateObjectMap  [
            rr:objectMap [
            rr:joinCondition [
                 rr:child "CONTAINER_ID" ; 
                 rr:parent "ID"
                 ] ; 
             rr:parentTriplesMap <#TripleMap_CONTAINER>
             ] ; 
            rr:predicate arles:usedContainer
            ] .
      
      <#TripleMap_CONTAINER>
            a       rr:TriplesMap ;
            rr:logicalTable [ rr:tableName "EQUIPMENT" ] ;
            rr:subjectMap [
            rr:class arles:Container ;
            rr:template "http://data.arkas.com/arles/container/{ID}"
            ] ;
      ........
      
      
      

       

      I am querying created RDF VIEW with below SEM_MATCH query. There are ~1.500.000 row history in database and execution time of below query exceeds 15 minutes. But, If I remove FILTER, execution time is ~one second.

       

      SELECT container, entranceDate, exitDate FROM TABLE(SEM_MATCH(
          'SELECT ?container ?entranceDate ?exitDate WHERE {
          ?history arles:usedContainer ?container. 
          FILTER( NOT EXISTS{ ?history arles:exitDate ?exitDate.})
          ?history arles:entranceDate ?entranceDate.
          } ',
          SEM_Models('BAKI_RDF_VIEW'),
          NULL,
          SEM_Aliases(SEM_ALIAS('arles','http://data.arkas.com/vocabulary/arles/')),
          NULL ));
      
      
      

       

      What causes this problem? How can I reduce execution time ?

       

      Thanks,

      Pinar

        • 1. Re: SEM_MATCH Performance
          Matperry-Oracle

          Hi Pinar,

           

          What kind of performance do you get if you use two SEM_MATCH queries as follows:

           

          SELECT container, entranceDate

          FROM TABLE(SEM_MATCH( 

              'SELECT ?history ?container ?entranceDate

               WHERE { 

                 ?history arles:usedContainer ?container.  

                 ?history arles:entranceDate ?entranceDate. 

               }', 

               SEM_Models('BAKI_RDF_VIEW'), 

               NULL, 

               SEM_Aliases(SEM_ALIAS('arles','http://data.arkas.com/vocabulary/arles/')), 

               NULL ))

          WHERE history NOT IN (

            SELECT history

            FROM TABLE(SEM_MATCH( 

                'SELECT ?history

                 WHERE { 

                   ?history arles:exitDate ?exitDate.

                 }', 

                 SEM_Models('BAKI_RDF_VIEW'), 

                 NULL, 

                 SEM_Aliases(SEM_ALIAS('arles','http://data.arkas.com/vocabulary/arles/')), 

                 NULL ))); 

           

          Thanks,
          Matt

          • 2. Re: SEM_MATCH Performance
            Pinar Gocebe

            Hi Matt,

             

            The same problem still continues  with this query. I can not find any solution to reduce execution time when I queried directly RDF view.

             

            Thanks,

            Pinar

            • 3. Re: SEM_MATCH Performance
              alwu-Oracle

              Hi Pinar,

               

              To continue from Matt's suggestion, what is the performance you see if you just run

              the first SEM_MATCH query (that has 2 query pattens in the BGP)?

               

              If it is still slow, please cut & paste here the SQL execution plan.

               

              Thanks,


              Zhe Wu