Skip to content

πŸ—ΊοΈ Architecture details

This page presents the project architecture and some technical details.

πŸ—ƒοΈ Folder structure

curies.rs/
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   └── πŸ¦€ Source code for the core Rust crate
β”‚   β”œβ”€β”€ tests/
β”‚   β”‚   └── πŸ§ͺ Tests for the core Rust crate
β”‚   └── docs/
β”‚       └── πŸ“– Markdown and HTML files for the documentation website
β”œβ”€β”€ python/
β”‚   └── 🐍 Python bindings
β”œβ”€β”€ js/
β”‚   └── 🟨 JavaScript bindings
β”œβ”€β”€ r/
β”‚   └── πŸ“ˆ R bindings
β”œβ”€β”€ scripts/
β”‚   └── πŸ› οΈ Development scripts (build, test, gen docs)
└── .github/
    └── workflows/
        └── βš™οΈ Automated CI/CD workflows for testing and building releases

✨ Features

List of features available per language binding, based on features defined in curies.readthedocs.io

Feature Rust (core) Python JS R
compress βœ… βœ… βœ… βœ…
expand βœ… βœ… βœ… βœ…
compress_list βœ… βœ… βœ…
expand_list βœ… βœ… βœ…
standardize (prefix, curie, uri) βœ… βœ… βœ…
is_uri() and is_curie() βœ… βœ… βœ…
expand_or_standardize() and compress_or_standardize() βœ… βœ… βœ…
chain converters βœ… βœ… βœ…
Record object and converter.add_record() βœ… βœ… βœ…
converter.add_prefix(prefix, ns) βœ… βœ… βœ…
converter.get_prefixes() and .get_uri_prefixes() βœ… βœ… βœ…
Load from prefix map βœ… βœ… βœ…
Load from extended prefix map βœ… βœ… βœ…
Load from JSON-LD context βœ… βœ… βœ…
Load from SHACL prefix definition βœ… βœ… βœ…
Load OBO converter βœ… βœ… βœ…
Load GO converter βœ… βœ… βœ…
Load Bioregistry converter βœ… βœ… βœ… βœ…
Load Monarch converter βœ… βœ… βœ…
Write converter to prefix map βœ… βœ… βœ…
Write converter to extended prefix map βœ… βœ… βœ…
Write converter to JSON-LD βœ… βœ… βœ…
Write converter to SHACL βœ… βœ… βœ…
.get_subconverter()
Prefixes discovery

βš οΈβ€‹ Differences between Rust core and language bindings

  1. The functions to Load prefix map, extended prefix map and JSON-LD can take HashMap as input in rust. But for JS and python, we currently need to pass it as String (we need to figure out how to pass arbitrary objects). You can pass either a URL or a JSON object as string, the lib will automatically retrieve the content of the URL if it is one. The original python lib was taking directly JSON objects for all loaders, apart from SHACL which takes a URL (which was not convenient when wanting to provide a local SHACL file)
  2. In rust chain() is a static function taking a list of converters, chained = Converter::chain([conv1, conv2]). In JS and python we cannot easily pass a list of complex objects like converters, so chain is a normal function that takes 1 converter to chain: chained = conv1.chain(conv2)
  3. In the rust lib, currently the functions to write prefix map returns a HashMap, write extended map returns a JSON as string, and write JSON-LD returns serde::json type. The JS and python equivalent directly return a string. In the original python lib it was writing to a file.