Skip to content

Commit

Permalink
fix(rdf): make quad pattern iter skip work
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart committed Feb 5, 2024
1 parent 4b1a058 commit c14bf42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
12 changes: 8 additions & 4 deletions contracts/okp4-dataverse/src/credential/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,15 @@ impl<'a> TryFrom<(&'a Dataset<'a>, GraphName<'a>)> for Ed25519Signature2020Proof
value: p_value,
options: Dataset::new(
dataset
.match_pattern(None, None, None, Some(Some(proof_graph)))
.skip_pattern(
None,
Some(PROOF_RDF_PROOF_VALUE),
None,
Some(Some(proof_graph)),
(
None,
Some(PROOF_RDF_PROOF_VALUE),
None,
Some(Some(proof_graph)),
)
.into(),
)
.map(|quad| *quad)
.collect(),
Expand Down
7 changes: 2 additions & 5 deletions packages/okp4-rdf/src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ impl QuadPattern<'_> {
.map(|o| o == quad.graph_name)
.unwrap_or_else(|| true)
}

pub fn skip_pattern<'a>(self, quad: &'a Quad<'a>) -> bool {
!self.match_pattern(quad)
}
}

pub trait QuadIterator<'a>: Iterator<Item = &'a Quad<'a>> {
Expand Down Expand Up @@ -214,7 +210,8 @@ where
QuadPatternFilterKind::Skip => self
.patterns
.iter()
.fold(true, |v, p| v || p.skip_pattern(quad)),
.find(|p| p.match_pattern(quad))
.is_none(),
})
}
}

0 comments on commit c14bf42

Please sign in to comment.