1- use crate :: { rdf_types :: * , uris:: * } ;
1+ use crate :: { index :: TypeIndex , model :: TripleMask , uris:: * } ;
22use :: std:: collections:: { HashMap , HashSet } ;
33use anyhow:: { Error , Result } ;
4+ use rio_api:: model:: * ;
45use serde:: { Deserialize , Serialize } ;
56
6- use crate :: { index:: TypeIndex , model:: TripleMask } ;
7-
87/// Rules for pseudonymizing nodes
98#[ derive( Serialize , Deserialize , Debug , Default ) ]
109pub struct NodeRules {
@@ -15,7 +14,7 @@ pub struct NodeRules {
1514
1615impl NodeRules {
1716 /// Validate each full URI specified in the rules for nodes
18- pub fn check_uris ( & self ) -> Result < ( ) , sophia_iri :: InvalidIri > {
17+ pub fn check_uris ( & self ) -> Result < ( ) , anyhow :: Error > {
1918 let node_uris = keep_full_uris ( & self . of_type ) ;
2019 check_uris ( & node_uris)
2120 }
@@ -56,7 +55,7 @@ pub struct ObjectRules {
5655
5756impl ObjectRules {
5857 /// Validate each full URI specified in the rules for objects
59- pub fn check_uris ( & self ) -> Result < ( ) , sophia_iri :: InvalidIri > {
58+ pub fn check_uris ( & self ) -> Result < ( ) , anyhow :: Error > {
6059 let on_predicate_uris = keep_full_uris ( & self . on_predicate ) ;
6160 check_uris ( & on_predicate_uris) ?;
6261 for ( k, v) in self . on_type_predicate . iter ( ) {
@@ -242,11 +241,13 @@ pub fn match_node_rules(triple: &Triple, rules: &Rules, type_map: &mut TypeIndex
242241 let pseudo_subject = match & triple. subject {
243242 Subject :: NamedNode ( n) => match_type ( & n. to_string ( ) , rules, type_map) ,
244243 Subject :: BlankNode ( _) => false ,
244+ Subject :: Triple ( _) => panic ! ( "RDF-star data not supported" ) ,
245245 } ;
246246 let pseudo_object = match & triple. object {
247247 Term :: NamedNode ( n) => match_type ( & n. to_string ( ) , rules, type_map) ,
248248 Term :: BlankNode ( _) => false ,
249249 Term :: Literal ( _) => false ,
250+ Term :: Triple ( _) => panic ! ( "RDF-star data not supported" ) ,
250251 } ;
251252
252253 let mut mask = TripleMask :: default ( ) ;
@@ -279,6 +280,7 @@ pub fn match_object_rules(triple: &Triple, rules: &Rules, type_map: &mut TypeInd
279280 type_map,
280281 rules,
281282 ) ,
283+ Subject :: Triple ( _) => panic ! ( "RDF-star data not supported" ) ,
282284 } ;
283285
284286 if pseudo_object {
@@ -532,7 +534,6 @@ mod tests {
532534 "
533535 ) ) ;
534536 let expanded = rules. expand_rules_curie ( ) ;
535- println ! ( "Expanded rules: {:?} " , expanded. as_ref( ) . unwrap( ) ) ;
536537 assert ! (
537538 expanded. unwrap( ) . objects. on_type_predicate[ expanded_rule_type]
538539 . contains( expanded_rule_predicate)
0 commit comments