@@ -172,6 +172,57 @@ def test_nman_bind_namespaces(
172172 check_graph_ns (graph , expected_result )
173173
174174
175+ @pytest .mark .parametrize (
176+ ["selector" , "expected_bindings" ],
177+ [
178+ (
179+ "rdflib" ,
180+ {
181+ "brick" : "https://brickschema.org/schema/Brick#" ,
182+ "csvw" : "http://www.w3.org/ns/csvw#" ,
183+ "dc" : "http://purl.org/dc/elements/1.1/" ,
184+ "dcat" : "http://www.w3.org/ns/dcat#" ,
185+ "dcmitype" : "http://purl.org/dc/dcmitype/" ,
186+ "dcterms" : "http://purl.org/dc/terms/" ,
187+ "dcam" : "http://purl.org/dc/dcam/" ,
188+ "doap" : "http://usefulinc.com/ns/doap#" ,
189+ "foaf" : "http://xmlns.com/foaf/0.1/" ,
190+ "odrl" : "http://www.w3.org/ns/odrl/2/" ,
191+ "geo" : "http://www.opengis.net/ont/geosparql#" ,
192+ "org" : "http://www.w3.org/ns/org#" ,
193+ "owl" : "http://www.w3.org/2002/07/owl#" ,
194+ "prof" : "http://www.w3.org/ns/dx/prof/" ,
195+ "prov" : "http://www.w3.org/ns/prov#" ,
196+ "qb" : "http://purl.org/linked-data/cube#" ,
197+ "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ,
198+ "rdfs" : "http://www.w3.org/2000/01/rdf-schema#" ,
199+ "sdo" : "https://schema.org/" ,
200+ "sh" : "http://www.w3.org/ns/shacl#" ,
201+ "skos" : "http://www.w3.org/2004/02/skos/core#" ,
202+ "sosa" : "http://www.w3.org/ns/sosa/" ,
203+ "ssn" : "http://www.w3.org/ns/ssn/" ,
204+ "time" : "http://www.w3.org/2006/time#" ,
205+ "vann" : "http://purl.org/vocab/vann/" ,
206+ "void" : "http://rdfs.org/ns/void#" ,
207+ "wgs" : "https://www.w3.org/2003/01/geo/wgs84_pos#" ,
208+ "xsd" : "http://www.w3.org/2001/XMLSchema#" ,
209+ "xml" : "http://www.w3.org/XML/1998/namespace" ,
210+ },
211+ )
212+ ],
213+ )
214+ def test_bound_namespaces_subset (
215+ selector : Any , expected_bindings : Dict [str , str ]
216+ ) -> None :
217+ graph = Graph (bind_namespaces = selector )
218+ bound_namespaces = dict (
219+ (key , str (value )) for key , value in graph .namespace_manager .namespaces ()
220+ )
221+ assert (
222+ expected_bindings .items () <= bound_namespaces .items ()
223+ ), f"missing items { expected_bindings .items () - bound_namespaces .items ()} "
224+
225+
175226def test_compute_qname_no_generate () -> None :
176227 g = Graph () # 'core' bind_namespaces (default)
177228 with pytest .raises (KeyError ):
0 commit comments