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 mmif/serialize/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ def _fix_old_short_ids(self):
propv = self.metadata.contains[annotation.at_type][propk]
if isinstance(propv, list):
for i, item in enumerate(propv):
if propv not in mmif_docs and self.id_delimiter not in item:
if item not in mmif_docs and self.id_delimiter not in item:
propv[i] = f"{self.id}{self.id_delimiter}{item}"
if propk in annotation.properties:
propv = annotation.properties[propk]
if isinstance(propv, list):
for i, item in enumerate(propv):
if propv not in mmif_docs and self.id_delimiter not in item:
if item not in mmif_docs and self.id_delimiter not in item:
propv[i] = f"{self.id}{self.id_delimiter}{item}"
self.annotations.append(annotation)

Expand Down
4 changes: 3 additions & 1 deletion tests/mmif_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
old_mmif_w_short_id = f"https://raw.githubusercontent.com/clamsproject/mmif/1.0.5/specifications/samples/everything/raw.json"
EVERYTHING_JSON = request.urlopen(everything_file_url).read().decode('utf-8')
OLD_SHORTID_JSON = request.urlopen(old_mmif_w_short_id).read().decode('utf-8')
SWT_1_0_JSON = open('tests/samples/1.0/swt.mmif').read()

# for keys and values in chain all typevers in mmif.vocabulary.*_types modules
# merge into a single dict
Expand All @@ -24,7 +25,8 @@

MMIF_EXAMPLES = {
'everything': Template(EVERYTHING_JSON),
'old_shortid': Template(OLD_SHORTID_JSON),
'mmif_old_shortid': Template(OLD_SHORTID_JSON),
'mmif_swt_1_0': Template(SWT_1_0_JSON),
}
FRACTIONAL_EXAMPLES = {
'doc_only': Template("""{
Expand Down
Loading
Loading