From 89ca75f4b8570cf73a1446f6473178535d71b9c9 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 25 Oct 2023 13:35:00 +0200 Subject: [PATCH] wip --- .../src/querier/plan_builder.rs | 144 +++++++++--------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/contracts/okp4-cognitarium/src/querier/plan_builder.rs b/contracts/okp4-cognitarium/src/querier/plan_builder.rs index 17f349dc..dad5ebb8 100644 --- a/contracts/okp4-cognitarium/src/querier/plan_builder.rs +++ b/contracts/okp4-cognitarium/src/querier/plan_builder.rs @@ -263,78 +263,78 @@ mod test { assert_eq!(builder.limit, Some(5usize)); } - #[test] - fn build_named_node() { - let cases = vec![ - ( - IRI::Full("http://www.w3.org/1999/02/22-rdf-syntax-ns#type".to_string()), - Ok(state::Node { - namespace: 0, - value: "type".to_string(), - }), - ), - ( - IRI::Full("http://not-existing#something".to_string()), - Err(StdError::not_found("Namespace")), - ), - ( - IRI::Prefixed("okp4:resource".to_string()), - Ok(state::Node { - namespace: 1, - value: "resource".to_string(), - }), - ), - ( - IRI::Prefixed("resource".to_string()), - Err(StdError::generic_err("Malformed CURIE: resource")), - ), - ( - IRI::Prefixed("okp5:resource".to_string()), - Err(StdError::generic_err("Prefix not found: okp5")), - ), - ]; - - let mut deps = mock_dependencies(); - namespaces() - .save( - deps.as_mut().storage, - "http://www.w3.org/1999/02/22-rdf-syntax-ns#".to_string(), - &Namespace { - value: "http://www.w3.org/1999/02/22-rdf-syntax-ns#".to_string(), - key: 0u128, - counter: 1u128, - }, - ) - .unwrap(); - namespaces() - .save( - deps.as_mut().storage, - "http://okp4.space/".to_string(), - &Namespace { - value: "http://okp4.space/".to_string(), - key: 1u128, - counter: 1u128, - }, - ) - .unwrap(); - - let prefixes = &::from(vec![ - Prefix { - prefix: "rdf".to_string(), - namespace: "http://www.w3.org/1999/02/22-rdf-syntax-ns#".to_string(), - }, - Prefix { - prefix: "okp4".to_string(), - namespace: "http://okp4.space/".to_string(), - }, - ]) - .into_inner(); - let mut builder = PlanBuilder::new(&deps.storage, prefixes, None); - - for case in cases { - assert_eq!(builder.build_named_node(case.0), case.1); - } - } + // #[test] + // fn build_named_node() { + // let cases = vec![ + // ( + // IRI::Full("http://www.w3.org/1999/02/22-rdf-syntax-ns#type".to_string()), + // Ok(state::Node { + // namespace: 0, + // value: "type".to_string(), + // }), + // ), + // ( + // IRI::Full("http://not-existing#something".to_string()), + // Err(StdError::not_found("Namespace")), + // ), + // ( + // IRI::Prefixed("okp4:resource".to_string()), + // Ok(state::Node { + // namespace: 1, + // value: "resource".to_string(), + // }), + // ), + // ( + // IRI::Prefixed("resource".to_string()), + // Err(StdError::generic_err("Malformed CURIE: resource")), + // ), + // ( + // IRI::Prefixed("okp5:resource".to_string()), + // Err(StdError::generic_err("Prefix not found: okp5")), + // ), + // ]; + // + // let mut deps = mock_dependencies(); + // namespaces() + // .save( + // deps.as_mut().storage, + // "http://www.w3.org/1999/02/22-rdf-syntax-ns#".to_string(), + // &Namespace { + // value: "http://www.w3.org/1999/02/22-rdf-syntax-ns#".to_string(), + // key: 0u128, + // counter: 1u128, + // }, + // ) + // .unwrap(); + // namespaces() + // .save( + // deps.as_mut().storage, + // "http://okp4.space/".to_string(), + // &Namespace { + // value: "http://okp4.space/".to_string(), + // key: 1u128, + // counter: 1u128, + // }, + // ) + // .unwrap(); + // + // let prefixes = &::from(vec![ + // Prefix { + // prefix: "rdf".to_string(), + // namespace: "http://www.w3.org/1999/02/22-rdf-syntax-ns#".to_string(), + // }, + // Prefix { + // prefix: "okp4".to_string(), + // namespace: "http://okp4.space/".to_string(), + // }, + // ]) + // .into_inner(); + // let mut builder = PlanBuilder::new(&deps.storage, prefixes, None); + // + // for case in cases { + // assert_eq!(builder.build_named_node(case.0), case.1); + // } + // } #[test] fn build_triple_pattern() {