Difference between revisions of "Scholia Parameter Handling"

From BITPlan cr Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 40: Line 40:
 
| align="right"|          1 || keyword
 
| align="right"|          1 || keyword
 
|}
 
|}
 +
== scholia_jinja_for_loops ==
 +
 +
=== query ===
 +
<source lang='sql'>
 +
SELECT
 +
  count(*),
 +
  substr(
 +
    sparql,
 +
    instr(sparql, '{% for') + length('{% for'),  -- Start position right after "{% for"
 +
    instr(substr(sparql, instr(sparql, '{% for')), '%}') - length('{% for')  -- Length of substring
 +
  ) as for_loop_content
 +
FROM
 +
  NamedQuery
 +
WHERE
 +
  sparql LIKE '%{% for%' ESCAPE '\' and for_loop_content like "%in%"
 +
group by for_loop_content
 +
order by 1 desc
 +
 +
</source>
 +
 +
 +
=== result ===
 +
{| class="wikitable" style="text-align: left;"
 +
|+ <!-- caption -->
 +
|-
 +
! align="right"|  count(*) !! for_loop_content
 +
|-
 +
| align="right"|        28 || q in qs %
 +
|-
 +
| align="right"|          1 || q1 in qs %
 +
|-
 +
| align="right"|          1 || doi in dois %
 +
|-
 +
| align="right"|          1 || day in range(-32, 1) %
 +
|}
 +
[[Category:snapquery]]

Latest revision as of 10:12, 10 July 2024

params_stats

query

SELECT count(*),
    params 
FROM "QueryDetails" 
GROUP BY params 
ORDER BY 1 desc


result

count(*) params
682
293 q
14 q1,q2
9 q,q
3 q,q,q
3 p
1 q,q2
1 q,q,q,q,q
1 q,doi,q,doi,q,doi,q,doi,q,doi
1 lexeme
1 keyword

scholia_jinja_for_loops

query

SELECT
  count(*),
  substr(
    sparql,
    instr(sparql, '{% for') + length('{% for'),  -- Start position right after "{% for"
    instr(substr(sparql, instr(sparql, '{% for')), '%}') - length('{% for')  -- Length of substring
  ) as for_loop_content
FROM
  NamedQuery
WHERE
  sparql LIKE '%{% for%' ESCAPE '\' and for_loop_content like "%in%"
group by for_loop_content
order by 1 desc


result

count(*) for_loop_content
28 q in qs %
1 q1 in qs %
1 doi in dois %
1 day in range(-32, 1) %