Skip to content

Commit d2cd244

Browse files
committed
Store original ldContext as sourceLdContext
1 parent 7c94f0d commit d2cd244

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ogc/bblocks/postprocess.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ def do_postprocess(bblock: BuildingBlock, light: bool = False) -> bool:
118118
'application/yaml': schema_url_yaml,
119119
'application/json': schema_url_json,
120120
}
121+
if bblock.metadata.get('ldContext'):
122+
source_ldcontext = bblock.metadata['ldContext']
123+
if not is_url(source_ldcontext):
124+
if base_url:
125+
source_ldcontext = f"{base_url}{os.path.relpath(source_ldcontext, cwd)}"
126+
else:
127+
source_ldcontext = f"./{os.path.relpath(source_ldcontext, cwd)}"
128+
bblock.metadata['sourceLdContext'] = source_ldcontext
121129
if bblock.jsonld_context.is_file():
122130
if base_url:
123131
rel_context = os.path.relpath(bblock.jsonld_context, cwd)
@@ -231,6 +239,9 @@ def do_postprocess(bblock: BuildingBlock, light: bool = False) -> bool:
231239
if not default_jsonld_context.is_file():
232240
default_jsonld_context = None
233241

242+
if default_jsonld_context:
243+
building_block.metadata['ldContext'] = str(default_jsonld_context)
244+
234245
try:
235246
for annotated in annotate_schema(building_block,
236247
bblocks_register=bbr,

0 commit comments

Comments
 (0)