Skip to content

Commit be97010

Browse files
committed
Read local context.jsonld file
1 parent 563ba02 commit be97010

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

bin/validator.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@
2424
except exceptions.ValidationError as err:
2525
print(f"Validation failed: {err.message} - {err.json_path}")
2626

27+
with open('schemas/v1/context.jsonld', encoding='utf-8') as f:
28+
local_context = json.load(f)
29+
2730
print("\n--- JSON-LD validation ---")
31+
doc_json['@context'] = local_context['@context']
2832
try:
2933
# check if something was not mapped
3034
expanded = jsonld.expand(doc_json)
3135
print("JSON-LD expansion works")
3236

3337
nquads = jsonld.normalize(doc_json, {'algorithm': 'URDNA2015', 'format': 'application/n-quads'})
3438
print(f"RFD graph {len(nquads.splitlines())} triplas.")
35-
print(nquads)
3639

37-
except Exception as e:
38-
print(f"❌ Erro ao processar JSON-LD: {e}")
40+
except Exception as exception:
41+
print(f"❌ Erro ao processar JSON-LD: {exception}")

0 commit comments

Comments
 (0)