sparqlQuery(self,
selectU,
where,
constraints=[],
optional=[])
A shorthand for the creation of a Query instance and returning the result
of a selection right away. Good for most of the usage, when no more
action (clustering, etc) is necessary.
This method is deprecated and may disappear from future
releases. Use the query method.
-
- Parameters:
selectU -
a tuple with the selection criteria. Each entry is a string
that begins with a "?". If not, it is ignored. If the
selection is only one single string, then the parameter can also
be a single string instead of a tuple.
where -
an array of statement tuples. The tuples are either three or
four elements long. Each of the first three entries in the tuples
is either a string or an RDFLib Identifier (ie, a Literal or a
URIRef). If a string and if the string begins by "?",
it is an unbound variable, otherwise a Literal is created on the
fly. The optional fourth entry in the tuple is a function
reference, ie, a per-pattern condition. The method is invoked
with the bound versions of the tuple variables; if it returns
False, the query is stopped for those bindings. An additional
tweak: an element in 'where' may be a list of tuples, instead of
a tuple. This is interpreted as an 'or', ie, several queries will
be issued by replacing the list with its elements respectively,
and the resulting bindings will be concatenated.
constraints -
a list of functions. All functions will be invoked with a full
binding if found. The input is a dictionary for the binding, the
return value should be true or false. The conditions are 'and'-d,
ie, if one returns false, that particular binding is
rejected.
optional -
like the 'where' array. The subgraph is optional: ie, if no
triple are found for these subgraph, the search goes on (and the
corresponding select entry is set to None)
- Returns:
-
list of query results
Depreciated: this was an earlier implementation version and is kept for backward
compatibility only
|