Reference

This contains several SeMRA submodules with low-level functionality. You can use these to build your own mapping processing workflows and I/O.

semra.api Module

Semantic Mapping Reasoning Assembler.

Functions

apply_mutations(mappings, mutations, *[, ...])

Apply mutations.

assemble_evidences(mappings, *[, progress])

Assemble evidences.

assert_projection(mappings)

Raise an exception if any entities appear as the subject in multiple mappings.

count_component_sizes(mappings[, ...])

Get a counter where the keys are the set of all prefixes in a weakly connected component.

count_source_target(mappings)

Count pairs of source/target prefixes.

deduplicate_evidence(triple, evidence)

Deduplicate a list of evidences based on their "key" function.

filter_many_to_many(mappings, *[, progress])

Filter out many to many mappings.

filter_mappings(mappings, skip_mappings, *)

Filter out mappings in the second set from the first set.

filter_minimum_confidence(mappings[, cutoff])

Filter mappings below a given confidence.

filter_prefixes(mappings, prefixes, *[, ...])

Filter out mappings whose subject or object are in the given list of prefixes.

filter_self_matches(mappings, *[, progress])

Filter out mappings within the same resource.

filter_subsets(mappings, prefix_to_references)

Filter mappings that don't appear in the given subsets.

flip()

Flip a mapping, if the relation is configured with an inversion.

get_asymmetric_counter(index, priority, *, ...)

Create a symmetric mapping counts counter from a directed index.

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

Index which entities in each vocabulary have been mapped.

get_index(mappings, *[, progress, leave])

Aggregate and deduplicate evidences for each core triple.

get_many_to_many(mappings)

Get many-to-many mappings, disregarding predicate type.

get_observed_terms(mappings)

Get the set of terms appearing in each prefix.

get_priority_reference(component, priority)

Get the priority reference from a component.

get_symmetric_counter(index, priority, *, ...)

Create a symmetric mapping counts counter from a directed index.

get_terms(prefixes[, subset_configuration, ...])

Get the set of identifiers for each of the resources.

get_test_evidence([n])

Get test evidence.

get_test_reference([n, prefix])

Get test reference(s).

hydrate_subsets(subset_configuration, *[, ...])

Convert a subset configuration dictionary into a subset artifact.

keep_object_prefixes(mappings, prefixes, *)

Filter out mappings whose objects are not in the given list of prefixes.

keep_prefixes(mappings, prefixes, *[, progress])

Filter out mappings whose subject or object are not in the given list of prefixes.

keep_subject_prefixes(mappings, prefixes, *)

Filter out mappings whose subjects are not in the given list of prefixes.

print_source_target_counts(mappings[, minimum])

Print the counts of source/target prefixes.

prioritize(mappings, priority, *[, progress])

Get a priority star graph.

prioritize_df(mappings, df, *, column[, ...])

Remap a column of a dataframe based on priority mappings.

project()

Ensure that each identifier only appears as the subject of one mapping.

project_dict(mappings, source_prefix, ...)

Get a dictionary from source identifiers to target identifiers.

str_source_target_counts(mappings[, minimum])

Create a table of counts of source/target prefix via tabulate.

summarize_prefixes(mappings)

Get a dataframe summarizing the prefixes appearing in the mappings.

tabulate_index(index)

Create a table of all mappings contained in an index.

unindex(index, *[, progress])

Convert a mapping index into a list of mapping objects.

update_literal_mappings(literal_mappings, ...)

Use a priority mapping to re-write terms with priority groundings.

validate_mappings(mappings, *[, progress])

Validate mappings against the Bioregistry and raise an error on the first invalid.

Classes

Mutation(*, source[, target, confidence, ...])

Represents a mutation operation on a mapping set.

semra.inference Module

Inference functionality for SeMRA.

Functions

infer_chains(mappings, *[, backwards, ...])

Apply graph-based reasoning over mapping chains to infer new mappings.

infer_dbxref_mutations(mappings, pairs[, ...])

