Skip to content

Commit

Permalink
Merge pull request #15 from openpermissions/query
Browse files Browse the repository at this point in the history
Fix generic query so limiting of data happens upfront and not at the end
  • Loading branch information
louisnayegon authored Sep 6, 2016
2 parents 11e0eb2 + ae53247 commit 7f9636d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions repository/models/queries/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,24 @@
SELECT ?{id_name} (MAX(?when) AS ?last_modified)
WHERE {{
?{id_name} a {class} .
OPTIONAL {{ ?{id_name} dcterm:modified ?when }}
{filter}
{{ SELECT ?{id_name} {{
?{id_name} a {class} .
OPTIONAL {{ ?{id_name} dcterm:modified ?when }}
{filter}
}} LIMIT {page_size}
OFFSET {offset}
}}
OPTIONAL {{ ?{id_name} dcterm:modified ?when }}
}}
GROUP BY ?{id_name}
}}
{extra_query}
}}
ORDER BY ?last_modified
LIMIT {page_size}
OFFSET {offset}
"""


INSERT_DATA = """
INSERT DATA {
%s
Expand Down

0 comments on commit 7f9636d

Please sign in to comment.