@@ -33,9 +33,41 @@ def test_core_prefixes_bound():
3333 g = Graph ()
3434
3535 # prefixes in Graph
36- assert len (list (g .namespaces ())) == len (_NAMESPACE_PREFIXES_CORE )
36+ assert len (list (g .namespaces ())) == len (
37+ {** _NAMESPACE_PREFIXES_RDFLIB , ** _NAMESPACE_PREFIXES_CORE }
38+ )
3739 pre = sorted ([x [0 ] for x in list (g .namespaces ())])
38- assert pre == ["owl" , "rdf" , "rdfs" , "xml" , "xsd" ]
40+ assert pre == [
41+ "brick" ,
42+ "csvw" ,
43+ "dc" ,
44+ "dcam" ,
45+ "dcat" ,
46+ "dcmitype" ,
47+ "dcterms" ,
48+ "doap" ,
49+ "foaf" ,
50+ "geo" ,
51+ "odrl" ,
52+ "org" ,
53+ "owl" ,
54+ "prof" ,
55+ "prov" ,
56+ "qb" ,
57+ "rdf" ,
58+ "rdfs" ,
59+ "schema" ,
60+ "sh" ,
61+ "skos" ,
62+ "sosa" ,
63+ "ssn" ,
64+ "time" ,
65+ "vann" ,
66+ "void" ,
67+ "wgs" ,
68+ "xml" ,
69+ "xsd" ,
70+ ]
3971
4072
4173def test_rdflib_prefixes_bound ():
@@ -175,6 +207,40 @@ def test_nman_bind_namespaces(
175207@pytest .mark .parametrize (
176208 ["selector" , "expected_bindings" ],
177209 [
210+ (
211+ None ,
212+ {
213+ "brick" : "https://brickschema.org/schema/Brick#" ,
214+ "csvw" : "http://www.w3.org/ns/csvw#" ,
215+ "dc" : "http://purl.org/dc/elements/1.1/" ,
216+ "dcat" : "http://www.w3.org/ns/dcat#" ,
217+ "dcmitype" : "http://purl.org/dc/dcmitype/" ,
218+ "dcterms" : "http://purl.org/dc/terms/" ,
219+ "dcam" : "http://purl.org/dc/dcam/" ,
220+ "doap" : "http://usefulinc.com/ns/doap#" ,
221+ "foaf" : "http://xmlns.com/foaf/0.1/" ,
222+ "odrl" : "http://www.w3.org/ns/odrl/2/" ,
223+ "geo" : "http://www.opengis.net/ont/geosparql#" ,
224+ "org" : "http://www.w3.org/ns/org#" ,
225+ "owl" : "http://www.w3.org/2002/07/owl#" ,
226+ "prof" : "http://www.w3.org/ns/dx/prof/" ,
227+ "prov" : "http://www.w3.org/ns/prov#" ,
228+ "qb" : "http://purl.org/linked-data/cube#" ,
229+ "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ,
230+ "rdfs" : "http://www.w3.org/2000/01/rdf-schema#" ,
231+ "schema" : "https://schema.org/" ,
232+ "sh" : "http://www.w3.org/ns/shacl#" ,
233+ "skos" : "http://www.w3.org/2004/02/skos/core#" ,
234+ "sosa" : "http://www.w3.org/ns/sosa/" ,
235+ "ssn" : "http://www.w3.org/ns/ssn/" ,
236+ "time" : "http://www.w3.org/2006/time#" ,
237+ "vann" : "http://purl.org/vocab/vann/" ,
238+ "void" : "http://rdfs.org/ns/void#" ,
239+ "wgs" : "https://www.w3.org/2003/01/geo/wgs84_pos#" ,
240+ "xsd" : "http://www.w3.org/2001/XMLSchema#" ,
241+ "xml" : "http://www.w3.org/XML/1998/namespace" ,
242+ },
243+ ),
178244 (
179245 "rdflib" ,
180246 {
@@ -208,19 +274,39 @@ def test_nman_bind_namespaces(
208274 "xsd" : "http://www.w3.org/2001/XMLSchema#" ,
209275 "xml" : "http://www.w3.org/XML/1998/namespace" ,
210276 },
211- )
277+ ),
278+ (
279+ "core" ,
280+ {
281+ "owl" : "http://www.w3.org/2002/07/owl#" ,
282+ "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ,
283+ "rdfs" : "http://www.w3.org/2000/01/rdf-schema#" ,
284+ "xsd" : "http://www.w3.org/2001/XMLSchema#" ,
285+ "xml" : "http://www.w3.org/XML/1998/namespace" ,
286+ },
287+ ),
212288 ],
213289)
214290def test_bound_namespaces_subset (
215- selector : Any , expected_bindings : Dict [str , str ]
291+ selector : Optional [ Any ] , expected_bindings : Dict [str , str ]
216292) -> None :
217- graph = Graph (bind_namespaces = selector )
293+ if selector is not None :
294+ graph = Graph (bind_namespaces = selector )
295+ else :
296+ graph = Graph ()
218297 bound_namespaces = dict (
219298 (key , str (value )) for key , value in graph .namespace_manager .namespaces ()
220299 )
221300 assert (
222301 expected_bindings .items () <= bound_namespaces .items ()
223302 ), f"missing items { expected_bindings .items () - bound_namespaces .items ()} "
303+ empty_graph = Graph (bind_namespaces = "none" )
304+ if selector is not None :
305+ nman = NamespaceManager (empty_graph , bind_namespaces = selector )
306+ else :
307+ nman = NamespaceManager (empty_graph )
308+ nman_bound_namespaces = dict ((key , str (value )) for key , value in nman .namespaces ())
309+ assert bound_namespaces == nman_bound_namespaces
224310
225311
226312def test_compute_qname_no_generate () -> None :
0 commit comments