|
|
@ -33,66 +33,66 @@ pub trait EncodedQuadsStore: BytesStore + Sized { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn quads(&self) -> Result<Self::QuadsIterator>; |
|
|
|
fn quads(&self) -> Result<Self::QuadsIterator>; |
|
|
|
fn quads_for_subject(&self, subject: &EncodedTerm) -> Result<Self::QuadsForSubjectIterator>; |
|
|
|
fn quads_for_subject(&self, subject: EncodedTerm) -> Result<Self::QuadsForSubjectIterator>; |
|
|
|
fn quads_for_subject_predicate( |
|
|
|
fn quads_for_subject_predicate( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
subject: &EncodedTerm, |
|
|
|
subject: EncodedTerm, |
|
|
|
predicate: &EncodedTerm, |
|
|
|
predicate: EncodedTerm, |
|
|
|
) -> Result<Self::QuadsForSubjectPredicateIterator>; |
|
|
|
) -> Result<Self::QuadsForSubjectPredicateIterator>; |
|
|
|
fn quads_for_subject_predicate_object( |
|
|
|
fn quads_for_subject_predicate_object( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
subject: &EncodedTerm, |
|
|
|
subject: EncodedTerm, |
|
|
|
predicate: &EncodedTerm, |
|
|
|
predicate: EncodedTerm, |
|
|
|
object: &EncodedTerm, |
|
|
|
object: EncodedTerm, |
|
|
|
) -> Result<Self::QuadsForSubjectPredicateObjectIterator>; |
|
|
|
) -> Result<Self::QuadsForSubjectPredicateObjectIterator>; |
|
|
|
fn quads_for_subject_object( |
|
|
|
fn quads_for_subject_object( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
subject: &EncodedTerm, |
|
|
|
subject: EncodedTerm, |
|
|
|
object: &EncodedTerm, |
|
|
|
object: EncodedTerm, |
|
|
|
) -> Result<Self::QuadsForSubjectObjectIterator>; |
|
|
|
) -> Result<Self::QuadsForSubjectObjectIterator>; |
|
|
|
fn quads_for_predicate( |
|
|
|
fn quads_for_predicate( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
predicate: &EncodedTerm, |
|
|
|
predicate: EncodedTerm, |
|
|
|
) -> Result<Self::QuadsForPredicateIterator>; |
|
|
|
) -> Result<Self::QuadsForPredicateIterator>; |
|
|
|
fn quads_for_predicate_object( |
|
|
|
fn quads_for_predicate_object( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
predicate: &EncodedTerm, |
|
|
|
predicate: EncodedTerm, |
|
|
|
object: &EncodedTerm, |
|
|
|
object: EncodedTerm, |
|
|
|
) -> Result<Self::QuadsForPredicateObjectIterator>; |
|
|
|
) -> Result<Self::QuadsForPredicateObjectIterator>; |
|
|
|
fn quads_for_object(&self, object: &EncodedTerm) -> Result<Self::QuadsForObjectIterator>; |
|
|
|
fn quads_for_object(&self, object: EncodedTerm) -> Result<Self::QuadsForObjectIterator>; |
|
|
|
fn quads_for_graph(&self, graph_name: &EncodedTerm) -> Result<Self::QuadsForGraphIterator>; |
|
|
|
fn quads_for_graph(&self, graph_name: EncodedTerm) -> Result<Self::QuadsForGraphIterator>; |
|
|
|
fn quads_for_subject_graph( |
|
|
|
fn quads_for_subject_graph( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
subject: &EncodedTerm, |
|
|
|
subject: EncodedTerm, |
|
|
|
graph_name: &EncodedTerm, |
|
|
|
graph_name: EncodedTerm, |
|
|
|
) -> Result<Self::QuadsForSubjectGraphIterator>; |
|
|
|
) -> Result<Self::QuadsForSubjectGraphIterator>; |
|
|
|
fn quads_for_subject_predicate_graph( |
|
|
|
fn quads_for_subject_predicate_graph( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
subject: &EncodedTerm, |
|
|
|
subject: EncodedTerm, |
|
|
|
predicate: &EncodedTerm, |
|
|
|
predicate: EncodedTerm, |
|
|
|
graph_name: &EncodedTerm, |
|
|
|
graph_name: EncodedTerm, |
|
|
|
) -> Result<Self::QuadsForSubjectPredicateGraphIterator>; |
|
|
|
) -> Result<Self::QuadsForSubjectPredicateGraphIterator>; |
|
|
|
fn quads_for_subject_object_graph( |
|
|
|
fn quads_for_subject_object_graph( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
subject: &EncodedTerm, |
|
|
|
subject: EncodedTerm, |
|
|
|
object: &EncodedTerm, |
|
|
|
object: EncodedTerm, |
|
|
|
graph_name: &EncodedTerm, |
|
|
|
graph_name: EncodedTerm, |
|
|
|
) -> Result<Self::QuadsForSubjectObjectGraphIterator>; |
|
|
|
) -> Result<Self::QuadsForSubjectObjectGraphIterator>; |
|
|
|
fn quads_for_predicate_graph( |
|
|
|
fn quads_for_predicate_graph( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
predicate: &EncodedTerm, |
|
|
|
predicate: EncodedTerm, |
|
|
|
graph_name: &EncodedTerm, |
|
|
|
graph_name: EncodedTerm, |
|
|
|
) -> Result<Self::QuadsForPredicateGraphIterator>; |
|
|
|
) -> Result<Self::QuadsForPredicateGraphIterator>; |
|
|
|
fn quads_for_predicate_object_graph( |
|
|
|
fn quads_for_predicate_object_graph( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
predicate: &EncodedTerm, |
|
|
|
predicate: EncodedTerm, |
|
|
|
object: &EncodedTerm, |
|
|
|
object: EncodedTerm, |
|
|
|
graph_name: &EncodedTerm, |
|
|
|
graph_name: EncodedTerm, |
|
|
|
) -> Result<Self::QuadsForPredicateObjectGraphIterator>; |
|
|
|
) -> Result<Self::QuadsForPredicateObjectGraphIterator>; |
|
|
|
fn quads_for_object_graph( |
|
|
|
fn quads_for_object_graph( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
object: &EncodedTerm, |
|
|
|
object: EncodedTerm, |
|
|
|
graph_name: &EncodedTerm, |
|
|
|
graph_name: EncodedTerm, |
|
|
|
) -> Result<Self::QuadsForObjectGraphIterator>; |
|
|
|
) -> Result<Self::QuadsForObjectGraphIterator>; |
|
|
|
fn contains(&self, quad: &EncodedQuad) -> Result<bool>; |
|
|
|
fn contains(&self, quad: &EncodedQuad) -> Result<bool>; |
|
|
|
fn insert(&self, quad: &EncodedQuad) -> Result<()>; |
|
|
|
fn insert(&self, quad: &EncodedQuad) -> Result<()>; |
|
|
@ -160,7 +160,7 @@ impl<S: EncodedQuadsStore> Dataset for StoreDataset<S> { |
|
|
|
Ok(QuadsIterator { |
|
|
|
Ok(QuadsIterator { |
|
|
|
iter: self |
|
|
|
iter: self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.quads_for_subject(&encoder.encode_named_or_blank_node(subject)?)?, |
|
|
|
.quads_for_subject(encoder.encode_named_or_blank_node(subject)?)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -173,8 +173,8 @@ impl<S: EncodedQuadsStore> Dataset for StoreDataset<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(QuadsIterator { |
|
|
|
Ok(QuadsIterator { |
|
|
|
iter: self.store.quads_for_subject_predicate( |
|
|
|
iter: self.store.quads_for_subject_predicate( |
|
|
|
&encoder.encode_named_or_blank_node(subject)?, |
|
|
|
encoder.encode_named_or_blank_node(subject)?, |
|
|
|
&encoder.encode_named_node(predicate)?, |
|
|
|
encoder.encode_named_node(predicate)?, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -189,9 +189,9 @@ impl<S: EncodedQuadsStore> Dataset for StoreDataset<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(QuadsIterator { |
|
|
|
Ok(QuadsIterator { |
|
|
|
iter: self.store.quads_for_subject_predicate_object( |
|
|
|
iter: self.store.quads_for_subject_predicate_object( |
|
|
|
&encoder.encode_named_or_blank_node(subject)?, |
|
|
|
encoder.encode_named_or_blank_node(subject)?, |
|
|
|
&encoder.encode_named_node(predicate)?, |
|
|
|
encoder.encode_named_node(predicate)?, |
|
|
|
&encoder.encode_term(object)?, |
|
|
|
encoder.encode_term(object)?, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -205,8 +205,8 @@ impl<S: EncodedQuadsStore> Dataset for StoreDataset<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(QuadsIterator { |
|
|
|
Ok(QuadsIterator { |
|
|
|
iter: self.store.quads_for_subject_object( |
|
|
|
iter: self.store.quads_for_subject_object( |
|
|
|
&encoder.encode_named_or_blank_node(subject)?, |
|
|
|
encoder.encode_named_or_blank_node(subject)?, |
|
|
|
&encoder.encode_term(object)?, |
|
|
|
encoder.encode_term(object)?, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -220,7 +220,7 @@ impl<S: EncodedQuadsStore> Dataset for StoreDataset<S> { |
|
|
|
Ok(QuadsIterator { |
|
|
|
Ok(QuadsIterator { |
|
|
|
iter: self |
|
|
|
iter: self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.quads_for_predicate(&encoder.encode_named_node(predicate)?)?, |
|
|
|
.quads_for_predicate(encoder.encode_named_node(predicate)?)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -233,8 +233,8 @@ impl<S: EncodedQuadsStore> Dataset for StoreDataset<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(QuadsIterator { |
|
|
|
Ok(QuadsIterator { |
|
|
|
iter: self.store.quads_for_predicate_object( |
|
|
|
iter: self.store.quads_for_predicate_object( |
|
|
|
&encoder.encode_named_node(predicate)?, |
|
|
|
encoder.encode_named_node(predicate)?, |
|
|
|
&encoder.encode_term(object)?, |
|
|
|
encoder.encode_term(object)?, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -246,7 +246,7 @@ impl<S: EncodedQuadsStore> Dataset for StoreDataset<S> { |
|
|
|
) -> Result<QuadsIterator<S::QuadsForObjectIterator, S>> { |
|
|
|
) -> Result<QuadsIterator<S::QuadsForObjectIterator, S>> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(QuadsIterator { |
|
|
|
Ok(QuadsIterator { |
|
|
|
iter: self.store.quads_for_object(&encoder.encode_term(object)?)?, |
|
|
|
iter: self.store.quads_for_object(encoder.encode_term(object)?)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -328,7 +328,7 @@ impl<S: EncodedQuadsStore> Graph for StoreNamedGraph<S> { |
|
|
|
|
|
|
|
|
|
|
|
fn triples(&self) -> Result<TriplesIterator<S::QuadsForGraphIterator, S>> { |
|
|
|
fn triples(&self) -> Result<TriplesIterator<S::QuadsForGraphIterator, S>> { |
|
|
|
Ok(TriplesIterator { |
|
|
|
Ok(TriplesIterator { |
|
|
|
iter: self.store.quads_for_graph(&self.encoded_name)?, |
|
|
|
iter: self.store.quads_for_graph(self.encoded_name)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -340,8 +340,8 @@ impl<S: EncodedQuadsStore> Graph for StoreNamedGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(TriplesIterator { |
|
|
|
Ok(TriplesIterator { |
|
|
|
iter: self.store.quads_for_subject_graph( |
|
|
|
iter: self.store.quads_for_subject_graph( |
|
|
|
&encoder.encode_named_or_blank_node(subject)?, |
|
|
|
encoder.encode_named_or_blank_node(subject)?, |
|
|
|
&self.encoded_name, |
|
|
|
self.encoded_name, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -354,9 +354,9 @@ impl<S: EncodedQuadsStore> Graph for StoreNamedGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(ObjectsIterator { |
|
|
|
Ok(ObjectsIterator { |
|
|
|
iter: self.store.quads_for_subject_predicate_graph( |
|
|
|
iter: self.store.quads_for_subject_predicate_graph( |
|
|
|
&encoder.encode_named_or_blank_node(subject)?, |
|
|
|
encoder.encode_named_or_blank_node(subject)?, |
|
|
|
&encoder.encode_named_node(predicate)?, |
|
|
|
encoder.encode_named_node(predicate)?, |
|
|
|
&self.encoded_name, |
|
|
|
self.encoded_name, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -369,9 +369,9 @@ impl<S: EncodedQuadsStore> Graph for StoreNamedGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(PredicatesIterator { |
|
|
|
Ok(PredicatesIterator { |
|
|
|
iter: self.store.quads_for_subject_object_graph( |
|
|
|
iter: self.store.quads_for_subject_object_graph( |
|
|
|
&encoder.encode_named_or_blank_node(subject)?, |
|
|
|
encoder.encode_named_or_blank_node(subject)?, |
|
|
|
&encoder.encode_term(object)?, |
|
|
|
encoder.encode_term(object)?, |
|
|
|
&self.encoded_name, |
|
|
|
self.encoded_name, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -383,8 +383,8 @@ impl<S: EncodedQuadsStore> Graph for StoreNamedGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(TriplesIterator { |
|
|
|
Ok(TriplesIterator { |
|
|
|
iter: self.store.quads_for_predicate_graph( |
|
|
|
iter: self.store.quads_for_predicate_graph( |
|
|
|
&encoder.encode_named_node(predicate)?, |
|
|
|
encoder.encode_named_node(predicate)?, |
|
|
|
&self.encoded_name, |
|
|
|
self.encoded_name, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -397,9 +397,9 @@ impl<S: EncodedQuadsStore> Graph for StoreNamedGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(SubjectsIterator { |
|
|
|
Ok(SubjectsIterator { |
|
|
|
iter: self.store.quads_for_predicate_object_graph( |
|
|
|
iter: self.store.quads_for_predicate_object_graph( |
|
|
|
&encoder.encode_named_node(predicate)?, |
|
|
|
encoder.encode_named_node(predicate)?, |
|
|
|
&encoder.encode_term(object)?, |
|
|
|
encoder.encode_term(object)?, |
|
|
|
&self.encoded_name, |
|
|
|
self.encoded_name, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -412,7 +412,7 @@ impl<S: EncodedQuadsStore> Graph for StoreNamedGraph<S> { |
|
|
|
Ok(TriplesIterator { |
|
|
|
Ok(TriplesIterator { |
|
|
|
iter: self |
|
|
|
iter: self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.quads_for_object_graph(&encoder.encode_term(object)?, &self.encoded_name)?, |
|
|
|
.quads_for_object_graph(encoder.encode_term(object)?, self.encoded_name)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -422,7 +422,7 @@ impl<S: EncodedQuadsStore> Graph for StoreNamedGraph<S> { |
|
|
|
&self |
|
|
|
&self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.encoder() |
|
|
|
.encoder() |
|
|
|
.encode_triple_in_graph(triple, &self.encoded_name)?, |
|
|
|
.encode_triple_in_graph(triple, self.encoded_name)?, |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -431,7 +431,7 @@ impl<S: EncodedQuadsStore> Graph for StoreNamedGraph<S> { |
|
|
|
&self |
|
|
|
&self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.encoder() |
|
|
|
.encoder() |
|
|
|
.encode_triple_in_graph(triple, &self.encoded_name)?, |
|
|
|
.encode_triple_in_graph(triple, self.encoded_name)?, |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -440,19 +440,16 @@ impl<S: EncodedQuadsStore> Graph for StoreNamedGraph<S> { |
|
|
|
&self |
|
|
|
&self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.encoder() |
|
|
|
.encoder() |
|
|
|
.encode_triple_in_graph(triple, &self.encoded_name)?, |
|
|
|
.encode_triple_in_graph(triple, self.encoded_name)?, |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn len(&self) -> Result<usize> { |
|
|
|
fn len(&self) -> Result<usize> { |
|
|
|
Ok(self.store.quads_for_graph(&self.encoded_name)?.count()) |
|
|
|
Ok(self.store.quads_for_graph(self.encoded_name)?.count()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn is_empty(&self) -> Result<bool> { |
|
|
|
fn is_empty(&self) -> Result<bool> { |
|
|
|
Ok(self |
|
|
|
Ok(self.store.quads_for_graph(self.encoded_name)?.any(|_| true)) |
|
|
|
.store |
|
|
|
|
|
|
|
.quads_for_graph(&self.encoded_name)? |
|
|
|
|
|
|
|
.any(|_| true)) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -489,7 +486,7 @@ impl<S: EncodedQuadsStore> Graph for StoreDefaultGraph<S> { |
|
|
|
|
|
|
|
|
|
|
|
fn triples(&self) -> Result<TriplesIterator<S::QuadsForGraphIterator, S>> { |
|
|
|
fn triples(&self) -> Result<TriplesIterator<S::QuadsForGraphIterator, S>> { |
|
|
|
Ok(TriplesIterator { |
|
|
|
Ok(TriplesIterator { |
|
|
|
iter: self.store.quads_for_graph(&ENCODED_DEFAULT_GRAPH)?, |
|
|
|
iter: self.store.quads_for_graph(ENCODED_DEFAULT_GRAPH)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -501,8 +498,8 @@ impl<S: EncodedQuadsStore> Graph for StoreDefaultGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(TriplesIterator { |
|
|
|
Ok(TriplesIterator { |
|
|
|
iter: self.store.quads_for_subject_graph( |
|
|
|
iter: self.store.quads_for_subject_graph( |
|
|
|
&encoder.encode_named_or_blank_node(subject)?, |
|
|
|
encoder.encode_named_or_blank_node(subject)?, |
|
|
|
&ENCODED_DEFAULT_GRAPH, |
|
|
|
ENCODED_DEFAULT_GRAPH, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -515,9 +512,9 @@ impl<S: EncodedQuadsStore> Graph for StoreDefaultGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(ObjectsIterator { |
|
|
|
Ok(ObjectsIterator { |
|
|
|
iter: self.store.quads_for_subject_predicate_graph( |
|
|
|
iter: self.store.quads_for_subject_predicate_graph( |
|
|
|
&encoder.encode_named_or_blank_node(subject)?, |
|
|
|
encoder.encode_named_or_blank_node(subject)?, |
|
|
|
&encoder.encode_named_node(predicate)?, |
|
|
|
encoder.encode_named_node(predicate)?, |
|
|
|
&ENCODED_DEFAULT_GRAPH, |
|
|
|
ENCODED_DEFAULT_GRAPH, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -530,9 +527,9 @@ impl<S: EncodedQuadsStore> Graph for StoreDefaultGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(PredicatesIterator { |
|
|
|
Ok(PredicatesIterator { |
|
|
|
iter: self.store.quads_for_subject_object_graph( |
|
|
|
iter: self.store.quads_for_subject_object_graph( |
|
|
|
&encoder.encode_named_or_blank_node(subject)?, |
|
|
|
encoder.encode_named_or_blank_node(subject)?, |
|
|
|
&encoder.encode_term(object)?, |
|
|
|
encoder.encode_term(object)?, |
|
|
|
&ENCODED_DEFAULT_GRAPH, |
|
|
|
ENCODED_DEFAULT_GRAPH, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -544,8 +541,8 @@ impl<S: EncodedQuadsStore> Graph for StoreDefaultGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(TriplesIterator { |
|
|
|
Ok(TriplesIterator { |
|
|
|
iter: self.store.quads_for_predicate_graph( |
|
|
|
iter: self.store.quads_for_predicate_graph( |
|
|
|
&encoder.encode_named_node(predicate)?, |
|
|
|
encoder.encode_named_node(predicate)?, |
|
|
|
&ENCODED_DEFAULT_GRAPH, |
|
|
|
ENCODED_DEFAULT_GRAPH, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -558,9 +555,9 @@ impl<S: EncodedQuadsStore> Graph for StoreDefaultGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(SubjectsIterator { |
|
|
|
Ok(SubjectsIterator { |
|
|
|
iter: self.store.quads_for_predicate_object_graph( |
|
|
|
iter: self.store.quads_for_predicate_object_graph( |
|
|
|
&encoder.encode_named_node(predicate)?, |
|
|
|
encoder.encode_named_node(predicate)?, |
|
|
|
&encoder.encode_term(object)?, |
|
|
|
encoder.encode_term(object)?, |
|
|
|
&ENCODED_DEFAULT_GRAPH, |
|
|
|
ENCODED_DEFAULT_GRAPH, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -573,7 +570,7 @@ impl<S: EncodedQuadsStore> Graph for StoreDefaultGraph<S> { |
|
|
|
Ok(TriplesIterator { |
|
|
|
Ok(TriplesIterator { |
|
|
|
iter: self |
|
|
|
iter: self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.quads_for_object_graph(&encoder.encode_term(object)?, &ENCODED_DEFAULT_GRAPH)?, |
|
|
|
.quads_for_object_graph(encoder.encode_term(object)?, ENCODED_DEFAULT_GRAPH)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -583,7 +580,7 @@ impl<S: EncodedQuadsStore> Graph for StoreDefaultGraph<S> { |
|
|
|
&self |
|
|
|
&self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.encoder() |
|
|
|
.encoder() |
|
|
|
.encode_triple_in_graph(triple, &ENCODED_DEFAULT_GRAPH)?, |
|
|
|
.encode_triple_in_graph(triple, ENCODED_DEFAULT_GRAPH)?, |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -592,7 +589,7 @@ impl<S: EncodedQuadsStore> Graph for StoreDefaultGraph<S> { |
|
|
|
&self |
|
|
|
&self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.encoder() |
|
|
|
.encoder() |
|
|
|
.encode_triple_in_graph(triple, &ENCODED_DEFAULT_GRAPH)?, |
|
|
|
.encode_triple_in_graph(triple, ENCODED_DEFAULT_GRAPH)?, |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -601,18 +598,18 @@ impl<S: EncodedQuadsStore> Graph for StoreDefaultGraph<S> { |
|
|
|
&self |
|
|
|
&self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.encoder() |
|
|
|
.encoder() |
|
|
|
.encode_triple_in_graph(triple, &ENCODED_DEFAULT_GRAPH)?, |
|
|
|
.encode_triple_in_graph(triple, ENCODED_DEFAULT_GRAPH)?, |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn len(&self) -> Result<usize> { |
|
|
|
fn len(&self) -> Result<usize> { |
|
|
|
Ok(self.store.quads_for_graph(&ENCODED_DEFAULT_GRAPH)?.count()) |
|
|
|
Ok(self.store.quads_for_graph(ENCODED_DEFAULT_GRAPH)?.count()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn is_empty(&self) -> Result<bool> { |
|
|
|
fn is_empty(&self) -> Result<bool> { |
|
|
|
Ok(self |
|
|
|
Ok(self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.quads_for_graph(&ENCODED_DEFAULT_GRAPH)? |
|
|
|
.quads_for_graph(ENCODED_DEFAULT_GRAPH)? |
|
|
|
.any(|_| true)) |
|
|
|
.any(|_| true)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -683,7 +680,7 @@ impl<S: EncodedQuadsStore> Graph for StoreUnionGraph<S> { |
|
|
|
Ok(TriplesIterator { |
|
|
|
Ok(TriplesIterator { |
|
|
|
iter: self |
|
|
|
iter: self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.quads_for_subject(&encoder.encode_named_or_blank_node(subject)?)?, |
|
|
|
.quads_for_subject(encoder.encode_named_or_blank_node(subject)?)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -695,8 +692,8 @@ impl<S: EncodedQuadsStore> Graph for StoreUnionGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(ObjectsIterator { |
|
|
|
Ok(ObjectsIterator { |
|
|
|
iter: self.store.quads_for_subject_predicate( |
|
|
|
iter: self.store.quads_for_subject_predicate( |
|
|
|
&encoder.encode_named_or_blank_node(subject)?, |
|
|
|
encoder.encode_named_or_blank_node(subject)?, |
|
|
|
&encoder.encode_named_node(predicate)?, |
|
|
|
encoder.encode_named_node(predicate)?, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -709,8 +706,8 @@ impl<S: EncodedQuadsStore> Graph for StoreUnionGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(PredicatesIterator { |
|
|
|
Ok(PredicatesIterator { |
|
|
|
iter: self.store.quads_for_subject_object( |
|
|
|
iter: self.store.quads_for_subject_object( |
|
|
|
&encoder.encode_named_or_blank_node(subject)?, |
|
|
|
encoder.encode_named_or_blank_node(subject)?, |
|
|
|
&encoder.encode_term(object)?, |
|
|
|
encoder.encode_term(object)?, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -723,7 +720,7 @@ impl<S: EncodedQuadsStore> Graph for StoreUnionGraph<S> { |
|
|
|
Ok(TriplesIterator { |
|
|
|
Ok(TriplesIterator { |
|
|
|
iter: self |
|
|
|
iter: self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.quads_for_predicate(&encoder.encode_named_node(predicate)?)?, |
|
|
|
.quads_for_predicate(encoder.encode_named_node(predicate)?)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -735,8 +732,8 @@ impl<S: EncodedQuadsStore> Graph for StoreUnionGraph<S> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(SubjectsIterator { |
|
|
|
Ok(SubjectsIterator { |
|
|
|
iter: self.store.quads_for_predicate_object( |
|
|
|
iter: self.store.quads_for_predicate_object( |
|
|
|
&encoder.encode_named_node(predicate)?, |
|
|
|
encoder.encode_named_node(predicate)?, |
|
|
|
&encoder.encode_term(object)?, |
|
|
|
encoder.encode_term(object)?, |
|
|
|
)?, |
|
|
|
)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -748,7 +745,7 @@ impl<S: EncodedQuadsStore> Graph for StoreUnionGraph<S> { |
|
|
|
) -> Result<TriplesIterator<S::QuadsForObjectIterator, S>> { |
|
|
|
) -> Result<TriplesIterator<S::QuadsForObjectIterator, S>> { |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
let encoder = self.store.encoder(); |
|
|
|
Ok(TriplesIterator { |
|
|
|
Ok(TriplesIterator { |
|
|
|
iter: self.store.quads_for_object(&encoder.encode_term(object)?)?, |
|
|
|
iter: self.store.quads_for_object(encoder.encode_term(object)?)?, |
|
|
|
store: self.store.clone(), |
|
|
|
store: self.store.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -758,9 +755,9 @@ impl<S: EncodedQuadsStore> Graph for StoreUnionGraph<S> { |
|
|
|
Ok(self |
|
|
|
Ok(self |
|
|
|
.store |
|
|
|
.store |
|
|
|
.quads_for_subject_predicate_object( |
|
|
|
.quads_for_subject_predicate_object( |
|
|
|
&encoder.encode_named_or_blank_node(triple.subject())?, |
|
|
|
encoder.encode_named_or_blank_node(triple.subject())?, |
|
|
|
&encoder.encode_named_node(triple.predicate())?, |
|
|
|
encoder.encode_named_node(triple.predicate())?, |
|
|
|
&encoder.encode_term(triple.object())?, |
|
|
|
encoder.encode_term(triple.object())?, |
|
|
|
)?.any(|_| true)) |
|
|
|
)?.any(|_| true)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -853,7 +850,7 @@ impl<I: Iterator<Item = Result<EncodedQuad>>, S: EncodedQuadsStore> Iterator |
|
|
|
k.and_then(|quad| { |
|
|
|
k.and_then(|quad| { |
|
|
|
self.store |
|
|
|
self.store |
|
|
|
.encoder() |
|
|
|
.encoder() |
|
|
|
.decode_named_or_blank_node(&quad.subject) |
|
|
|
.decode_named_or_blank_node(quad.subject) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -872,7 +869,7 @@ impl<I: Iterator<Item = Result<EncodedQuad>>, S: EncodedQuadsStore> Iterator |
|
|
|
fn next(&mut self) -> Option<Result<NamedNode>> { |
|
|
|
fn next(&mut self) -> Option<Result<NamedNode>> { |
|
|
|
self.iter |
|
|
|
self.iter |
|
|
|
.next() |
|
|
|
.next() |
|
|
|
.map(|k| k.and_then(|quad| self.store.encoder().decode_named_node(&quad.predicate))) |
|
|
|
.map(|k| k.and_then(|quad| self.store.encoder().decode_named_node(quad.predicate))) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -889,6 +886,6 @@ impl<I: Iterator<Item = Result<EncodedQuad>>, S: EncodedQuadsStore> Iterator |
|
|
|
fn next(&mut self) -> Option<Result<Term>> { |
|
|
|
fn next(&mut self) -> Option<Result<Term>> { |
|
|
|
self.iter |
|
|
|
self.iter |
|
|
|
.next() |
|
|
|
.next() |
|
|
|
.map(|k| k.and_then(|quad| self.store.encoder().decode_term(&quad.object))) |
|
|
|
.map(|k| k.and_then(|quad| self.store.encoder().decode_term(quad.object))) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|