[−][src]Enum oxigraph::sparql::QueryResults
Results of a SPARQL query
Variants
Solutions(QuerySolutionIter)
Results of a SELECT query
Boolean(bool)
Result of a ASK query
Graph(QueryTripleIter)
Implementations
impl QueryResults
[src]
pub fn read(
reader: impl BufRead + 'static,
format: QueryResultsFormat
) -> Result<Self, Error>
[src]
reader: impl BufRead + 'static,
format: QueryResultsFormat
) -> Result<Self, Error>
Reads a SPARQL query results serialization
pub fn write(
self,
writer: impl Write,
format: QueryResultsFormat
) -> Result<(), EvaluationError>
[src]
self,
writer: impl Write,
format: QueryResultsFormat
) -> Result<(), EvaluationError>
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]
self,
write: impl Write,
format: GraphFormat
) -> Result<(), EvaluationError>
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]
fn from(value: QuerySolutionIter) -> Self
[src]
Auto Trait Implementations
impl !RefUnwindSafe for QueryResults
impl !Send for QueryResults
impl !Sync for QueryResults
impl Unpin for QueryResults
impl !UnwindSafe for QueryResults
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,