Skip to content

Commit 80a2152

Browse files
committed
fix: change the https://schema.org/ prefix back to schema and add the wgs` binding back
<RDFLib#1686> inadvertently changed the prefix for `https://schema.org/` from `schema` to `sdo` and removed the `wgs` prefix. This PR changes the `https://schema.org/` binding back to `schema` and adds the `wgs` binding back. - Closes <RDFLib#2196>.
1 parent 7a05c15 commit 80a2152

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

rdflib/namespace/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,12 +906,13 @@ def get_longest_namespace(trie: Dict[str, Any], value: str) -> Optional[str]:
906906
"prof": PROF,
907907
"prov": PROV,
908908
"qb": QB,
909-
"sdo": SDO,
909+
"schema": SDO,
910910
"sh": SH,
911911
"skos": SKOS,
912912
"sosa": SOSA,
913913
"ssn": SSN,
914914
"time": TIME,
915915
"vann": VANN,
916916
"void": VOID,
917+
"wgs": WGS,
917918
}

test/test_namespacemanager.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
"schema": "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: str, 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+
175226
def test_compute_qname_no_generate() -> None:
176227
g = Graph() # 'core' bind_namespaces (default)
177228
with pytest.raises(KeyError):

0 commit comments

Comments
 (0)