|
|
@ -785,6 +785,15 @@ impl From<PropertyPathPattern> for MultiSetPattern { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl From<ListPattern> for MultiSetPattern { |
|
|
|
|
|
|
|
fn from(pattern: ListPattern) -> Self { |
|
|
|
|
|
|
|
match pattern { |
|
|
|
|
|
|
|
ListPattern::ToList(pattern) => pattern, |
|
|
|
|
|
|
|
pattern => MultiSetPattern::ToMultiSet(Box::new(pattern)), |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
struct SparqlMultiSetPattern<'a>(&'a MultiSetPattern); |
|
|
|
struct SparqlMultiSetPattern<'a>(&'a MultiSetPattern); |
|
|
|
|
|
|
|
|
|
|
|
impl<'a> fmt::Display for SparqlMultiSetPattern<'a> { |
|
|
|
impl<'a> fmt::Display for SparqlMultiSetPattern<'a> { |
|
|
@ -874,6 +883,21 @@ pub enum ListPattern { |
|
|
|
Slice(Box<MultiSetPattern>, usize, usize), |
|
|
|
Slice(Box<MultiSetPattern>, usize, usize), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl Default for ListPattern { |
|
|
|
|
|
|
|
fn default() -> Self { |
|
|
|
|
|
|
|
ListPattern::Data(Vec::default()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl From<MultiSetPattern> for ListPattern { |
|
|
|
|
|
|
|
fn from(pattern: MultiSetPattern) -> Self { |
|
|
|
|
|
|
|
match pattern { |
|
|
|
|
|
|
|
MultiSetPattern::ToMultiSet(pattern) => *pattern, |
|
|
|
|
|
|
|
pattern => ListPattern::ToList(pattern), |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl fmt::Display for ListPattern { |
|
|
|
impl fmt::Display for ListPattern { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
|
|
|
match self { |
|
|
|
match self { |
|
|
@ -1000,20 +1024,20 @@ pub enum Query { |
|
|
|
SelectQuery { |
|
|
|
SelectQuery { |
|
|
|
selection: Selection, |
|
|
|
selection: Selection, |
|
|
|
dataset: Dataset, |
|
|
|
dataset: Dataset, |
|
|
|
filter: MultiSetPattern, |
|
|
|
filter: ListPattern, |
|
|
|
}, |
|
|
|
}, |
|
|
|
ConstructQuery { |
|
|
|
ConstructQuery { |
|
|
|
construct: Vec<TriplePattern>, |
|
|
|
construct: Vec<TriplePattern>, |
|
|
|
dataset: Dataset, |
|
|
|
dataset: Dataset, |
|
|
|
filter: MultiSetPattern, |
|
|
|
filter: ListPattern, |
|
|
|
}, |
|
|
|
}, |
|
|
|
DescribeQuery { |
|
|
|
DescribeQuery { |
|
|
|
dataset: Dataset, |
|
|
|
dataset: Dataset, |
|
|
|
filter: MultiSetPattern, |
|
|
|
filter: ListPattern, |
|
|
|
}, |
|
|
|
}, |
|
|
|
AskQuery { |
|
|
|
AskQuery { |
|
|
|
dataset: Dataset, |
|
|
|
dataset: Dataset, |
|
|
|
filter: MultiSetPattern, |
|
|
|
filter: ListPattern, |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1029,7 +1053,7 @@ impl fmt::Display for Query { |
|
|
|
"SELECT {} {} WHERE {{ {} }}", |
|
|
|
"SELECT {} {} WHERE {{ {} }}", |
|
|
|
selection, |
|
|
|
selection, |
|
|
|
dataset, |
|
|
|
dataset, |
|
|
|
SparqlMultiSetPattern(&filter) |
|
|
|
SparqlListPattern(&filter) |
|
|
|
), |
|
|
|
), |
|
|
|
Query::ConstructQuery { |
|
|
|
Query::ConstructQuery { |
|
|
|
construct, |
|
|
|
construct, |
|
|
@ -1044,19 +1068,19 @@ impl fmt::Display for Query { |
|
|
|
.collect::<Vec<String>>() |
|
|
|
.collect::<Vec<String>>() |
|
|
|
.join(" . "), |
|
|
|
.join(" . "), |
|
|
|
dataset, |
|
|
|
dataset, |
|
|
|
SparqlMultiSetPattern(&filter) |
|
|
|
SparqlListPattern(&filter) |
|
|
|
), |
|
|
|
), |
|
|
|
Query::DescribeQuery { dataset, filter } => write!( |
|
|
|
Query::DescribeQuery { dataset, filter } => write!( |
|
|
|
f, |
|
|
|
f, |
|
|
|
"DESCRIBE {} WHERE {{ {} }}", |
|
|
|
"DESCRIBE {} WHERE {{ {} }}", |
|
|
|
dataset, |
|
|
|
dataset, |
|
|
|
SparqlMultiSetPattern(&filter) |
|
|
|
SparqlListPattern(&filter) |
|
|
|
), |
|
|
|
), |
|
|
|
Query::AskQuery { dataset, filter } => write!( |
|
|
|
Query::AskQuery { dataset, filter } => write!( |
|
|
|
f, |
|
|
|
f, |
|
|
|
"ASK {} WHERE {{ {} }}", |
|
|
|
"ASK {} WHERE {{ {} }}", |
|
|
|
dataset, |
|
|
|
dataset, |
|
|
|
SparqlMultiSetPattern(&filter) |
|
|
|
SparqlListPattern(&filter) |
|
|
|
), |
|
|
|
), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|