Upgrade database cross-references into exact matches for the given pairs.

infer_generalizations(mappings, *[, progress])

Apply generalization rules.

infer_mutations(mappings, pairs, ...[, progress])

Infer mappings with alternate predicates for the given prefix pairs.

infer_mutual_dbxref_mutations(mappings, prefixes)

Upgrade database cross-references into exact matches for the given pairs.

infer_reversible(mappings, *[, progress])

Extend the mapping list with flipped mappings.

semra.rules Module

Constants and rules for inference.

Variables

CURIE_TO_JUSTIFICATION

A mapping from CURIEs to mapping justifications

CURIE_TO_RELATION

A mapping from CURIEs to reference objects for mapping predicates

DIRECTIONLESS

Which predicates are directionless

FLIP

A mapping of inverse relationships that can be applied when inversting mappings

GENERALIZATIONS

Rules for relaxing a more strict predicate to a more loose one, see https://mapping-commons.github.io/sssom/chaining-rules/#generalisation-rules

IMPRECISE

A set of mappings that are not considered as precise

JUSTIFICATIONS

A list of references that can be used as mapping justifications in SSSOM

RELATIONS

A list of mapping predicates suggested by SSSOM.

TRANSITIVE

Which predicates are transitive? This excludes the imprecise onces

TWO_STEP

Two step chain inference rules

semra.vocabulary Module

Vocabulary used in SeMRA.

Variables

BEN_REFERENCE

Extends curies.NamableReference to normalize the prefix against the Bioregistry.

BROAD_MATCH

A reference to skos:broadMatch

CHAIN_MAPPING

A reference to semapv:MappingChaining that can be used as a mapping justification, see also semra.rules.JUSTIFICATIONS.

CHARLIE

A reference to Charles Tapley Hoyt, the author of SeMRA

CLOSE_MATCH

A reference to skos:closeMatch

DB_XREF

A reference to oboInOwl:hasDbXref

EQUIVALENT_TO

A reference to owl:equivalentTo

EXACT_MATCH

A reference to skos:exactMatch

INVERSION_MAPPING

A reference to semapv:MappingInversion that can be used as a mapping justification, see also semra.rules.JUSTIFICATIONS.

KNOWLEDGE_MAPPING

A reference to semapv:BackgroundKnowledgeBasedMatching that can be used as a mapping justification, see also semra.rules.JUSTIFICATIONS.

LEXICAL_MAPPING

A reference to semapv:LexicalMatchingProcess that can be used as a mapping justification, see also semra.rules.JUSTIFICATIONS.

MANUAL_MAPPING

A reference to semapv:ManualMappingCuration that can be used as a mapping justification, see also semra.rules.JUSTIFICATIONS.

NARROW_MATCH

A reference to skos:narrowMatch

REPLACED_BY

A reference to IAO:0100001 (term replaced by)

SUBCLASS

A reference to rdfs:subClassOf

UNSPECIFIED_MAPPING

A reference to semapv:UnspecifiedMatchingProcess that can be used as a mapping justification, see also semra.rules.JUSTIFICATIONS.

semra.constants Module

Constants for SeMRA.

Variables

SEMRA_EVIDENCE_PREFIX

The prefix used in CURIEs representing evidences

SEMRA_MAPPING_PREFIX

The prefix used in CURIEs representing mappings

SEMRA_MAPPING_SET_PREFIX

The prefix used in CURIEs representing mappings sets

SEMRA_NEO4J_CONCEPT_LABEL

The label used for nodes representing concepts (i.e., entities) in SeMRA's Neo4j export

SEMRA_NEO4J_EVIDENCE_LABEL

The label used for nodes representing evidences in SeMRA's Neo4j export

SEMRA_NEO4J_MAPPING_LABEL

The label used for nodes representing mappings in SeMRA's Neo4j export

SEMRA_NEO4J_MAPPING_SET_LABEL

The label used for nodes representing mapping sets in SeMRA's Neo4j export