[][src]Enum oxigraph::sparql::QueryResults

pub enum QueryResults {
    Solutions(QuerySolutionIter),
    Boolean(bool),
    Graph(QueryTripleIter),
}

Results of a SPARQL query

Variants

Results of a SELECT query

Boolean(bool)

Result of a ASK query

Results of a CONSTRUCT or DESCRIBE query

Implementations

impl QueryResults[src]

pub fn read(
    reader: impl BufRead + 'static,
    format: QueryResultsFormat
) -> Result<Self, Error>
[src]

Reads a SPARQL query results serialization

pub fn write(
    self,
    writer: impl Write,
    format: QueryResultsFormat
) -> Result<(), EvaluationError>
[src]

Writes the query results (solutions or boolean)

This method fails if it is called on the Graph results

use oxigraph::MemoryStore;
use oxigraph::model::*;
use oxigraph::sparql::{QueryOptions, QueryResultsFormat};

let store = MemoryStore::new();
let ex = NamedNode::new("http://example.com")?;
store.insert(Quad::new(ex.clone(), ex.clone(), ex.clone(), None));

let mut results = Vec::new();
store.query("SELECT ?s WHERE { ?s ?p ?o }", QueryOptions::default())?.write(&mut results, QueryResultsFormat::Json)?;
assert_eq!(results, "{\"head\":{\"vars\":[\"s\"]},\"results\":{\"bindings\":[{\"s\":{\"type\":\"uri\",\"value\":\"http://example.com\"}}]}}".as_bytes());

pub fn write_graph(
    self,
    write: impl Write,
    format: GraphFormat
) -> Result<(), EvaluationError>
[src]

Writes the graph query results

This method fails if it is called on the Solution or Boolean results

use oxigraph::MemoryStore;
use oxigraph::io::GraphFormat;
use oxigraph::sparql::QueryOptions;
use oxigraph::model::*;
use std::io::Cursor;

let graph = "<http://example.com> <http://example.com> <http://example.com> .\n".as_bytes();

let store = MemoryStore::new();
store.load_graph(Cursor::new(graph), GraphFormat::NTriples, &GraphName::DefaultGraph, None)?;

let mut results = Vec::new();
store.query("CONSTRUCT WHERE { ?s ?p ?o }", QueryOptions::default())?.write_graph(&mut results, GraphFormat::NTriples)?;
assert_eq!(results, graph);

Trait Implementations

impl From<QuerySolutionIter> for QueryResults[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,