Contrib

sssom_pydantic.contrib.ontoportal Module

Get mappings from an OntoPortal instance.

import bioregistry
from sssom_pydantic.contrib.ontoportal import from_bioportal

converter = bioregistry.get_converter()
mappings = from_bioportal("SNOMEDCT", "AERO", converter=converter)

Functions

from_bioportal(ontology_1, ontology_2, *, ...)

Get mappings from BioPortal.

from_ontoportal(ontology_1, ontology_2, *, ...)

Get mappings from an OntoPortal instance.

iter_ontoportal(ontology_1, ontology_2, *, ...)

Iterate over mappings from OntoPortal.

sssom_pydantic.contrib.wikidata Module

Implements between semantic mappings in SSSOM and Wikidata.

Wikidata encodes semantic mappings in two ways:

  1. Using the exact match (P2888) property with a URI as the object. For example, cell wall (Q128700) maps to the Gene Ontology (GO) term for cell wall by its URI http://purl.obolibrary.org/obo/GO_0005618.

  2. Using semantic space-specific properties (e.g. P683 for ChEBI) with local unique identifiers as the object. For example, acetic acid (Q47512) maps to the ChEBI term for acetic acid using the P683 property for ChEBI and local unique identifier for acetic acid (within ChEBI) 15366.

Wikidata has a data structure that enables annotating qualifiers onto triples. Therefore, other parts of semantic mappings modeled in SSSOM can be ported:

  1. Authors and reviewers can be mapped from ORCiD identifiers to Wikidata identifiers, then encoded using the S50 and S4032 properties, respectively

  2. A SKOS-flavored mapping predicate (i.e., exact, narrow, broad, close, related) can be encoded using the S4390 property

  3. The publication date can be encoded using the S577 property

  4. The license can be mapped from text to a Wikidata identifier, then encoded using the S275 property

Note that properties that normally start with a P when used in triples are changed to start with an S when used as qualifiers. Other fields in SSSOM could potentially be mapped to Wikidata later.

This module implements the following interactive workflows:

  1. Read an SSSOM file, convert mappings to Wikidata schema, then open a QuickStatements tab in the web browser using read_and_open_quickstatements()

  2. Convert in-memory semantic mappings to the Wikidata schema, then open a QuickStatements tab in the web browser using open_quickstatements()

It also implements the following non-interactive workflows, which should be used with caution since they write directly to Wikidata:

  1. Read an SSSOM file, convert mappings to Wikidata schema, then post non-interactively to Wikidata via QuickStatements using read_and_post()

  2. Convert in-memory semantic mappings to the Wikidata schema, then post non-interactively to Wikidata via QuickStatements using post()

Functions

get_quickstatements_lines(mappings, *[, ...])

Get lines for QuickStatements that can be used to upload SSSOM to Wikidata.

open_quickstatements(mappings, *[, ...])

Create a QuickStatements tab from mappings.

post(mappings, *[, converter, metadata, ...])

Post QuickStatements non-interactively, use with caution.

read_and_open_quickstatements(path_or_url, *)

Read an SSSOM file and open the Quickstatements v2 uploader with the web browser.

read_and_post(path_or_url, *[, read_kwargs, ...])

read_to_quickstatements_lines(path_or_url, *)

Read an SSSOM file and get QuickStatements v2 lines.