PublicShow -- SPARQL/SeRQL runtime support predicates

This module provides runtime support for running compiled queries. I.e. it defines special constructs that may be emitted by the compiler and optmizer that are common to all query languages. Language specific runtime support is in and

See also
- for the implementation of the SeRQL routines.
- for the implementation of the SPARQL routines.
Source rdfql_carthesian(:Bags) is nondet
Bags is a list of independent goals. This predicate provides the variable bindings for the carthesian product of all solutions of each goal in Bags. For example:
?- rdfql_carthesian([ bag([X], between(1,2,X)),
                      bag([Y], between(1,2,Y))]).
X = 1, Y = 1 ;
X = 1, Y = 2 ;
X = 2, Y = 1 ;
X = 2, Y = 2 ;
Source rdfql_cond_bind_null(+List) is det
Bind variables in List to our NULL-representation, which is $null$.
Source rdfql_bind_null(+List) is semidet
True if all elements in List unify with $null$.
Source rdfql_triple_in(-Triple, +Triples) is nondet
True when Triple is an rdf(S,P,O) element in Triples that does not contain NULL. Used for CONSTRUCT and DESCRIBE.

Re-exported predicates

The following predicates are re-exported from other modules

Source serql_member_statement(-Triple, +List)
Get the individual triples from the original reply. Used for CONSTRUCT queries. As handling optional matches is different int SeRQL compared to SPARQL, the selection is in the SeRQL runtime module.
Source serql_compare(+Op, +Left, +Right)
Handle numerical and textual comparison of literals. Some work must be done at compiletime.
Source sparql_service(+Silent, +URL, +Prefixes, +Bindings, +QText)
Execute a remote SPARQL SERVICE request
Silent- is one of silent or error
URL- is the address of the SPARQL server
Prefixes- is a list Prefix-URL
Bindings- is a list VarName=Var
QText- is a string holding the remote query
Source sparql_minus(:QLeft, :QRight)
Realise SPARQL MINUS. This is defined to
  • Take the variables of QLeft
  • Determine the result-set for these variables for both QLeft and QRight
  • Substract those from QLeft that are in QRight
To be done
- : Both the result set and the minus set are in standard order of terms, so we can do ordered subtraction.
Source sparql_eval(+Expr, -Results)
Evaluate a SPARQL expression.
Source sparql_true(+Term)
Generated from FILTER Term, where Term must be converted to a boolean as 'Effective Boolean Value'.
Source sparql_subquery(+Proj, :Query, +Solutions) is nondet
Execute a SPARQL subquery.
Proj- is a list of variables that are shared with the outer query.
To be done
- Call the optimizer.
- Sub queries must be evaluated before the outer query, so we must move them to the head of the query evaluation. Not doing so causes no harm, but leads to repetitive execution of the subquery.
Source sparql_update(:Updates) is det
Handle SPARQL update requests.
To be done
- Realise authorization rules
Source sparql_find(?From, ?To, ?F, ?T, :Q) is nondet
Implement *(PropertyPath). We should probably collect translated queries in a dynamic predicate to avoid the copy_term. Also, Q will quite often be simple. In that case we can map to rdf_reachable/3, although one of the problems is that rdf_reachable/3 uses rdf_has/3, and does not deal with graphs.

We should be a bit smarter here and choose between forward, backward, two-sided breath-first, etc. based on which start point is given.

To be done
- Maybe a thing for using tor? Planning most likely more important than the iteration speed.
Source sparql_group(:Goal, +OuterVars, +InnerVars)
Execute a group that contains non-steadfast variables, which asks for delayed unification of the output arguments.
Source sparql_group(:Goal)
Same as call. Intended to keep groups together to avoid invalid optimizations.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source serql_eval(Arg1, Arg2)