Name
rowvector_subj_sort, rowvector_obj_sort, rowvector_graph_sort, rowgvector_subj_sort, rowvector_graph_partition, gvector_deduplicate_sorted — SPARQL-result row-vector sort, partition and dedup primitives
Synopsis
rowvector_subj_sort(
|
inout rows any, |
in subj_column integer); |
rowvector_obj_sort(
|
inout rows any, |
in obj_column integer); |
rowvector_graph_sort(
|
inout rows any, |
in graph_column integer); |
rowgvector_subj_sort(
|
inout rows any, |
| in graph_column integer, | |
in subj_column integer); |
any rowvector_graph_partition(
|
inout rows any, |
in graph_column integer); |
any gvector_deduplicate_sorted(
|
inout vec any); |
Description
These BIFs operate on a row vector — a vector of equal-length sub-vectors representing rows of a SPARQL or SQL result. They are emitted by the SPARQL compiler when materializing result sets that need in-memory sorting or graph-aware partitioning before further processing.
rowvector_subj_sort,
rowvector_obj_sort and
rowvector_graph_sort sort rows
in place by the column at zero-based index
subj_column / obj_column /
graph_column using comparison rules appropriate for
SPARQL subjects, objects, or graph IRIs respectively.
rowgvector_subj_sort sorts a "g-vector" keyed first
by graph_column and then by
subj_column, the layout used by quad-store cursors
that walk (G, S, P, O) in graph order.
rowvector_graph_partition groups
rows by graph IRI and returns a vector of
(graph, row-sub-vector) pairs, equivalent to a SPARQL
GROUP BY ?g applied at the result-vector level.
gvector_deduplicate_sorted assumes
vec is sorted (or that adjacent duplicates are
acceptable) and removes consecutive duplicate elements in place. Pair it
with one of the sort BIFs above for an efficient sort-then-uniq.