@@ -21,9 +21,11 @@ use shacl_validation::validation_report::report::ValidationReport;
2121use shacl_validation:: validation_report:: validation_report_error:: ReportError ;
2222use sparql_service:: RdfData ;
2323use sparql_service:: RdfDataError ;
24+ use srdf:: matcher:: Any ;
2425use srdf:: Query ;
2526use srdf:: RDFFormat ;
2627use srdf:: Rdf ;
28+ use srdf:: Triple ;
2729use thiserror:: Error ;
2830
2931mod core;
@@ -83,37 +85,32 @@ impl Manifest {
8385 ) -> Result < HashSet < OxTerm > , TestSuiteError > {
8486 let mut entry_terms = HashSet :: new ( ) ;
8587
88+ let mf_entries: NamedNode = shacl_validation_vocab:: MF_ENTRIES . clone ( ) . into ( ) ;
8689 let entry_subject = store
87- . objects_for_subject_predicate (
88- & subject,
89- & shacl_validation_vocab:: MF_ENTRIES . clone ( ) . into ( ) ,
90- ) ?
91- . into_iter ( )
90+ . triples_matching ( subject, mf_entries, Any ) ?
91+ . map ( Triple :: into_object)
9292 . next ( ) ;
9393
9494 if let Some ( mut subject) = entry_subject {
9595 loop {
96+ let inner_subject: OxSubject = subject. clone ( ) . try_into ( ) . unwrap ( ) ;
97+ let rdf_first: NamedNode = srdf:: RDF_FIRST . clone ( ) . into ( ) ;
9698 match store
97- . objects_for_subject_predicate (
98- & subject. clone ( ) . try_into ( ) . unwrap ( ) ,
99- & srdf:: RDF_FIRST . clone ( ) . into ( ) ,
100- ) ?
101- . into_iter ( )
99+ . triples_matching ( inner_subject. clone ( ) , rdf_first, Any ) ?
100+ . map ( Triple :: into_object)
102101 . next ( )
103102 {
104103 Some ( terms) => entry_terms. insert ( terms) ,
105104 None => break ,
106105 } ;
107106
107+ let rdf_rest: NamedNode = srdf:: RDF_REST . clone ( ) . into ( ) ;
108108 subject = match store
109- . objects_for_subject_predicate (
110- & subject. clone ( ) . try_into ( ) . unwrap ( ) ,
111- & srdf:: RDF_REST . clone ( ) . into ( ) ,
112- ) ?
113- . into_iter ( )
109+ . triples_matching ( inner_subject, rdf_rest, Any ) ?
110+ . map ( Triple :: into_object)
114111 . next ( )
115112 {
116- Some ( subject ) => subject ,
113+ Some ( term ) => term ,
117114 None => break ,
118115 } ;
119116 }
@@ -125,48 +122,41 @@ impl Manifest {
125122 fn collect_tests ( & self ) -> Result < Vec < ShaclTest < RdfData > > , TestSuiteError > {
126123 let mut entries = Vec :: new ( ) ;
127124 for entry in & self . entries {
128- let entry = entry. clone ( ) . try_into ( ) ?;
125+ let entry: OxSubject = entry. clone ( ) . try_into ( ) ?;
129126
130- let action = self
127+ let mf_action: NamedNode = shacl_validation_vocab:: MF_ACTION . clone ( ) . into ( ) ;
128+ let action: OxSubject = self
131129 . store
132- . objects_for_subject_predicate (
133- & entry,
134- & shacl_validation_vocab:: MF_ACTION . clone ( ) . into ( ) ,
135- ) ?
136- . into_iter ( )
130+ . triples_matching ( entry. clone ( ) , mf_action, Any ) ?
131+ . map ( Triple :: into_object)
137132 . next ( )
138- . unwrap ( ) ;
139- let action = action . try_into ( ) ?;
133+ . unwrap ( )
134+ . try_into ( ) ?;
140135
136+ let mf_result: NamedNode = shacl_validation_vocab:: MF_RESULT . clone ( ) . into ( ) ;
141137 let results = self
142138 . store
143- . objects_for_subject_predicate (
144- & entry,
145- & shacl_validation_vocab:: MF_RESULT . clone ( ) . into ( ) ,
146- ) ?
147- . into_iter ( )
139+ . triples_matching ( entry, mf_result, Any ) ?
140+ . map ( Triple :: into_object)
148141 . next ( )
149142 . unwrap ( ) ;
150143
151144 let report = ValidationReport :: parse ( & self . store , results) ?;
152145
146+ let sht_data_graph: NamedNode = shacl_validation_vocab:: SHT_DATA_GRAPH . clone ( ) . into ( ) ;
153147 let data_graph_iri = self
154148 . store
155- . objects_for_subject_predicate (
156- & action,
157- & shacl_validation_vocab:: SHT_DATA_GRAPH . clone ( ) . into ( ) ,
158- ) ?
159- . into_iter ( )
149+ . triples_matching ( action. clone ( ) , sht_data_graph, Any ) ?
150+ . map ( Triple :: into_object)
160151 . next ( )
161152 . unwrap ( ) ;
162153
154+ let sht_shapes_graph: NamedNode =
155+ shacl_validation_vocab:: SHT_SHAPES_GRAPH . clone ( ) . into ( ) ;
163156 let shapes_graph_iri = self
164157 . store
165- . objects_for_subject_predicate (
166- & action,
167- & shacl_validation_vocab:: SHT_SHAPES_GRAPH . clone ( ) . into ( ) ,
168- ) ?
169- . into_iter ( )
158+ . triples_matching ( action, sht_shapes_graph, Any ) ?
159+ . map ( Triple :: into_object)
170160 . next ( )
171161 . unwrap ( ) ;
172162
0 commit comments