Title cc.license._lib.functions:current_version() extremely slow
Priority bug Status unread
Project License Engine Milestone
Superseder Nosy List cwebber, jedoig, nyergler
Assigned To Keywords

Created on 2011-01-18.22:33:27 by cwebber, last changed 2013-10-28.15:01:54 by testedunderdog2.

msg2711 (view) Author: cwebber Date: 2011-01-18.22:33:27
current_version in cc.license is very slow and not the best constructed.

John Doig and Nathan Yergler have made some headway on SPARQL queries for a
replacement call, however these are also slow, as we've seen oddly enough with
other queries which include multiple conditions in the WHERE clause.

  <JED3>  query_string = """
  <JED3>         PREFIX cc: <>
  <JED3>         PREFIX dc: <>
  <JED3>         SELECT ?license
  <JED3>         WHERE
  <JED3>          {
  <JED3>             ?license dc:identifier '%(code)s' .
  <JED3>             ?license cc:jurisdiction <%(jurisdiction)s> .   
  <JED3>          }
  <JED3>         ORDER BY DESC(?license)
  <JED3> there we go 
  <JED3> nyergler: ^^ this sparql will get the current version, but is painfully
         slow at doing so, any idea why?  [17:36]
  <nyergler> JED3: no idea, i arrived at a similar state --  [17:38]
  <nyergler>         PREFIX cc: <>
  <nyergler>         PREFIX rdf: <>
  <nyergler>         PREFIX dcq: <>
  <nyergler>         PREFIX dc: <>
  <nyergler>         SELECT ?license, ?maxversion
  <nyergler>         WHERE
  <nyergler>          {
  <nyergler>             ?license rdf:type cc:License ;
  <nyergler>             dcq:hasVersion ?maxversion ;
  <nyergler>             dc:identifier "%s" .            
  <nyergler>             OPTIONAL { 
  <nyergler>                 ?license dcq:hasVersion ?otherversion .
  <nyergler>                 FILTER (?otherversion > ?maxversion) .  [17:39]
  <nyergler>             }.
  <nyergler>             FILTER ( !bound(?otherversion) ) .
  <nyergler>          }
  <nyergler> (although slightly different SPARQL
  <nyergler> i seem to recall we had this issue before where binding to the
             jurisdiction (or identifier in my case)
  <nyergler> made things really really slow
Date User Action Args
2013-10-28 15:01:54testedunderdog2setfiles: - ul37.html
2013-10-27 16:10:28testedunderdog2setfiles: + ul37.html
2011-01-18 22:33:27cwebbercreate