sparql
Classes:
-
AlreadyBound–Raised when trying to bind a variable that is already bound!
-
Bindings–A single level of a stack of variable-value bindings.
-
FrozenBindings– -
FrozenDict–An immutable hashable dict
-
NotBoundError– -
Prologue–A class for holding prefixing bindings and base URI information
-
Query–A parsed and translated query
-
QueryContext–Query context - passed along when evaluating the query
-
SPARQLError– -
SPARQLTypeError– -
Update–A parsed and translated update
AlreadyBound
Bindings
Bindings(outer: Optional[Bindings] = None, d=[])
Bases: MutableMapping
A single level of a stack of variable-value bindings. Each dict keeps a reference to the dict below it, any failed lookup is propegated back
In python 3.3 this could be a collections.ChainMap
Methods:
-
__contains__– -
__delitem__– -
__getitem__– -
__iter__– -
__len__– -
__repr__– -
__setitem__– -
__str__–
Attributes:
-
outer–
Source code in rdflib/plugins/sparql/sparql.py
__contains__
__delitem__
__getitem__
__iter__
__len__
__repr__
__setitem__
FrozenBindings
FrozenBindings(ctx: QueryContext, *args, **kwargs)
Bases: FrozenDict
Methods:
-
__getitem__– -
forget–return a frozen dict only of bindings made in self
-
merge– -
project– -
remember–return a frozen dict only of bindings in these
Attributes:
Source code in rdflib/plugins/sparql/sparql.py
__getitem__
__getitem__(key: Union[Identifier, str]) -> Identifier
Source code in rdflib/plugins/sparql/sparql.py
forget
forget(before: QueryContext, _except: Optional[Container[Variable]] = None) -> FrozenBindings
return a frozen dict only of bindings made in self since before
Source code in rdflib/plugins/sparql/sparql.py
merge
merge(other: Mapping[Identifier, Identifier]) -> FrozenBindings
project
project(vars: Container[Variable]) -> FrozenBindings
remember
remember(these) -> FrozenBindings
FrozenDict
Bases: Mapping
An immutable hashable dict
Taken from http://stackoverflow.com/a/2704866/81121
Methods:
-
__getitem__– -
__hash__– -
__iter__– -
__len__– -
__repr__– -
__str__– -
compatible– -
disjointDomain– -
merge– -
project–
Source code in rdflib/plugins/sparql/sparql.py
__getitem__
__getitem__(key: Identifier) -> Identifier
__hash__
Source code in rdflib/plugins/sparql/sparql.py
__iter__
__len__
__repr__
__str__
compatible
compatible(other: Mapping[Identifier, Identifier]) -> bool
disjointDomain
disjointDomain(other: Mapping[Identifier, Identifier]) -> bool
merge
merge(other: Mapping[Identifier, Identifier]) -> FrozenDict
project
project(vars: Container[Variable]) -> FrozenDict
NotBoundError
Prologue
A class for holding prefixing bindings and base URI information
Methods:
-
absolutize–Apply BASE / PREFIXes to URIs
-
bind– -
resolvePName–
Attributes:
-
base(Optional[str]) – -
namespace_manager–
Source code in rdflib/plugins/sparql/sparql.py
absolutize
Apply BASE / PREFIXes to URIs (and to datatypes in Literals)
TODO: Move resolving URIs to pre-processing
Source code in rdflib/plugins/sparql/sparql.py
bind
resolvePName
resolvePName(prefix: Optional[str], localname: Optional[str]) -> URIRef
Source code in rdflib/plugins/sparql/sparql.py
Query
A parsed and translated query
Attributes:
Source code in rdflib/plugins/sparql/sparql.py
QueryContext
QueryContext(graph: Optional[Graph] = None, bindings: Optional[Union[Bindings, FrozenBindings, List[Any]]] = None, initBindings: Optional[Mapping[str, Identifier]] = None, datasetClause=None)
Query context - passed along when evaluating the query
Methods:
-
__getitem__– -
__setitem__– -
clean– -
clone– -
get– -
load–Load data from the source into the query context’s.
-
push– -
pushGraph– -
solution–Return a static copy of the current variable bindings as dict
-
thaw–Create a new read/write query context from the given solution
Attributes:
-
bindings– -
bnodes(MutableMapping[Identifier, BNode]) – -
dataset(ConjunctiveGraph) –“current dataset
-
graph(Optional[Graph]) – -
initBindings– -
now(datetime) – -
prologue(Optional[Prologue]) –
Source code in rdflib/plugins/sparql/sparql.py
__getitem__
Source code in rdflib/plugins/sparql/sparql.py
__setitem__
clean
clean() -> QueryContext
clone
clone(bindings: Optional[Union[FrozenBindings, Bindings, List[Any]]] = None) -> QueryContext
Source code in rdflib/plugins/sparql/sparql.py
get
load
load(source: URIRef, default: bool = False, into: Optional[Identifier] = None, **kwargs: Any) -> None
Load data from the source into the query context’s.
Parameters:
-
(sourceURIRef) –The source to load from.
-
(defaultbool, default:False) –If
True, triples from the source will be added to the default graph, otherwise it will be loaded into a graph withsourceURI as its name. -
(intoOptional[Identifier], default:None) –The name of the graph to load the data into. If
None, the source URI will be used as as the name of the graph. -
(**kwargsAny, default:{}) –Keyword arguments to pass to
parse.
Source code in rdflib/plugins/sparql/sparql.py
push
push() -> QueryContext
pushGraph
pushGraph(graph: Optional[Graph]) -> QueryContext
solution
solution(vars: Optional[Iterable[Variable]] = None) -> FrozenBindings
Return a static copy of the current variable bindings as dict
Source code in rdflib/plugins/sparql/sparql.py
thaw
thaw(frozenbindings: FrozenBindings) -> QueryContext
Create a new read/write query context from the given solution
SPARQLError
SPARQLTypeError
Update
A parsed and translated update
Attributes: