Skip to content

# `` slice

RDFLib Graphs (and Resources) can be “sliced” with [] syntax

This is a short-hand for iterating over triples.

Combined with SPARQL paths (see `foafpaths.py`) - quite complex queries can be realised.

See `Graph.__getitem__` for details

Attributes:

- `EXAMPLES_DIR` –
- `friends` –
- `graph` –

## `` EXAMPLES_DIR `module-attribute`

    EXAMPLES_DIR = parent

## `` friends `module-attribute`

    friends = list(graph[person:(knows * '+' / name)])

## `` graph `module-attribute`

    graph = Graph()