@@ -53,6 +53,30 @@ OBO Foundry's PURL rules
5353 >> > converter.parse_curie(" APOLLO:SV_1234567" )
5454 ReferenceTuple(' APOLLO_SV' , ' 1234567' )
5555
56+ The CURIE and URI rewrites are unified. Therefore, you can also use a URI as a rewrite,
57+ such as handling Creative Commons license URLs, which unfortunately aren't themselves
58+ part of a semantic space for licenses. Luckily, SPDX is, and we can remap to that.
59+
60+ .. code-block :: python
61+
62+ import curies
63+ from curies import PreprocessingRules, PreprocessingConverter, PreprocessingRewrites
64+
65+ rules = PreprocessingRules(
66+ rewrites = PreprocessingRewrites(
67+ full = {" http://creativecommons.org/licenses/by/3.0/" : " spdx:CC-BY-3.0" ,},
68+ )
69+ )
70+
71+ converter = curies.get_obo_converter()
72+ converter.add_prefix(" spdx" , " https://spdx.org/licenses/" )
73+ converter = PreprocessingConverter.from_converter(
74+ converter, rules = rules,
75+ )
76+
77+ >> > converter.parse_uri(" http://creativecommons.org/licenses/by/3.0/" )
78+ ReferenceTuple(' spdx' , ' CC-BY-3.0' )
79+
5680 Some rewrite rules only apply to a specific resource, because of its own quirks in
5781curation or encoding. For example, CHMO encodes OrangeBook entries with ``orange `` as a
5882prefix, which is not typically specific enough to warrant curating ``orange `` as a
0 commit comments