All predicatesShow sourcerdfql_util.pl

Source select_results(+Distinct, +Offset, +Limit, +SortBy, -Result, :Goal)
Calls select_results/8 using Group=[] and Having=true.
Source select_results(+Distinct, +Group, +Having, +Aggregates, +Offset, +Limit, +SortBy, -Result, :Goal) is nondet
Select results for the template Result on backtracking over Goal.
Arguments:
Distinct- Iff 'distinct', only consider distinct solutions
Group- is a list of variables on which to group the results. These are the only variables that can be used in the HAVING filter and final projection.
Having- is a constraint (similar to FILTER) to filter grouped results.
Aggregates- List of aggregate(Function, Var)
Offset- Skip the first Offset results. Offset is applied after Distinct and SortBy
Limit- Only return the first Limit results. Limit is applied after Distinct, SortBy and Offset. The value 'inf' returns all values.
SortBy- Either 'unsorted' or a term order_by(Cols), where each Col in Cols is a term ascending(Expr) or descending(Expr).
To be done
- Group, Having and Aggregate are currently ignored.
Source group_order(+Cols, -GroupedCols) is det[private]
Group ordering expressions by the same ordering direction. E.g., [ascending(X), ascending(Y), descending(Z)] becomes [ascending([X,Y]), descending([Z])]
Source order_by(+Cols, +Results0, -Results) is det[private]
Order the results. Cols is a list of ascending(Var) or descending(Var). Note that the sorting is done with the least importing (right most) order declaration first and relies on the fact that keysort/2 is stable wrt to ordering the values.
To be done
- For DESC sorting, we need to reverse, but not the order inside the groups. We'd need a reverse keysort/2.
Source sort_key_goal(+ColGroup, -KeyGroup, -Translate)[private]
Source sort_key(+Result, -Key) is det[private]
Determine the sort-key from a result according to the SPARQL standard:
  1. undefined/null
  2. blank nodes
  3. IRIs
  4. RDF Literals
    a. Numbers are mapped to their value space b. Other literals are mapped to their plain literal. Note that this works fine for some types:
    • xsd:date and variants
    • xsd:boolean
bug
- This is not good enough. Literals must be compared in their value-space. This requires some study.
- Result is a SPARQL expression.
Source select_results(+Distinct, +Offset, +Limit, -Result, :Goal)[private]
Unsorted version. In this case we can avoid first collecting all results.
Source apply_offset(+Offset, +AllSolutions, -OffsetSolutions) is det[private]
Source apply_limit(+Limit, +AllSolutions, -LimitSolutions) is det[private]
Source aggregate(+Group, +Aggregates)[private]
Source aggregate_bind(+Aggregation, +State) is det[private]
To be done
- : bind to error if the function does not evaluate?
Source aggregate_distinct(+Operation, +Set, -Value)[private]
Source aggregate_vars(+AggregateEval, -Aggregates, -Template, -Query) is det[private]
Arguments:
AggregateEval- is a combination of aggregate(Expr, Var) and queries that depend on aggregation results and must therefore be executed after computing the aggregates.%
Aggregates- is a list of aggregate(Expr, Var), where Expr is a plain aggregate function over a number of variables and Var is shared with the place where the aggregate is used.
Source entailment_module(+Entailment, -Module)
Find the Prolog module implementing the entailment rules for a semantic web language.