### Quad Construction and Usage Example Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.Quad.html An example demonstrating how to construct a Quad and convert it to its string representation (N-Quads format). ```APIDOC ## Quad Usage Example ### Description This example shows how to create a `Quad` instance and convert it to its N-Quads string representation. ### Code ```rust use spargebra::term::{NamedNode, Quad}; // Assuming NamedNode::new and into() are available and successful let quad = Quad { subject: NamedNode::new("http://example.com/s")?.into(), predicate: NamedNode::new("http://example.com/p")?, object: NamedNode::new("http://example.com/o")?.into(), graph_name: NamedNode::new("http://example.com/g")?.into(), }; assert_eq!( " ", quad.to_string() ); ``` ``` -------------------------------- ### Format GroundTriple as N-Quads Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.GroundTriple.html Example showing how to create a GroundTriple and convert it to its N-Quads string representation. ```rust use spargebra::term::{GroundTriple, NamedNode}; assert_eq!( " ", GroundTriple { subject: NamedNode::new("http://example.com/s")?.into(), predicate: NamedNode::new("http://example.com/p")?, object: NamedNode::new("http://example.com/o")?.into(), } .to_string() ); ``` -------------------------------- ### Create and Format RDF Literals Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.Literal.html Examples of creating different types of RDF literals and converting them to their string representations. ```rust use oxrdf::Literal; use oxrdf::vocab::xsd; assert_eq!( "\"foo\\nbar\"", Literal::new_simple_literal("foo\nbar").to_string() ); assert_eq!( r#""1999-01-01"^^"#, Literal::new_typed_literal("1999-01-01", xsd::DATE).to_string() ); assert_eq!( r#""foo"@en"#, Literal::new_language_tagged_literal("foo", "en")?.to_string() ); ``` -------------------------------- ### Parse Term from NTriples Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.Term.html Example of parsing a Term from its NTriples serialization using FromStr. ```rust use oxrdf::*; use std::str::FromStr; assert_eq!( Term::from_str("\"ex\"")?, Literal::new_simple_literal("ex").into() ); ``` -------------------------------- ### SparqlParser Initialization and Basic Query Parsing Source: https://docs.rs/spargebra/0.4.6/spargebra/struct.SparqlParser.html Demonstrates how to initialize the SparqlParser and parse a basic SPARQL query string. ```APIDOC ## SparqlParser A SPARQL parser. ### Description This struct provides functionality to parse SPARQL query strings. ### Usage Example ```rust use spargebra::SparqlParser; let query_str = "SELECT ?s ?p ?o WHERE { ?s ?p ?o . }"; let query = SparqlParser::new().parse_query(query_str)?; assert_eq!(query.to_string(), query_str); ``` ``` -------------------------------- ### Create and Format a Quad to N-Quads Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.Quad.html Demonstrates creating a Quad instance and converting it to its N-Quads string representation. Requires importing necessary types from spargebra::term. ```rust use spargebra::term::{NamedNode, Quad}; assert_eq!( " ", Quad { subject: NamedNode::new("http://example.com/s")?.into(), predicate: NamedNode::new("http://example.com/p")?, object: NamedNode::new("http://example.com/o")?.into(), graph_name: NamedNode::new("http://example.com/g")?.into(), }.to_string() ); ``` -------------------------------- ### Create and format a Variable Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.Variable.html Demonstrates creating a new variable and converting it to its SPARQL string representation. ```rust use oxrdf::{Variable, VariableNameParseError}; assert_eq!("?foo", Variable::new("foo")?.to_string()); ``` -------------------------------- ### Check if NamedOrBlankNode is a BlankNode Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.NamedOrBlankNode.html Use this method to determine if the enum variant is a BlankNode. No setup is required beyond having an instance of NamedOrBlankNode. ```rust pub fn is_blank_node(&self) -> bool ``` -------------------------------- ### Check if NamedOrBlankNode is a NamedNode Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.NamedOrBlankNode.html Use this method to determine if the enum variant is a NamedNode. No setup is required beyond having an instance of NamedOrBlankNode. ```rust pub fn is_named_node(&self) -> bool ``` -------------------------------- ### Get a reference to the inner node Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.NamedOrBlankNode.html Obtains a reference to the inner NamedOrBlankNodeRef. This is useful for borrowing the node's content without taking ownership. ```rust pub fn as_ref(&self) -> NamedOrBlankNodeRef<'_> ``` -------------------------------- ### Initialize SparqlParser Source: https://docs.rs/spargebra/0.4.6/spargebra/struct.SparqlParser.html Basic usage of the SparqlParser to parse a standard SPARQL query string. ```rust use spargebra::SparqlParser; let query_str = "SELECT ?s ?p ?o WHERE { ?s ?p ?o . }"; let query = SparqlParser::new().parse_query(query_str)?; assert_eq!(query.to_string(), query_str); ``` -------------------------------- ### Create and Format a BlankNode Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.BlankNode.html Demonstrates creating a new BlankNode from an identifier and verifying its string representation. ```rust use oxrdf::BlankNode; assert_eq!("_:a122", BlankNode::new("a122")?.to_string()); ``` -------------------------------- ### Parse SPARQL Query Source: https://docs.rs/spargebra Use `SparqlParser` to parse a SPARQL query string into a `Query` object. The `parse_query` method returns a `Result`, which can be unwrapped to get the parsed query. The parsed query can be converted back to a string. ```rust use spargebra::SparqlParser; let query_str = "SELECT ?s ?p ?o WHERE { ?s ?p ?o . }"; let query = SparqlParser::new().parse_query(query_str).unwrap(); assert_eq!(query.to_string(), query_str); ``` -------------------------------- ### Configure Prefixes Source: https://docs.rs/spargebra/0.4.6/spargebra/struct.SparqlParser.html Use with_prefix to define custom IRI prefixes for use in the query string. ```rust use spargebra::SparqlParser; let query = SparqlParser::new() .with_prefix("ex", "http://example.com/")? .parse_query("SELECT * WHERE { ex:s ex:p ex:o }")?; assert_eq!( query.to_string(), "SELECT * WHERE { . }" ); ``` -------------------------------- ### CloneToUninit Implementation (Nightly) Source: https://docs.rs/spargebra/0.4.6/spargebra/algebra/enum.OrderExpression.html Performs copy-assignment from self to an uninitialized memory location. This is an experimental nightly-only API. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Format GroundQuad as N-Quads Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.GroundQuad.html Demonstrates creating a GroundQuad instance and converting it to its N-Quads string representation. ```rust use spargebra::term::{NamedNode, GroundQuad}; assert_eq!( " ", GroundQuad { subject: NamedNode::new("http://example.com/s")?.into(), predicate: NamedNode::new("http://example.com/p")?, object: NamedNode::new("http://example.com/o")?.into(), graph_name: NamedNode::new("http://example.com/g")?.into(), }.to_string() ); ``` -------------------------------- ### SparqlParser with Prefix Source: https://docs.rs/spargebra/0.4.6/spargebra/struct.SparqlParser.html Demonstrates setting a default IRI prefix for parsing. ```APIDOC ## SparqlParser::with_prefix ### Description Set a default IRI prefix used during parsing. ### Method ```rust pub fn with_prefix( self, prefix_name: impl Into, prefix_iri: impl Into, ) -> Result ``` ### Usage Example ```rust use spargebra::SparqlParser; let query = SparqlParser::new() .with_prefix("ex", "http://example.com/")?; .parse_query("SELECT * WHERE { ex:s ex:p ex:o }")?; assert_eq!( query.to_string(), "SELECT * WHERE { . }" ); ``` ``` -------------------------------- ### Define and format a Triple Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.Triple.html Demonstrates creating a Triple instance and converting it to a string representation compatible with N-Triples, Turtle, and SPARQL. ```rust pub struct Triple { pub subject: NamedOrBlankNode, pub predicate: NamedNode, pub object: Term, } ``` ```rust use oxrdf::{NamedNode, Triple}; assert_eq!( " ", Triple { subject: NamedNode::new("http://example.com/s")?.into(), predicate: NamedNode::new("http://example.com/p")?, object: NamedNode::new("http://example.com/o")?.into(), } .to_string() ); ``` -------------------------------- ### Implement TryFrom for GroundQuadPattern Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.GroundQuadPattern.html Enables conversion from a QuadPattern to a GroundQuadPattern, with a potential error if the conversion fails. ```rust type Error = () ``` ```rust fn try_from(pattern: QuadPattern) -> Result ``` -------------------------------- ### Create and Format NamedNode Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.NamedNode.html Demonstrates creating a NamedNode from a string and converting it to its N-Triples, Turtle, and SPARQL compatible string representation. Requires the oxrdf crate. ```rust use oxrdf::NamedNode; assert_eq!( "", NamedNode::new("http://example.com/foo")?.to_string() ); ``` -------------------------------- ### CloneToUninit Trait (Nightly) Source: https://docs.rs/spargebra/0.4.6/spargebra/enum.Query.html Performs copy-assignment to uninitialized memory. This is a nightly-only experimental API. ```APIDOC ## CloneToUninit Trait ### Description Performs copy-assignment to uninitialized memory. This is a nightly-only experimental API. ### Methods #### `unsafe fn clone_to_uninit(&self, dest: *mut u8)` Performs copy-assignment from `self` to `dest`. ``` -------------------------------- ### Literal Constructors Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.Literal.html Methods for creating new Literal instances. ```APIDOC ## Literal Constructors ### `fn new_simple_literal(value: impl Into) -> Literal` Builds an RDF simple literal. ### `fn new_typed_literal(value: impl Into, datatype: impl Into) -> Literal` Builds an RDF literal with a datatype. ### `fn new_language_tagged_literal(value: impl Into, language: impl Into) -> Result` Builds an RDF language-tagged string. Returns an error if the language tag is invalid. ### `fn new_language_tagged_literal_unchecked(value: impl Into, language: impl Into) -> Literal` Builds an RDF language-tagged string without validating the language tag. The caller is responsible for ensuring the language tag is a valid BCP47 tag and is lowercase. ### `fn new_directional_language_tagged_literal(value: impl Into, language: impl Into, direction: impl Into) -> Result` Available on **crate feature`rdf-12`** only. Builds an RDF directional language-tagged string. Returns an error if the language tag is invalid. ### `fn new_directional_language_tagged_literal_unchecked(value: impl Into, language: impl Into, direction: impl Into) -> Literal` Available on **crate feature`rdf-12`** only. Builds an RDF directional language-tagged string without validating the language tag. The caller is responsible for ensuring the language tag is a valid BCP47 tag and is lowercase. ``` -------------------------------- ### VZip Implementation Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.Quad.html Details the implementation of VZip for a generic type T with a MultiLane constraint V. ```APIDOC ## impl VZip for T ### Description Implements the `VZip` trait for type `T` where `V` is a `MultiLane` of `T`. ### Method `vzip` ### Endpoint N/A (This is a Rust implementation detail, not a web API endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) Returns an instance of `V`. #### Response Example None ``` -------------------------------- ### TryFrom Implementations for Term Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.Term.html Provides details on converting Term objects into specific types like Literal, NamedNode, and NamedOrBlankNode. ```APIDOC ## TryFrom Implementations ### Description These implementations allow for the fallible conversion of a `Term` into more specific types such as `Literal`, `NamedNode`, or `NamedOrBlankNode`. ### Methods - **try_from(term: Term) -> Result** ### Parameters #### Request Body - **term** (Term) - Required - The term object to be converted. ### Response #### Success Response (200) - **Result** (Self) - The converted object (Literal, NamedNode, or NamedOrBlankNode). #### Error Response - **Error** (TryFromTermError) - Returned if the conversion fails. ``` -------------------------------- ### Implement TryFrom<&String> for Query Source: https://docs.rs/spargebra/0.4.6/spargebra/enum.Query.html Enables converting a String into a Query object using `try_from`. Returns a `Result` with `SparqlSyntaxError` on failure. ```rust impl TryFrom<&String> for Query { type Error = SparqlSyntaxError; fn try_from(query: &String) -> Result { // ... implementation details ... } } ``` -------------------------------- ### Implement From for GroundTerm Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.GroundTerm.html Enables conversion from GroundTriple to GroundTerm. This is available only when the 'sparql-12' feature is enabled. ```rust fn from(triple: GroundTriple) -> Self ``` -------------------------------- ### VZip Implementation Source: https://docs.rs/spargebra/0.4.6/spargebra/algebra/enum.OrderExpression.html Zips multiple lanes of a value together. ```rust fn vzip(self) -> V ``` -------------------------------- ### Implement StructuralPartialEq for GroundQuadPattern Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.GroundQuadPattern.html Enables structural equality comparison for GroundQuadPattern, which compares the structure of the data rather than just the values. ```rust impl StructuralPartialEq for GroundQuadPattern ``` -------------------------------- ### From Trait Source: https://docs.rs/spargebra/0.4.6/spargebra/enum.Query.html Enables conversion from one type to another. ```APIDOC ## From Trait ### Description Enables conversion from one type to another. ### Methods #### `fn from(t: T) -> T` Returns the argument unchanged. ``` -------------------------------- ### Into Trait Source: https://docs.rs/spargebra/0.4.6/spargebra/enum.Query.html Enables conversion into another type. ```APIDOC ## Into Trait ### Description Enables conversion into another type. ### Methods #### `fn into(self) -> U` Calls `U::from(self)`. That is, this conversion is whatever the implementation of `From for U` chooses to do. ``` -------------------------------- ### SPARQL 1.1 Query Algebra Components Source: https://docs.rs/spargebra/0.4.6/spargebra/algebra/index.html Overview of the core data structures and enums used to represent SPARQL 1.1 queries within the spargebra crate. ```APIDOC ## SPARQL 1.1 Query Algebra ### Description The spargebra crate provides a set of Rust types to represent the SPARQL 1.1 Query Algebra. ### Structs - **QueryDataset**: Represents a SPARQL query dataset specification. ### Enums - **AggregateExpression**: A set function used in aggregates. - **AggregateFunction**: An aggregate function name. - **Expression**: A SPARQL expression. - **Function**: A function name. - **GraphPattern**: A SPARQL query graph pattern. - **GraphTarget**: A target RDF graph for update operations. - **OrderExpression**: An ordering comparator used by GraphPattern::OrderBy. - **PropertyPathExpression**: A property path expression. ``` -------------------------------- ### Quad Trait Implementations Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.Quad.html Details the various trait implementations for the Quad struct, including Clone, Debug, Display, PartialEq, and conversion traits. ```APIDOC ## Quad Trait Implementations ### `impl Clone for Quad` - `fn clone(&self) -> Quad`: Returns a duplicate of the value. - `fn clone_from(&mut self, source: &Self)`: Performs copy-assignment from `source`. ### `impl Debug for Quad` - `fn fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### `impl Display for Quad` - `fn fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### `impl Hash for Quad` - `fn hash<__H: Hasher>(&self, state: &mut __H)`: Feeds this value into the given `Hasher`. - `fn hash_slice(data: &[Self], state: &mut H)`: Feeds a slice of this type into the given `Hasher`. ### `impl PartialEq for Quad` - `fn eq(&self, other: &Quad) -> bool`: Tests for `self` and `other` values to be equal. - `fn ne(&self, other: &Rhs) -> bool`: Tests for `!=`. ### `impl TryFrom for GroundQuad` - `type Error = ()` - `fn try_from(quad: Quad) -> Result`: Performs the conversion. ### `impl TryFrom for Quad` - `type Error = ()` - `fn try_from(quad: QuadPattern) -> Result`: Performs the conversion. ### `impl Eq for Quad` ### `impl StructuralPartialEq for Quad` ``` -------------------------------- ### Try Into Conversion Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.GraphNamePattern.html Provides details on the `try_into` function for performing conversions. ```APIDOC ## fn try_into(self) -> Result>::Error> ### Description Performs the conversion. ### Method N/A (Method within an implementation) ### Endpoint N/A (Function within a trait implementation) ### Parameters N/A ### Request Body N/A ### Response N/A ### Response Example N/A ``` -------------------------------- ### QuadPattern Trait Implementations Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.QuadPattern.html Overview of the trait implementations available for the QuadPattern struct. ```APIDOC ## Trait Implementations for QuadPattern ### impl Clone for QuadPattern - `fn clone(&self) -> QuadPattern`: Returns a duplicate of the value. - `fn clone_from(&mut self, source: &Self)`: Performs copy-assignment from `source`. ### impl Debug for QuadPattern - `fn fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### impl Display for QuadPattern - `fn fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### impl Hash for QuadPattern - `fn hash<__H: Hasher>(&self, state: &mut __H)`: Feeds this value into the given `Hasher`. - `fn hash_slice(data: &[Self], state: &mut H)`: Feeds a slice of this type into the given `Hasher`. ### impl PartialEq for QuadPattern - `fn eq(&self, other: &QuadPattern) -> bool`: Tests for `self` and `other` values to be equal. - `fn ne(&self, other: &Rhs) -> bool`: Tests for `!=`. ### impl TryFrom for GroundQuadPattern - `type Error = ()` - `fn try_from(pattern: QuadPattern) -> Result`: Performs the conversion. ### impl TryFrom for Quad - `type Error = ()` - `fn try_from(quad: QuadPattern) -> Result`: Performs the conversion. ### impl Eq for QuadPattern ### impl StructuralPartialEq for QuadPattern ``` -------------------------------- ### TryInto Conversion Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.GroundTerm.html Defines the conversion process and error handling for the TryInto trait. ```APIDOC ## try_into ### Description Performs the conversion from type T to type U. ### Parameters - **self** - Required - The source instance to convert. ### Response - **Result>::Error>** - Returns the converted type U or the associated conversion error. ``` -------------------------------- ### Parse SPARQL Query with Spargebra Source: https://docs.rs/spargebra/0.4.6/spargebra/enum.Query.html Demonstrates parsing a SPARQL query string into a Query object using SparqlParser. It also shows how to convert the parsed query to its string representation and SPARQL S-Expression format. ```rust use spargebra::SparqlParser; let query_str = "SELECT ?s ?p ?o WHERE { ?s ?p ?o . }"; let query = SparqlParser::new().parse_query(query_str)?; assert_eq!(query.to_string(), query_str); assert_eq!( query.to_sse(), "(project (?s ?p ?o) (bgp (triple ?s ?p ?o)))" ); ``` -------------------------------- ### Implement TryFrom<&str> for Query Source: https://docs.rs/spargebra/0.4.6/spargebra/enum.Query.html Enables converting a string slice into a Query object using `try_from`. Returns a `Result` with `SparqlSyntaxError` on failure. ```rust impl TryFrom<&str> for Query { type Error = SparqlSyntaxError; fn try_from(query: &str) -> Result { // ... implementation details ... } } ``` -------------------------------- ### Parsing a SPARQL Query Source: https://docs.rs/spargebra/0.4.6/spargebra/enum.Query.html Demonstrates how to use the SparqlParser to convert a SPARQL query string into a Query object. ```APIDOC ## POST /parse-query ### Description Parses a raw SPARQL query string into a structured Query object. ### Method POST ### Request Body - **query** (string) - Required - The SPARQL query string to parse. - **base_iri** (string) - Optional - The base IRI for resolving relative IRIs. ### Request Example { "query": "SELECT ?s ?p ?o WHERE { ?s ?p ?o . }", "base_iri": null } ### Response #### Success Response (200) - **query_type** (string) - The type of query (Select, Construct, Describe, or Ask). - **dataset** (object) - The query dataset specification. - **pattern** (object) - The query selection graph pattern. #### Response Example { "query_type": "Select", "pattern": { "type": "bgp", "triples": [...] } } ``` -------------------------------- ### Data Conversion and Cloning Source: https://docs.rs/spargebra/0.4.6/spargebra/algebra/enum.Function.html Provides methods for creating owned data from borrowed data, cloning data into existing variables, and converting values to strings. ```APIDOC ## fn to_owned(&self) -> T ### Description Creates owned data from borrowed data, usually by cloning. ### Method `to_owned` ### Endpoint N/A (Method implementation) ## fn clone_into(&self, target: &mut T) ### Description Uses borrowed data to replace owned data, usually by cloning. ### Method `clone_into` ### Endpoint N/A (Method implementation) ## fn to_string(&self) -> String ### Description Converts the given value to a `String`. ### Method `to_string` ### Endpoint N/A (Method implementation) ``` -------------------------------- ### CloneToUninit Trait Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.NamedNode.html Provides a method to clone data into an uninitialized memory location. This is an experimental, nightly-only API. ```APIDOC ## unsafe fn clone_to_uninit(&self, dest: *mut u8) ### Description Performs copy-assignment from `self` to `dest`. ### Method unsafe fn ### Endpoint N/A (Trait method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response None ### Error Handling None ``` -------------------------------- ### Implement TryFrom for GroundTerm Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.GroundTerm.html Enables attempting to convert a Term into a GroundTerm. Returns a Result indicating success or failure. ```rust type Error = (); fn try_from(term: Term) -> Result ``` -------------------------------- ### TryFrom for GroundTriplePattern Conversion Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.TriplePattern.html Attempts to convert a TriplePattern into a GroundTriplePattern. This conversion is available when the 'sparql-12' crate feature is enabled and may fail if the TriplePattern contains variables or unbound terms. ```rust fn try_from(triple: TriplePattern) -> Result ``` -------------------------------- ### GroundQuad Trait Implementations Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.GroundQuad.html Details on the various trait implementations for the GroundQuad struct, including Clone, Debug, Display, PartialEq, and TryFrom. ```APIDOC ## Trait Implementations for GroundQuad ### impl Clone for GroundQuad - `fn clone(&self) -> GroundQuad`: Returns a duplicate of the value. - `fn clone_from(&mut self, source: &Self)`: Performs copy-assignment from `source`. ### impl Debug for GroundQuad - `fn fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### impl Display for GroundQuad - `fn fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### impl Hash for GroundQuad - `fn hash<__H: Hasher>(&self, state: &mut __H)`: Feeds this value into the given `Hasher`. - `fn hash_slice(data: &[Self], state: &mut H)`: Feeds a slice of this type into the given `Hasher`. ### impl PartialEq for GroundQuad - `fn eq(&self, other: &GroundQuad) -> bool`: Tests for `self` and `other` values to be equal. - `fn ne(&self, other: &Rhs) -> bool`: Tests for `!=`. ### impl TryFrom for GroundQuad - `type Error = ()` - `fn try_from(quad: Quad) -> Result`: Performs the conversion. ### impl Eq for GroundQuad ### impl StructuralPartialEq for GroundQuad ``` -------------------------------- ### Implement PartialEq for GroundTerm Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.GroundTerm.html Defines equality comparison for GroundTerm values. ```rust fn eq(&self, other: &GroundTerm) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### Conversion Traits Source: https://docs.rs/spargebra/0.4.6/spargebra/algebra/enum.Expression.html Standard library conversion traits including From, Into, TryFrom, and TryInto. ```APIDOC ## fn from(t: T) -> T ### Description Returns the argument unchanged. ## fn into(self) -> U ### Description Calls U::from(self). ## fn try_from(value: U) -> Result>::Error> ### Description Performs the conversion with error handling. ## fn try_into(self) -> Result>::Error> ### Description Performs the conversion into a target type with error handling. ``` -------------------------------- ### SparqlParser with Base IRI Source: https://docs.rs/spargebra/0.4.6/spargebra/struct.SparqlParser.html Shows how to configure the parser with a base IRI to resolve relative IRIs. ```APIDOC ## SparqlParser::with_base_iri ### Description Provides an IRI that could be used to resolve the operation relative IRIs. ### Method ```rust pub fn with_base_iri( self, base_iri: impl Into, ) -> Result ``` ### Usage Example ```rust use spargebra::SparqlParser; let query = SparqlParser::new().with_base_iri("http://example.com/")?.parse_query("SELECT * WHERE {

}")?; assert_eq!(query.to_string(), "BASE \nSELECT * WHERE { . }"); ``` ``` -------------------------------- ### Implement Clone for GroundTerm Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.GroundTerm.html Provides methods for cloning GroundTerm values, including `clone` and `clone_from`. ```rust fn clone(&self) -> GroundTerm ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Implement PartialEq for GroundQuadPattern Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.GroundQuadPattern.html Provides equality comparison for GroundQuadPattern instances, allowing checks for whether two patterns are identical. ```rust fn eq(&self, other: &GroundQuadPattern) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### TermPattern Blanket Implementations Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.TermPattern.html Details on the blanket implementations for the TermPattern enum, including Any, Borrow, BorrowMut, and CloneToUninit. ```APIDOC ## Blanket Implementations ### impl Any for T where T: 'static + ?Sized, #### fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. ### impl Borrow for T where T: ?Sized, #### fn borrow(&self) -> &T Immutably borrows from an owned value. ### impl BorrowMut for T where T: ?Sized, #### fn borrow_mut(&mut self) -> &mut T Mutably borrows from an owned value. ### impl CloneToUninit for T where T: Clone, #### unsafe fn clone_to_uninit(&self, dest: *mut u8) Performs copy-assignment from `self` to `dest`. ``` -------------------------------- ### Error Handling and Conversion Source: https://docs.rs/spargebra/0.4.6/spargebra/algebra/enum.Function.html Details the `TryFrom` and `TryInto` trait implementations, including error types and conversion methods. ```APIDOC ## impl TryFrom for T ### Description Provides functionality to attempt conversion from one type to another, returning a `Result`. #### Associated Type - **Error** (`Infallible`) - The type returned in the event of a conversion error. ### Method `try_from(value: U) -> Result>::Error>` ### Endpoint N/A (Trait implementation) ## impl TryInto for T ### Description Provides functionality to attempt conversion from one type to another using the `TryFrom` trait, returning a `Result`. #### Associated Type - **Error** (`>::Error`) - The type returned in the event of a conversion error. ### Method `try_into(self) -> Result>::Error>` ### Endpoint N/A (Trait implementation) ``` -------------------------------- ### Parse a Triple from a string Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.Triple.html Shows how to use FromStr to parse an RDF triple from an N-Triples formatted string. ```rust use oxrdf::{BlankNode, Literal, NamedNode, Triple}; use std::str::FromStr; assert_eq!( Triple::from_str("_:a \"o\" .")?, Triple::new( BlankNode::new("a")?, NamedNode::new("http://example.com/p")?, Literal::new_simple_literal("o") ) ); ``` -------------------------------- ### ToString Implementation Source: https://docs.rs/spargebra/0.4.6/spargebra/algebra/enum.OrderExpression.html Converts a value into a String. ```rust fn to_string(&self) -> String ``` -------------------------------- ### Variable Creation and Manipulation Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.Variable.html Methods for creating and interacting with SPARQL variables. ```APIDOC ## Variable Creation ### Description Creates a new SPARQL variable instance. The `new` method validates the identifier against SPARQL grammar, while `new_unchecked` skips validation. ### Methods - **new(name: impl Into) -> Result** - **new_unchecked(name: impl Into) -> Variable** ### Request Example ```rust use oxrdf::{Variable, VariableNameParseError}; assert_eq!("?foo", Variable::new("foo")?.to_string()); ``` ## Variable Conversion ### Description Methods to retrieve the string representation of the variable or convert it to other types. ### Methods - **as_str(&self) -> &str** - **into_string(self) -> String** - **as_ref(&self) -> VariableRef<'_>** ## Parsing ### Description Parses a variable from its SPARQL serialization string. ### Method - **from_str(s: &str) -> Result** ### Request Example ```rust use oxrdf::Variable; use std::str::FromStr; assert_eq!(Variable::from_str("$foo")?, Variable::new("foo")?); ``` ``` -------------------------------- ### VZip Operation Source: https://docs.rs/spargebra/0.4.6/spargebra/algebra/enum.Function.html Documentation for the `VZip` trait implementation, used for zipping operations. ```APIDOC ## impl VZip for T ### Description Implements the `VZip` trait for zipping operations. ### Method `vzip(self) -> V` ### Endpoint N/A (Trait implementation) ``` -------------------------------- ### PartialEq Implementation for TriplePattern Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.TriplePattern.html Enables equality comparison between TriplePattern instances. This allows checking if two triple patterns are identical, which is crucial for query optimization and result verification. ```rust fn eq(&self, other: &TriplePattern) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### Implement Clone for GroundQuadPattern Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.GroundQuadPattern.html Provides the ability to create a duplicate of a GroundQuadPattern instance. This is useful for making copies of patterns. ```rust fn clone(&self) -> GroundQuadPattern ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Configure Base IRI Source: https://docs.rs/spargebra/0.4.6/spargebra/struct.SparqlParser.html Use with_base_iri to resolve relative IRIs within the SPARQL query. ```rust use spargebra::SparqlParser; let query = SparqlParser::new().with_base_iri("http://example.com/")?.parse_query("SELECT * WHERE {

}")?; assert_eq!(query.to_string(), "BASE \nSELECT * WHERE { . }"); ``` -------------------------------- ### Parse a BlankNode from String Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.BlankNode.html Shows how to parse a BlankNode from its N-Triples serialization using FromStr. ```rust use oxrdf::BlankNode; use std::str::FromStr; assert_eq!(BlankNode::from_str("_:ex")?, BlankNode::new("ex")?); ``` -------------------------------- ### TryFrom Implementation Source: https://docs.rs/spargebra/0.4.6/spargebra/algebra/enum.OrderExpression.html Attempts to convert a value from one type to another, returning a Result. ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### Implement TryInto for T Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.GroundTerm.html A blanket implementation for attempting conversion from type T to type U. ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### PartialEq Implementations for NamedNode Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.NamedNode.html These implementations define how NamedNode instances can be compared for equality with other types. ```APIDOC ## PartialEq for &str ### Description Provides equality comparison between a string slice and a NamedNode. ### Method `eq` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (bool) - `true` if the string slice is equal to the NamedNode. - `false` otherwise. #### Response Example None ``` ```APIDOC ## PartialEq for str ### Description Provides equality comparison between a string and a NamedNode. ### Method `eq` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (bool) - `true` if the string is equal to the NamedNode. - `false` otherwise. #### Response Example None ``` ```APIDOC ## PartialEq> for NamedNode ### Description Provides equality comparison between a NamedNode and a NamedNodeRef. ### Method `eq` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (bool) - `true` if the NamedNode is equal to the NamedNodeRef. - `false` otherwise. #### Response Example None ``` ```APIDOC ## PartialEq for NamedNode ### Description Provides equality comparison between a NamedNode and a string slice. ### Method `eq` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (bool) - `true` if the NamedNode is equal to the string slice. - `false` otherwise. #### Response Example None ``` ```APIDOC ## PartialEq for NamedNode ### Description Provides equality comparison between two NamedNode instances. ### Method `eq` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (bool) - `true` if the two NamedNode instances are equal. - `false` otherwise. #### Response Example None ``` -------------------------------- ### VZip Implementation Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.GraphNamePattern.html Details the implementation of the `VZip` trait for type `T`. ```APIDOC ## impl VZip for T ### Description Implementation of the `VZip` trait for type `T` where `V` implements `MultiLane`. ### Method N/A (Implementation block) ### Endpoint N/A (Implementation block) ### Parameters N/A ### Request Body N/A ### Response N/A ### Response Example N/A ``` -------------------------------- ### BlankNode::new Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.BlankNode.html Creates a blank node from a unique identifier. The identifier must be valid according to N-Triples, Turtle, and SPARQL grammars. ```APIDOC ### pub fn new(id: impl Into) -> Result Creates a blank node from a unique identifier. The blank node identifier must be valid according to N-Triples, Turtle, and SPARQL grammars. In most cases, it is much more convenient to create a blank node using `BlankNode::default()` that creates a random ID that could be easily inlined by Oxigraph stores. ``` -------------------------------- ### TryFrom and TryInto Traits Source: https://docs.rs/spargebra/0.4.6/spargebra/struct.SparqlParser.html Documentation for fallible conversion traits used for type casting. ```APIDOC ## fn try_from(value: U) -> Result>::Error> ### Description Performs the conversion from type U to type T. ## fn try_into(self) -> Result>::Error> ### Description Performs the conversion from type T to type U. ### Associated Types - **Error** - The type returned in the event of a conversion error. ``` -------------------------------- ### Blanket Implementations for Borrow and BorrowMut Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.NamedNode.html Implementations of `Borrow` and `BorrowMut` traits for any type. ```APIDOC ## Borrow for T ### Description Provides immutable borrowing for any type `T`. ### Method `borrow` ### Endpoint N/A (Trait implementation) ### Parameters None ### Request Example None ### Response #### Success Response (&T) - Returns an immutable reference to the borrowed value. #### Response Example None ``` ```APIDOC ## BorrowMut for T ### Description Provides mutable borrowing for any type `T`. ### Method `borrow_mut` ### Endpoint N/A (Trait implementation) ### Parameters None ### Request Example None ### Response #### Success Response (&mut T) - Returns a mutable reference to the borrowed value. #### Response Example None ``` -------------------------------- ### From Implementation Source: https://docs.rs/spargebra/0.4.6/spargebra/algebra/enum.OrderExpression.html Converts a value into itself, returning the argument unchanged. ```rust fn from(t: T) -> T ``` -------------------------------- ### Spargebra Data Structures Source: https://docs.rs/spargebra/0.4.6/spargebra/term/index.html Overview of the core data structures for RDF 1.1 concepts. ```APIDOC ## Module term spargebra ### Summary Data structures for RDF 1.1 Concepts like IRI, literal or triples. ### Structs * **BlankNode**: An owned RDF blank node. * **GroundQuad**: A RDF triple in an RDF dataset without blank nodes. * **GroundQuadPattern**: A triple pattern in a specific graph without blank nodes. * **GroundTriple**: A RDF triple without blank nodes. * **GroundTriplePattern**: A triple pattern without blank nodes. * **Literal**: An owned RDF literal. * **NamedNode**: An owned RDF IRI. * **Quad**: A RDF triple in an RDF dataset. * **QuadPattern**: A triple pattern in a specific graph * **Triple**: An owned RDF triple. * **TriplePattern**: A triple pattern * **Variable**: A SPARQL query owned variable. ### Enums * **GraphName**: A possible graph name. * **GraphNamePattern**: The union of IRIs, default graph name and variables. * **GroundTerm**: The union of IRIs, literals and triples. * **GroundTermPattern**: The union of terms and variables without blank nodes. * **NamedNodePattern**: The union of IRIs and variables. * **NamedOrBlankNode**: The owned union of IRIs and blank nodes. * **Term**: An owned RDF term * **TermPattern**: The union of terms and variables. ``` -------------------------------- ### Blanket Implementations for GroundTermPattern Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.GroundTermPattern.html Details on blanket implementations applicable to GroundTermPattern. ```APIDOC ### Blanket Implementations * **impl Any for T** * `fn type_id(&self) -> TypeId` - Gets the `TypeId` of `self`. * **impl Borrow for T** * `fn borrow(&self) -> &T` - Immutably borrows from an owned value. * **impl BorrowMut for T** * `fn borrow_mut(&mut self) -> &mut T` - Mutably borrows from an owned value. * **impl CloneToUninit for T** * `unsafe fn clone_to_uninit(&self, dest: *mut u8)` - Performs copy-assignment from `self` to `dest`. * **impl From for T** * `fn from(t: T) -> T` - Returns the argument unchanged. * **impl Into for T** * `fn into(self) -> U` - Calls `U::from(self)`. * **impl ToOwned for T** * `type Owned = T` * `fn to_owned(&self) -> T` - Creates owned data from borrowed data, usually by cloning. ``` -------------------------------- ### Implement From for GroundTermPattern Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.GroundTerm.html Enables conversion from GroundTerm to GroundTermPattern. ```rust fn from(term: GroundTerm) -> Self ``` -------------------------------- ### Clone Implementation for TriplePattern Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.TriplePattern.html Provides methods for cloning TriplePattern instances, allowing for duplicate values to be created. This is useful for scenarios where the original pattern needs to be preserved while a modified copy is used. ```rust fn clone(&self) -> TriplePattern ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Implement TryFrom for T Source: https://docs.rs/spargebra/0.4.6/spargebra/term/enum.GroundTerm.html A blanket implementation for attempting conversion from type U to type T. ```rust type Error = Infallible; fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### TryFrom Trait Source: https://docs.rs/spargebra/0.4.6/spargebra/struct.Update.html Defines the conversion mechanism from one type to another with error handling. ```APIDOC ## TryFrom Trait ### Description Defines the conversion from type U to T, returning a Result containing the converted value or an error. ### Associated Types - **Error** (Infallible) - The type returned in the event of a conversion error. ### Methods - **try_from(value: U) -> Result>::Error>** - Performs the conversion. ``` -------------------------------- ### TryInto Trait Implementation Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.TriplePattern.html Documentation for the TryInto trait implementation for generic types T and U. ```APIDOC ## impl TryInto for T ### Description Provides a conversion from type T to type U, where U implements TryFrom. ### Associated Types - **Error** (>::Error) - The type returned in the event of a conversion error. ### Methods - **try_into(self) -> Result>::Error>** - Performs the conversion. ``` -------------------------------- ### Implement FromStr for Query Source: https://docs.rs/spargebra/0.4.6/spargebra/enum.Query.html Allows parsing a SPARQL query string directly into a Query object using the `from_str` method, with `SparqlSyntaxError` as the potential error type. ```rust impl FromStr for Query { type Err = SparqlSyntaxError; fn from_str(query: &str) -> Result { // ... implementation details ... } } ``` -------------------------------- ### BlankNode::default Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.BlankNode.html Builds a new RDF blank node with a unique ID. ```APIDOC ### impl Default for BlankNode #### fn default() -> BlankNode Builds a new RDF blank node with a unique id. ``` -------------------------------- ### TryFrom for BlankNode Source: https://docs.rs/spargebra/0.4.6/spargebra/term/struct.BlankNode.html Converts a Term into a BlankNode. ```APIDOC ## fn try_from(term: Term) -> Result>::Error> ### Description Performs the conversion from a Term to a BlankNode. ### Parameters #### Request Body - **term** (Term) - Required - The term to be converted into a BlankNode. ### Response #### Success Response (200) - **Result** (BlankNode) - The resulting BlankNode upon successful conversion. ``` -------------------------------- ### Debug Implementation for OrderExpression Source: https://docs.rs/spargebra/0.4.6/spargebra/algebra/enum.OrderExpression.html Enables formatting OrderExpression values for debugging purposes. ```rust fn fmt(&self, f: &mut Formatter<'_>) -> Result ```