Skip to content

Commit

Permalink
converter example using prefixmaps (which uses curies package), remov…
Browse files Browse the repository at this point in the history
…es ontobio
  • Loading branch information
sierra-moxon committed May 21, 2024
1 parent 636ab22 commit 99c2974
Show file tree
Hide file tree
Showing 5 changed files with 1,109 additions and 1,153 deletions.
2 changes: 1 addition & 1 deletion python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ f-%: tests/data/f-%.ttl
python ./gocam_validator.py $< && exit -1 || echo FAILED AS EXPECTED

gen-python:
rm -f shex_json_linkml.py && gen-python schema/shex_term_metadata_json_linkml.yaml > shex_term_metadata_json_linkml.py
rm -f shex_json_linkml.py && gen-python schema/shex_terms_metadata_json_linkml.yaml > shex_terms_metadata_json_linkml.py

#gen-pydantic:
# rm -f shex_json_linkml.py && gen-pydantic schema/shex_json_linkml.yaml > shex_json_linkml.py
Expand Down
8 changes: 6 additions & 2 deletions python/json_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
from pathlib import Path
import os
from prefixmaps import load_converter
from ontobio.rdfgen.assoc_rdfgen import prefix_context
#from prefixcommons.curie_util import contract_uri

Expand All @@ -18,12 +19,15 @@


OUT_JSON = os.path.join('../shapes/json/shex_dump.json')
converter = Converter.from_prefix_map(prefix_context)

converter = load_converter("merged")
# if you need to add a prefix specific to this codebase, not in merged.csv above, then you
# can do things like this:
# converter.add_prefix("Orphanet", "https://www.orpha.net/en/disease/detail/", merge=True)


def get_suffix(uri):
suffix = converter.compress(uri)

return suffix if suffix else uri


Expand Down
Loading

0 comments on commit 99c2974

Please sign in to comment.