Recipe 9
Map ODRL and capture VC/DID evidence without importing authority
from pathlib import Path
import importlib.util
ROOT=Path.cwd()
def load_source(path,name):
spec=importlib.util.spec_from_file_location(name,ROOT/path)
mod=importlib.util.module_from_spec(spec); spec.loader.exec_module(mod); return mod
m=load_source("src/36_Adoption_Layer/standards_adapters.py","entity_standards")
odrl={
"permission":[{
"target":"dataset-123",
"action":["read","derive"],
"duty":[{"action":"attribute"}]
}],
"prohibition":[{"target":"dataset-123","action":"redistribute"}]
}
mapping=m.StandardsAdapters.import_odrl(odrl)
assert mapping["silent_semantic_equivalence"] is False
assert mapping["external_standard_is_not_entity_authority"] is True
print(mapping["mapped_rights"])
vc={
"issuer":"did:example:issuer",
"credentialSubject":{"id":"did:example:subject"},
"proof":{"type":"ExampleProof"}
}
vc_evidence=m.StandardsAdapters.credential_evidence(vc)
assert vc_evidence["credential_is_evidence_not_entity_authority"] is True
did_doc={"id":"did:example:subject","verificationMethod":[]}
did_evidence=m.StandardsAdapters.did_evidence(did_doc)
assert did_evidence["external_identifier_is_not_entity_authority"] is True
roundtrip=m.StandardsAdapters.export_odrl(mapping["mapped_rights"],"dataset-123")
print(roundtrip)Data-space crosswalk
crosswalk=m.StandardsAdapters.dataspace_mapping(
"GAIA_X", gaia_x_document,
policy_refs=["policy:example"],
semantic_crosswalk_refs=["crosswalk:v1"],
)
assert crosswalk["silent_semantic_equivalence"] is FalseSupported adapters currently include ODRL, W3C VC, DID, GAIA-X and IDS. Translation/crosswalk evidence never grants ENTITY authority by itself.