pub struct Query {Show 19 fields
pub raw: String,
pub query_type: QueryType,
pub triple_patterns: Vec<TriplePattern>,
pub predicates: HashSet<String>,
pub types: HashSet<String>,
pub graphs: SmallVec<[String; 2]>,
pub has_optional: bool,
pub has_union: bool,
pub has_filter: bool,
pub has_aggregation: bool,
pub has_property_paths: bool,
pub has_subquery: bool,
pub has_service: bool,
pub limit: Option<u32>,
pub offset: Option<u32>,
pub complexity: f32,
pub projection_vars: SmallVec<[String; 4]>,
pub structured_triples: Vec<StructuredTriple>,
pub prefixes: HashMap<String, String>,
}Expand description
A parsed SPARQL query with extracted features
Fields§
§raw: StringOriginal query string
query_type: QueryTypeQuery type (SELECT, CONSTRUCT, ASK, DESCRIBE)
triple_patterns: Vec<TriplePattern>Extracted triple patterns
predicates: HashSet<String>Predicates used in the query (URIs)
types: HashSet<String>Types/classes referenced (rdf:type objects)
graphs: SmallVec<[String; 2]>Named graphs referenced
has_optional: boolWhether the query uses OPTIONAL
has_union: boolWhether the query uses UNION
has_filter: boolWhether the query uses FILTER
has_aggregation: boolWhether the query uses aggregation
has_property_paths: boolWhether the query uses property paths
has_subquery: boolWhether the query uses subqueries
has_service: boolWhether the query uses SERVICE (federation)
limit: Option<u32>LIMIT value (if specified)
offset: Option<u32>OFFSET value (if specified)
complexity: f32Complexity score (0.0 - 1.0)
projection_vars: SmallVec<[String; 4]>Variables named in the SELECT projection (e.g. ["a", "b"] for SELECT ?a ?b).
["*"] for SELECT *. Empty for ASK, CONSTRUCT, DESCRIBE, or when constructed
via the heuristic Query::parse (kept for backwards compatibility).
structured_triples: Vec<StructuredTriple>Per-triple structured terms from BGP triples (populated by [Query::from_sparql]).
Empty when using heuristic Query::parse.
prefixes: HashMap<String, String>Prefix declarations from the SPARQL source (populated by [Query::from_sparql]).
Keys are bare prefix labels (e.g., "foaf"), values are namespace IRIs.
Empty when using heuristic Query::parse.
Implementations§
Source§impl Query
impl Query
Sourcepub fn vocabularies(&self) -> HashSet<String>
pub fn vocabularies(&self) -> HashSet<String>
Get vocabulary namespaces used in this query
Sourcepub fn predicate_hash(&self) -> u64
pub fn predicate_hash(&self) -> u64
Hash the predicates for feature extraction (FNV-1a)
Sourcepub const fn requires_sparql_1_1(&self) -> bool
pub const fn requires_sparql_1_1(&self) -> bool
Check if query requires a specific capability