RDF.Query.stream

You're seeing just the function stream, go back to RDF.Query module for more information.
Link to this function

stream(query, graph, opts \\ [])

View Source

Returns a Stream for the execution of the given query against the given graph.

Just like on execute/3 the query can be given directly as RDF.Query.BGP struct created with one of the builder functions in this module or as basic graph pattern expression accepted by bgp/1.

The stream of solutions for variable bindings will be returned in a :ok tuple. In case of an error a :error tuple is returned.

Example

Let's assume we have an example_graph with these triples:

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ex:   <http://example.com/> .

ex:Outlaw
  foaf:name   "Johnny Lee Outlaw" ;
  foaf:mbox   <mailto:jlow@example.com> .

ex:Goodguy
  foaf:name   "Peter Goodguy" ;
  foaf:mbox   <mailto:peter@example.org> ;
  foaf:friend ex:Outlaw .
iex> {:ok, stream} = {:_, FOAF.name, :name?} |> RDF.Query.stream(example_graph())
...> Enum.to_list(stream)
[%{name: ~L"Peter Goodguy"}, %{name: ~L"Johnny Lee Outlaw"}]

iex> {:ok, stream} = [
...>   {:_, FOAF.name, :name?},
...>   {:_, FOAF.mbox, :mbox?},
...> ] |> RDF.Query.stream(example_graph())
...> Enum.take(stream, 1)
[
  %{name: ~L"Peter Goodguy", mbox: ~I<mailto:peter@example.org>},
]