# Query name : query4.2 # Query Type: 4, Historical single-version structured query # Query Description : # Retrieve from a past version, those creative works that are instances of classes BlogPost or NewsItem, are # about a specific topic and their value of primaryFormat is one of TextualFormat, InteractiveFormat or # PictureGalleryFormat. If the creative work has an audience then the creative work should be # obtained using this value. Given the retrieved list of creative works order the result in # descending order of the value of their creationDate property. the size of the resultset is # limited by a random number between 5 and 20. # Query Answering Choke Points : # - UNIONS - optimizer should execute the UNIONs in terms or in parallel # - OPTIONAL clauses (treated by query optimizer as nested sub-queries) # Optimizer should recognize that FILTER condition contains variables which are part of the OPTINAL clauses # and start execution of OPTIONAL clause as soon as possible thus eliminating the intermediate results. # - Optimizer should be able to split the FILTER conditions into conjunction of conditions and # start their execution as soon as possible thus eliminating intermediate results # - Optimizer could consider the possibility to choose a query plan that would facilitate the ordering (ORDER BY) of result PREFIX cwork: SELECT DISTINCT ?creativeWork FROM {{{graphVxMinusGraphVmax}}} WHERE { ?creativeWork cwork:dateCreated ?created . ?creativeWork cwork:about {{{cwAboutUri}}} . { { ?creativeWork cwork:primaryFormat cwork:TextualFormat . } UNION { ?creativeWork cwork:primaryFormat cwork:InteractiveFormat . } UNION { ?creativeWork cwork:primaryFormat cwork:PictureGalleryFormat . } } { { ?creativeWork a cwork:NewsItem . } UNION { ?creativeWork a cwork:BlogPost . } } OPTIONAL { ?creativeWork cwork:audience ?audience } . FILTER (!BOUND(?audience) || ?audience = {{{cwAudience}}}) . } ORDER BY DESC(?created) LIMIT {{{randomLimit}}}