Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/hermes/model/types/ld_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def ld_value(self):

def _to_python(self, full_iri, ld_value):
if full_iri == "@id":
value = ld_value
value = self.ld_proc.compact_iri(self.active_ctx, ld_value, vocab=False)
elif full_iri == "@type":
value = [
self.ld_proc.compact_iri(self.active_ctx, ld_type)
Expand All @@ -100,7 +100,7 @@ def _to_python(self, full_iri, ld_value):

def _to_expanded_json(self, key, value):
if key == "@id":
ld_value = self.ld_proc.expand_iri(self.active_ctx, value)
ld_value = self.ld_proc.expand_iri(self.active_ctx, value, vocab=False)
elif key == "@type":
if not isinstance(value, list):
value = [value]
Expand Down
8 changes: 4 additions & 4 deletions src/hermes/model/types/pyld_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ class JsonLdProcessor(jsonld.JsonLdProcessor):
'mappings': {}
})

def expand_iri(self, active_ctx: t.Any, short_iri: str) -> str:
return self._expand_iri(active_ctx, short_iri, vocab=True)
def expand_iri(self, active_ctx: t.Any, short_iri: str, vocab: bool = True) -> str:
return self._expand_iri(active_ctx, short_iri, vocab=vocab)

def compact_iri(self, active_ctx: t.Any, long_iri: str) -> str:
return self._compact_iri(active_ctx, long_iri, vocab=True)
def compact_iri(self, active_ctx: t.Any, long_iri: str, vocab: bool = True) -> str:
return self._compact_iri(active_ctx, long_iri, vocab=vocab)

def inital_ctx(self, local_ctx, options=None):
return self.process_context(self._INITIAL_CONTEXT, local_ctx, options or {})
Expand Down
Loading