Parsers¶
Generic Ontology Alignment Track¶
The generic OA aims to provide a manual parsing of desired ontologies as a source and target to do the alignment.
- class ontoaligner.ontology.generic.GenericOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class for working with the Source-Target ontology.
- ontology_name: str = 'Source-Target'
- source_ontology: Any = <ontoaligner.ontology.generic.GenericOntology object>
- target_ontology: Any = <ontoaligner.ontology.generic.GenericOntology object>
- track: str = 'Generic'
- class ontoaligner.ontology.generic.GenericOntology(language: str = 'en')[source]
Bases:
BaseOntologyParserAn abstract base class for parsing OWL ontologies. This class defines methods to extract data such as names, labels, IRIs, children, parents, synonyms, and comments for ontology classes.
- extract_data(graph: Any) List[Dict[str, Any]]
Extracts and processes data from all classes in the ontology.
- get_childrens(owl_class: URIRef) List[Dict[str, str]]
Retrieves child classes for the given ontology class.
- get_class_info(owl_class: URIRef) Any
Collects all relevant information for a given ontology class.
- get_comments(owl_class: URIRef) List[str]
Retrieves comments for the given class.
- get_iri(owl_class: URIRef) str
Returns the IRI of the class.
- get_label(owl_class: str) Any
Extracts the label for a given URI in the specified language from the RDF graph. If no valid label is found, returns None.
- Parameters:
uri – URI of the entity to retrieve the label for.
- Returns:
The label in the specified language, or None if no label found.
- get_name(owl_class: URIRef) str
Retrieves the name (IRI) of the class.
- get_parents(owl_class: URIRef) List[Dict[str, str]]
Retrieves parent classes for the given ontology class.
- get_synonyms(owl_class: URIRef) List[Dict[str, str]]
Retrieves synonyms for the given ontology class.
Tries different properties (like rdfs:label, skos:altLabel).
- is_class(owl_class: URIRef) bool
Checks if the given entity is an actual class (not a Restriction or property).
- is_valid_label(label: str) Any
- load_ontology(input_file_path: str) Any
Loads an ontology from the specified file path using rdflib.
- class ontoaligner.ontology.generic.OLaLaOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class for OLaLa-enriched source-target ontologies.
- ontology_name: str = 'OLaLa-Source-Target'
- source_ontology: Any = <ontoaligner.ontology.generic.OLaLaOntology object>
- target_ontology: Any = <ontoaligner.ontology.generic.OLaLaOntology object>
- track: str = 'Generic'
- class ontoaligner.ontology.generic.OLaLaOntology(language: str = 'en')[source]
Bases:
GenericOntologyA parser for preserving OLaLa TextExtractorSet fields.
- contains_mostly_numbers(term: str) bool
Checks whether a term contains more than 50 percent numbers.
- Parameters:
term (str) – The term to check.
- Returns:
True if the term contains mostly numbers.
- Return type:
bool
- extract_annotation_property_texts(resource: URIRef) List[str]
Extracts texts from annotation properties.
- Parameters:
resource (URIRef) – The resource.
- Returns:
The extracted annotation texts.
- Return type:
List[str]
- extract_only_label(owl: Dict) str
Extracts one label following MELT TextExtractorOnlyLabel.
- Parameters:
owl (Dict) – A parsed ontology item.
- Returns:
The selected normalized label.
- Return type:
str
- extract_text_extractor_set(resource: URIRef) Dict[str, Any]
Extracts texts following MELT TextExtractorSet.
- Parameters:
resource (URIRef) – The resource.
- Returns:
The extracted text fields.
- Return type:
Dict[str, Any]
- get_annotation_properties() Set[URIRef]
Retrieves ontology annotation properties.
- Returns:
The declared annotation properties.
- Return type:
Set[URIRef]
- get_annotation_properties_recursion_deadlock_safe(resource: URIRef, annotation_properties: Set[URIRef], recursion_depth: int) List[str]
Recursively extracts annotation property literals.
- Parameters:
resource (URIRef) – The resource to process.
annotation_properties (Set[URIRef]) – The annotation properties.
recursion_depth (int) – The current recursion depth.
- Returns:
The extracted literal lexical forms.
- Return type:
List[str]
- get_class_info(owl_class: URIRef) Any
Collects generic and OLaLa-specific information for a class.
- Parameters:
owl_class (URIRef) – The ontology class.
- Returns:
The collected class information.
- Return type:
Any
- get_host_of_uri(uri: str) str
Extracts the host of a URI.
- get_label_or_fragment_without_language_annotation(resource: URIRef) str | None
Returns the first rdfs:label or the URI fragment.
- Parameters:
resource (URIRef) – The resource.
- Returns:
The label or URI fragment.
- Return type:
Optional[str]
- get_literal_lexical_form(literal: Literal) str
Returns the lexical form of a literal.
- Parameters:
literal (Literal) – The RDF literal.
- Returns:
The lexical form.
- Return type:
str
- get_uri_fragment(uri: str) str
Returns the fragment after the last hashtag or slash.
- Parameters:
uri (str) – The URI.
- Returns:
The URI fragment.
- Return type:
str
- is_literal_a_string(literal: Any) bool
Checks whether a literal is accepted by TextExtractorAllStringLiterals.
- Parameters:
literal (Any) – The RDF literal.
- Returns:
True if the literal is a string literal.
- Return type:
bool
- is_olala_text_property(predicate: URIRef) bool
Checks whether a predicate should be used by OLaLa TextExtractorSet.
- Parameters:
predicate (URIRef) – The RDF predicate.
- Returns:
True if the predicate is label-like or description-like.
- Return type:
bool
- lang_tag_match(target: str) bool
Checks whether a language tag matches the configured language.
- Parameters:
target (str) – The language tag.
- Returns:
True if the language tag matches.
- Return type:
bool
- normalize(text: str) str
Normalizes text following MELT StringProcessing.normalize.
- Parameters:
text (str) – The text to normalize.
- Returns:
The normalized token list.
- Return type:
List[str]
- normalize_only_camel_case_and_underscore(text: str) str
Normalizes only camel case and underscores.
- Parameters:
text (str) – The text to normalize.
- Returns:
The normalized text.
- Return type:
str
Graph Triple Ontology Alignment Track¶
The graph triplet parser that aims to provide triplet representations of ontologies for KGEs.
- class ontoaligner.ontology.triple.GraphTripleOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class representing a source-target ontology mapping task, using subject-predicate-object triples extracted from RDF graphs.
- track
The benchmark track for evaluation.
- Type:
Any
- ontology_name
The name of the dataset/ontology pair.
- Type:
str
- source_ontology
Parsed source ontology with labeled triples.
- Type:
GraphTripleOntology
- target_ontology
Parsed target ontology with labeled triples.
- Type:
GraphTripleOntology
- ontology_name: str = 'Source-Target'
- source_ontology: Any = <ontoaligner.ontology.triple.GraphTripleOntology object>
- target_ontology: Any = <ontoaligner.ontology.triple.GraphTripleOntology object>
- track: str = 'GraphTriple'
- class ontoaligner.ontology.triple.GraphTripleOntology(language: str = 'en')[source]
Bases:
BaseOntologyParserA parser that extracts subject-predicate-object triples from an RDF/OWL ontology graph.
This class filters out blank nodes and non-informative constructs, while associating human-readable labels with each IRI. It also marks which entities are declared as OWL or RDFS classes.
- language
Language code used for label extraction (currently not applied directly, reserved for future use).
- Type:
str
Example
>>> parser = GraphTripleOntology(language='en') >>> graph = parser.load_ontology("ontology.owl") >>> triples = parser.extract_data(graph) >>> print(triples[0]) ... { ... 'subject': ('http://example.org#Gene', 'Gene'), ... 'predicate': ('http://www.w3.org/2000/01/rdf-schema#subClassOf', 'subClassOf'), ... 'object': ('http://example.org#Entity', 'Entity'), ... 'subject_is_class': True, ... 'object_is_class': True ...}
Initialize the ontology parser with the specified language.
- extract_data(graph)
Extracts labeled triples from the RDF graph, filtering blank nodes and annotating class membership.
- Parameters:
graph (rdflib.Graph) – The RDFLib graph to extract triples from.
- Returns:
A list of dictionaries, each representing a triple with labels and class info.
- Return type:
List[Dict]
- load_ontology(input_file_path: str)
Loads the RDF/OWL ontology from the given file path.
FLORA Knowledge-Graph Alignment¶
Parser for FLORA Turtle-based KG alignment. Loads the Turtle file into a FLORA Graph (load_ontology) then extracts entities, predicates, triples, and the Graph object itself (extract_data), ready for FLORAEncoder.
OAEI: Anatomy Track¶
The anatomy real world case is about matching the Adult Mouse Anatomy (2744 classes) and the NCI Thesaurus (3304 classes) describing the human anatomy.
This script defines ontology parsers for the Mouse and Human ontologies, extending the base ontology parser.
- class ontoaligner.ontology.oaei.anatomy.HumanOntology[source]
Bases:
BaseOntologyParserThis class extends the BaseOntologyParser to parse the Human ontology.
It overrides the get_comments method to extract definitions for the ontology classes.
- get_comments(owl_class: Any) List
Retrieve the definitions for a given class in the Human ontology.
- Parameters:
owl_class (Any) – An individual class from the Human ontology.
- Returns:
A list of definitions associated with the given ontology class.
- Return type:
List
- class ontoaligner.ontology.oaei.anatomy.MouseHumanOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class that combines both the Mouse and Human ontologies for use in a specific task.
This class specifies the source and target ontologies (Mouse and Human, respectively), and defines the working directory for the dataset. The class also associates it with the “anatomy” track.
- ontology_name: str = 'mouse-human'
- source_ontology: Any = <ontoaligner.ontology.oaei.anatomy.MouseOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.anatomy.HumanOntology object>
- track: str = 'anatomy'
- class ontoaligner.ontology.oaei.anatomy.MouseOntology[source]
Bases:
BaseOntologyParserThis class extends the BaseOntologyParser to parse the Mouse ontology.
It overrides the get_comments method to extract comments from the ontology classes.
- get_comments(owl_class: Any) List
Retrieve the comments for a given class in the Mouse ontology.
- Parameters:
owl_class (Any) – An individual class from the Mouse ontology.
- Returns:
A list of comments associated with the given ontology class.
- Return type:
List
OAEI: Biodiversity and Ecology Track¶
The goal of the track is to find pairwise alignments between ontologies and thesauri that are particularly useful for biodiversity and ecology research and are being used in various projects. They have been developed in parallel and are very overlapping. They are semantically rich and contain tens of thousands of classes.
This script defines ontology parsers for various ontologies (ENVO, SWEET, SeaLife, TAXREFLD, NCBI) and creates specific dataset classes for each ontology pairing. The ontology parsers extract various types of information such as synonyms, comments, and labels for different biological and environmental categories.
- class ontoaligner.ontology.oaei.biodiv.EnvoOntology[source]
Bases:
BaseOntologyParserThis class extends BaseOntologyParser to parse the ENVO (Environmental Ontology).
- get_comments(owl_class: Any) List
Retrieves comments for a given class in the ENVO ontology.
- Parameters:
owl_class (Any) – An ontology class from the ENVO ontology.
- Returns:
A list of comments associated with the given ontology class.
- Return type:
List
- get_synonyms(owl_class: Any) List
Retrieves synonyms for a given class in the ENVO ontology.
- Parameters:
owl_class (Any) – An ontology class from the ENVO ontology.
- Returns:
A list of synonyms associated with the given ontology class.
- Return type:
List
- class ontoaligner.ontology.oaei.biodiv.EnvoSweetOMDataset(**kwargs)[source]
Bases:
OMDatasetDataset combining the ENVO and SWEET ontologies.
This dataset includes the necessary ontologies for source and target data and defines the working directory for this specific dataset.
- ontology_name: str = 'envo-sweet'
- source_ontology: Any = <ontoaligner.ontology.oaei.biodiv.EnvoOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.biodiv.SweetOntology object>
- track: str = 'biodiv'
- class ontoaligner.ontology.oaei.biodiv.FishZooplanktonOMDataset(**kwargs)[source]
Bases:
OMDatasetDataset combining the SeaLife ontology for both source and target.
This dataset includes the SeaLife ontology as both the source and target ontology and defines the working directory for this dataset.
- ontology_name: str = 'fish-zooplankton'
- source_ontology: Any = <ontoaligner.ontology.oaei.biodiv.SeaLifeOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.biodiv.SeaLifeOntology object>
- track: str = 'biodiv'
- class ontoaligner.ontology.oaei.biodiv.MacroalgaeMacrozoobenthosOMDataset(**kwargs)[source]
Bases:
OMDatasetDataset combining the SeaLife ontology for both source and target, specific to macroalgae and macrozoobenthos categories.
- ontology_name: str = 'macroalgae-macrozoobenthos'
- source_ontology: Any = <ontoaligner.ontology.oaei.biodiv.SeaLifeOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.biodiv.SeaLifeOntology object>
- track: str = 'biodiv'
- class ontoaligner.ontology.oaei.biodiv.NCBIOntology[source]
Bases:
BaseOntologyParserThis class extends BaseOntologyParser to parse the NCBI Taxonomy ontology, which provides taxonomic information on a wide range of organisms.
- get_comments(owl_class: Any) List
Retrieves comments for a given class in the NCBI ontology.
- Parameters:
owl_class (Any) – An ontology class from the NCBI ontology.
- Returns:
A list of comments associated with the given ontology class.
- Return type:
List
- get_synonyms(owl_class: Any) List
Retrieves synonyms for a given class in the NCBI ontology.
- Parameters:
owl_class (Any) – An ontology class from the NCBI ontology.
- Returns:
A list of synonyms associated with the given ontology class.
- Return type:
List
- class ontoaligner.ontology.oaei.biodiv.SeaLifeOntology[source]
Bases:
BaseOntologyParserThis class extends BaseOntologyParser to parse the SeaLife ontology.
- get_comments(owl_class: Any) List
Retrieves comments for a given class in the SeaLife ontology.
- Parameters:
owl_class (Any) – An ontology class from the SeaLife ontology.
- Returns:
A list of comments associated with the given ontology class.
- Return type:
List
- get_label(owl_class: Any) str
Retrieves the label for a given class in the SeaLife ontology.
- Parameters:
owl_class (Any) – An ontology class from the SeaLife ontology.
- Returns:
The label of the ontology class.
- Return type:
str
- get_synonyms(owl_class: Any) List
Retrieves synonyms for a given class in the SeaLife ontology.
- Parameters:
owl_class (Any) – An ontology class from the SeaLife ontology.
- Returns:
A list of synonyms associated with the given ontology class.
- Return type:
List
- is_contain_label(owl_class: Any) bool
Checks if a given class in the SeaLife ontology contains a label.
- Parameters:
owl_class (Any) – An ontology class from the SeaLife ontology.
- Returns:
True if the class contains a label, False otherwise.
- Return type:
bool
- class ontoaligner.ontology.oaei.biodiv.SweetOntology[source]
Bases:
BaseOntologyParserThis class extends BaseOntologyParser to parse the SWEET ontology (Sweet Earth Ontology).
- get_comments(owl_class: Any) List
Retrieves an empty list of comments for the SWEET ontology.
- Parameters:
owl_class (Any) – An ontology class from the SWEET ontology.
- Returns:
An empty list, as SWEET ontology does not contain comments.
- Return type:
List
- get_label(owl_class: Any) str
Retrieves the label for a given class in the SWEET ontology.
- Parameters:
owl_class (Any) – An ontology class from the SWEET ontology.
- Returns:
The label of the ontology class.
- Return type:
str
- get_synonyms(owl_class: Any) List
Retrieves an empty list of synonyms for the SWEET ontology.
- Parameters:
owl_class (Any) – An ontology class from the SWEET ontology.
- Returns:
An empty list, as SWEET ontology does not contain synonyms.
- Return type:
List
- is_contain_label(owl_class: Any) bool
Checks if a given class in the SWEET ontology contains a valid label.
- Parameters:
owl_class (Any) – An ontology class from the SWEET ontology.
- Returns:
True if the class contains a valid label, False otherwise.
- Return type:
bool
- class ontoaligner.ontology.oaei.biodiv.TAXREFLDOntology[source]
Bases:
BaseOntologyParserDataset combining the SeaLife ontology for both source and target, specific to macroalgae and macrozoobenthos categories.
- track
The track associated with the dataset, set to “biodiv”.
- Type:
str
- ontology_name
The name of the ontology dataset, set to “macroalgae-macrozoobenthos”.
- Type:
str
- source_ontology
The source ontology parser (SeaLife).
- Type:
SeaLifeOntology
- target_ontology
The target ontology parser (SeaLife).
- Type:
SeaLifeOntology
- get_comments(owl_class: Any) List
Retrieves comments for a given class in the TAXREFLD ontology.
- Parameters:
owl_class (Any) – An ontology class from the TAXREFLD ontology.
- Returns:
A list of comments associated with the given ontology class.
- Return type:
List
- get_synonyms(owl_class: Any) List
Retrieves synonyms for a given class in the TAXREFLD ontology.
- Parameters:
owl_class (Any) – An ontology class from the TAXREFLD ontology.
- Returns:
A list of synonyms associated with the given ontology class.
- Return type:
List
- class ontoaligner.ontology.oaei.biodiv.TaxrefldBacteriaNcbitaxonBacteriaOMDataset(**kwargs)[source]
Bases:
OMDatasetDataset combining the TAXREFLD and NCBI ontologies for the Bacteria category.
- ontology_name: str = 'taxrefldBacteria-ncbitaxonBacteria'
- source_ontology: Any = <ontoaligner.ontology.oaei.biodiv.TAXREFLDOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.biodiv.NCBIOntology object>
- track: str = 'biodiv'
- class ontoaligner.ontology.oaei.biodiv.TaxrefldChromistaNcbitaxonChromistaOMDataset(**kwargs)[source]
Bases:
OMDatasetDataset combining the TAXREFLD and NCBI ontologies for the Chromista category.
- ontology_name: str = 'taxrefldChromista-ncbitaxonChromista'
- source_ontology: Any = <ontoaligner.ontology.oaei.biodiv.TAXREFLDOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.biodiv.NCBIOntology object>
- track: str = 'biodiv'
- class ontoaligner.ontology.oaei.biodiv.TaxrefldFungiNcbitaxonFungiOMDataset(**kwargs)[source]
Bases:
OMDatasetDataset combining the TAXREFLD and NCBI ontologies for the Fungi category.
- ontology_name: str = 'taxrefldFungi-ncbitaxonFungi'
- source_ontology: Any = <ontoaligner.ontology.oaei.biodiv.TAXREFLDOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.biodiv.NCBIOntology object>
- track: str = 'biodiv'
- class ontoaligner.ontology.oaei.biodiv.TaxrefldPlantaeNcbitaxonPlantaeOMDataset(**kwargs)[source]
Bases:
OMDatasetDataset combining the TAXREFLD and NCBI ontologies for the Plantae category.
- ontology_name: str = 'taxrefldPlantae-ncbitaxonPlantae'
- source_ontology: Any = <ontoaligner.ontology.oaei.biodiv.TAXREFLDOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.biodiv.NCBIOntology object>
- track: str = 'biodiv'
- class ontoaligner.ontology.oaei.biodiv.TaxrefldProtozoaNcbitaxonProtozoaOMDataset(**kwargs)[source]
Bases:
OMDatasetDataset combining the TAXREFLD and NCBI ontologies for the Protozoa category.
- ontology_name: str = 'taxrefldProtozoa-ncbitaxonProtozoa'
- source_ontology: Any = <ontoaligner.ontology.oaei.biodiv.TAXREFLDOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.biodiv.NCBIOntology object>
- track: str = 'biodiv'
OAEI: Bio-ML Track¶
The Bio-ML track is a Machine Learning (ML) friendly Biomedical track for Equivalence and Subsumption Matching. This track presents an unified evaluation framework suitable for both ML-based and non-ML-based OM systems. The datasets of this track are based on Mondo and UMLS Metathesarus. This track supersedes the previous largebio and phenotype tracks.
This script defines ontology parsers and datasets for bioinformatics-related tasks, specifically for processing disease-related ontologies and alignment data. The main objective is to handle ontological data, parse TSV files for specific bio-entities, and provide aligned datasets for various ontology combinations.
- class ontoaligner.ontology.oaei.bioml.BioMLAlignmentsParser[source]
Bases:
BaseAlignmentsParserA class for parsing and processing bio-alignment data in TSV format.
Inherits from BaseAlignmentsParser. This class handles the parsing of alignment data where each row contains source and target entity information, and the candidates for the target entity.
- parse(input_file_path: str | None = None) Dict
Parses the input TSV file to extract alignment data.
This method reads a TSV file, refactors the data, and organizes it into a dictionary format where the keys are “test-cands” and the values are the source-target alignment pairs.
- Parameters:
input_file_path (str) – The path to the TSV file to be parsed.
- Returns:
- A dictionary containing the “test-cands” data as key and a list of
aligned source and target entities as values.
- Return type:
Dict
- class ontoaligner.ontology.oaei.bioml.BioOntology[source]
Bases:
BaseOntologyParserA class for parsing biological ontologies to extract comments and synonyms.
Inherits from BaseOntologyParser. This class specifically extracts comments and synonyms (both related and exact) from biological ontology classes.
Initializes the BioOntology parser by calling the superclass constructor.
- get_comments(owl_class: Any) List
Retrieves the comments associated with the given ontology class.
- Parameters:
owl_class (Any) – The ontology class from which to extract comments.
- Returns:
A list of comments associated with the ontology class.
- Return type:
List
- get_synonyms(owl_class: Any) List
Retrieves synonyms associated with the given ontology class.
This method first tries to return both related and exact synonyms. If neither are found, it returns related synonyms or exact synonyms individually, depending on what is available.
- Parameters:
owl_class (Any) – The ontology class from which to extract synonyms.
- Returns:
A list of synonyms associated with the ontology class.
- Return type:
List
- class ontoaligner.ontology.oaei.bioml.NCITDOIDDiseaseLLMOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class combining the NCIT (National Cancer Institute Thesaurus) and DOID (Disease Ontology) ontologies for disease-related data, specifically for Large Language Models (LLM).
This dataset is designed for LLM applications, combining NCIT and DOID ontologies for disease-related data.
- alignments: BaseAlignmentsParser = <ontoaligner.ontology.oaei.bioml.BioMLAlignmentsParser object>
- ontology_name: str = 'ncit-doid.disease'
- source_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- track: str = 'bio-llm'
- class ontoaligner.ontology.oaei.bioml.NCITDOIDDiseaseOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class combining the NCIT (National Cancer Institute Thesaurus) and DOID (Disease Ontology) ontologies for disease-related data.
This class provides the source and target ontologies (both BioOntology), along with the working directory and alignment parser.
- alignments: BaseAlignmentsParser = <ontoaligner.ontology.oaei.bioml.BioMLAlignmentsParser object>
- ontology_name: str = 'ncit-doid.disease'
- source_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- track: str = 'bio-ml'
- class ontoaligner.ontology.oaei.bioml.OMIMORDODiseaseOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class combining the OMIM (Online Mendelian Inheritance in Man) and ORDO (Orphanet Rare Disease Ontology) ontologies for disease-related data.
- alignments: BaseAlignmentsParser = <ontoaligner.ontology.oaei.bioml.BioMLAlignmentsParser object>
- ontology_name: str = 'omim-ordo.disease'
- source_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- track: str = 'bio-ml'
- class ontoaligner.ontology.oaei.bioml.SNOMEDFMABodyLLMOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class combining the SNOMED CT (Systematized Nomenclature of Medicine) and FMA (Foundational Model of Anatomy) ontologies for body-related data, specifically for Large Language Models (LLM).
This dataset is used for LLM applications, combining SNOMED and FMA ontologies for body-related data.
- alignments: BaseAlignmentsParser = <ontoaligner.ontology.oaei.bioml.BioMLAlignmentsParser object>
- ontology_name: str = 'snomed-fma.body'
- source_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- track: str = 'bio-llm'
- class ontoaligner.ontology.oaei.bioml.SNOMEDFMABodyOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class combining the SNOMED CT (Systematized Nomenclature of Medicine) and FMA (Foundational Model of Anatomy) ontologies for body-related data.
This dataset is tailored for body-related ontological data, using SNOMED and FMA ontologies as sources and targets.
- alignments: BaseAlignmentsParser = <ontoaligner.ontology.oaei.bioml.BioMLAlignmentsParser object>
- ontology_name: str = 'snomed-fma.body'
- source_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- track: str = 'bio-ml'
- class ontoaligner.ontology.oaei.bioml.SNOMEDNCITNeoplasOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class combining the SNOMED CT (Systematized Nomenclature of Medicine) and NCIT (National Cancer Institute Thesaurus) ontologies for neoplasms (tumors) data.
This dataset is used for neoplasms-related data with SNOMED and NCIT ontologies as source and target.
- alignments: BaseAlignmentsParser = <ontoaligner.ontology.oaei.bioml.BioMLAlignmentsParser object>
- ontology_name: str = 'snomed-ncit.neoplas'
- source_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- track: str = 'bio-ml'
- class ontoaligner.ontology.oaei.bioml.SNOMEDNCITPharmOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class combining the SNOMED CT (Systematized Nomenclature of Medicine) and NCIT (National Cancer Institute Thesaurus) ontologies for pharmaceutical data.
This dataset uses SNOMED and NCIT ontologies for pharmacological information, suitable for drug-related data.
- alignments: BaseAlignmentsParser = <ontoaligner.ontology.oaei.bioml.BioMLAlignmentsParser object>
- ontology_name: str = 'snomed-ncit.pharm'
- source_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.bioml.BioOntology object>
- track: str = 'bio-ml'
- ontoaligner.ontology.oaei.bioml.refactor_tsv(dataframe: Any, columns: Dict) List[source]
Refactors a dataframe to a list of dictionaries with specified column mappings.
This function restructures a DataFrame into a list of dictionaries, where each dictionary represents a row and the columns are renamed as per the specified mapping.
- Parameters:
dataframe (Any) – The input dataframe to be refactored.
columns (Dict) – A dictionary mapping the source column names to the target column names.
- Returns:
- A list of dictionaries where each dictionary represents a row in the TSV with
the new column names and values.
- Return type:
List
OAEI: Common Knowledge Graphs Track¶
This track composes of a task aimed at matching the schema of two common and highly influential knowledge graphs which are : DBpedia and the Never Ending Language Learner (NELL).
This script defines classes for parsing and processing datasets that are based on the CommonKG (Common Knowledge Graph) ontology. The main objective is to provide ontology parsers and dataset configurations for specific datasets (e.g., Nell-DBpedia, Yago-Wikidata).
- class ontoaligner.ontology.oaei.commonkg.CommonKGOntology[source]
Bases:
BaseOntologyParserA class for parsing and handling the CommonKG ontology.
This class provides methods to retrieve comments and synonyms for ontology classes, though in its current form, these methods return empty lists.
- get_comments(owl_class: Any) List
Retrieves the comments associated with the given ontology class.
In this implementation, it currently returns an empty list.
- Parameters:
owl_class (Any) – The ontology class whose comments are to be retrieved.
- Returns:
An empty list, as this method is not yet implemented.
- Return type:
List
- get_synonyms(owl_class: Any) List
Retrieves the synonyms associated with the given ontology class.
In this implementation, it currently returns an empty list.
- Parameters:
owl_class (Any) – The ontology class whose synonyms are to be retrieved.
- Returns:
An empty list, as this method is not yet implemented.
- Return type:
List
- class ontoaligner.ontology.oaei.commonkg.NellDbpediaOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class combining the Nell and DBpedia ontologies for knowledge graph data.
This class uses the CommonKGOntology for both the source and target ontologies and defines the working directory for the dataset.
- ontology_name: str = 'nell-dbpedia'
- source_ontology: Any = <ontoaligner.ontology.oaei.commonkg.CommonKGOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.commonkg.CommonKGOntology object>
- track: str = 'commonkg'
- class ontoaligner.ontology.oaei.commonkg.YagoWikidataOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class combining the Yago and Wikidata ontologies for knowledge graph data.
This class uses the CommonKGOntology for both the source and target ontologies and defines the working directory for the dataset.
- ontology_name: str = 'yago-wikidata'
- source_ontology: Any = <ontoaligner.ontology.oaei.commonkg.CommonKGOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.commonkg.CommonKGOntology object>
- track: str = 'commonkg'
OAEI: Food Nutritional Composition Track¶
This track consists of finding alignments between food concepts from CIQUAL, the French food nutritional composition database, and food concepts from SIREN. Food concepts from both databases are described in LanguaL, a well-known multilingual thesaurus using faceted classification.
This script defines classes for parsing and processing datasets related to food ontologies. It includes a class for parsing the FoodOntology and a dataset configurations.
- class ontoaligner.ontology.oaei.food.CiqualSirenOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class combining the Ciqual-Siren ontology for food-related data.
This class uses the FoodOntology for both the source and target ontologies and defines the working directory for the dataset.
- ontology_name: str = 'ciqual-siren'
- source_ontology: Any = <ontoaligner.ontology.oaei.food.FoodOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.food.FoodOntology object>
- track: str = 'food'
- class ontoaligner.ontology.oaei.food.FoodOntology[source]
Bases:
BaseOntologyParserA class for parsing and handling the Food ontology.
This class provides methods for extracting information such as labels, synonyms, parent classes, and comments for ontology classes.
- get_comments(owl_class: Any) List
Retrieves the comments for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose comments are to be retrieved.
- Returns:
An empty list, as no comments are implemented for the Food ontology.
- Return type:
List
- get_label(owl_class: Any) str
Retrieves the label for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose label is to be retrieved.
- Returns:
The label of the ontology class.
- Return type:
str
- get_parents(owl_class: Any) List
Retrieves the parent classes for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose parents are to be retrieved.
- Returns:
An empty list, as no parent classes are implemented for the Food ontology.
- Return type:
List
- get_synonyms(owl_class: Any) List
Retrieves the synonyms for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose synonyms are to be retrieved.
- Returns:
An empty list, as no synonyms are implemented for the Food ontology.
- Return type:
List
- is_contain_label(owl_class: Any) bool
Checks if the ontology class has a label.
- Parameters:
owl_class (Any) – The ontology class whose label presence is to be checked.
- Returns:
True if the ontology class contains a label, otherwise False.
- Return type:
bool
OAEI: Material Sciences and Engineering Track¶
The Material Sciences and Engineering (MSE) track contains the first benchmark for the evaluation of (semi-)automatic ontology matching techniques. In this emerging ontological domain, small to mid-sized upper and domain level ontologies are used that contain concepts described in natural language and are implemented by heterogeneous design principles with only partial overlap to each other.
This script defines several classes for parsing and processing ontologies related to material science and engineering. It includes helper functions for string manipulation and ontology parsing methods for extracting labels, comments, synonyms, ancestors, and other ontology-related information.
- class ontoaligner.ontology.oaei.mse.EMMOOntology[source]
Bases:
BaseOntologyParserA parser for the EMMO (European Materials & Modelling Ontology).
This class provides methods for extracting information such as labels, comments, ancestors, and checking whether an ontology class contains a label.
- get_ancestors(owl_class: Any) List
Retrieves the ancestors for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose ancestors are to be retrieved.
- Returns:
A list of ancestor classes for the given ontology class.
- Return type:
List
- get_comments(owl_class: Any) List
Retrieves the comments for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose comments are to be retrieved.
- Returns:
The comments associated with the ontology class.
- Return type:
List
- get_label(owl_class: Any) str
Retrieves and formats the label for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose label is to be retrieved.
- Returns:
The formatted label of the ontology class.
- Return type:
str
- get_synonyms(owl_class: Any) List
Retrieves the synonyms for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose synonyms are to be retrieved.
- Returns:
An empty list as no synonyms are implemented for this ontology class.
- Return type:
List
- is_contain_label(owl_class: Any) bool
Checks if the ontology class has a label.
- Parameters:
owl_class (Any) – The ontology class whose label presence is to be checked.
- Returns:
True if the ontology class contains a label, otherwise False.
- Return type:
bool
- class ontoaligner.ontology.oaei.mse.MatOntoOntology[source]
Bases:
BaseOntologyParserA parser for the MatOnto ontology, which provides methods for extracting comments and synonyms.
- get_comments(owl_class: Any) List
Retrieves comments for the ontology class.
- Parameters:
owl_class (Any) – The ontology class whose comments are to be retrieved.
- Returns:
A list of comments for the ontology class.
- Return type:
List
- get_synonyms(owl_class: Any) List
Retrieves synonyms for the ontology class.
- Parameters:
owl_class (Any) – The ontology class whose synonyms are to be retrieved.
- Returns:
A list of synonyms for the ontology class.
- Return type:
List
- class ontoaligner.ontology.oaei.mse.MaterialInformationEMMOOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class for working with the MaterialInformation-EMMO ontology.
This class maps the source ontology MaterialInformationOntoOntology to the target ontology EMMOOntology for the MaterialInformation-EMMO dataset.
- ontology_name: str = 'MaterialInformation-EMMO'
- source_ontology: Any = <ontoaligner.ontology.oaei.mse.MaterialInformationOntoOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.mse.EMMOOntology object>
- track: str = 'mse'
- class ontoaligner.ontology.oaei.mse.MaterialInformationMatOntoOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class for working with the MaterialInformation-MatOnto ontology.
This class maps the source ontology MaterialInformationOntoOntology to the target ontology MatOntoOntology for the MaterialInformation-MatOnto dataset.
- ontology_name: str = 'MaterialInformation-MatOnto'
- source_ontology: Any = <ontoaligner.ontology.oaei.mse.MaterialInformationOntoOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.mse.MatOntoOntology object>
- track: str = 'mse'
- class ontoaligner.ontology.oaei.mse.MaterialInformationMatOntoReducedOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class for working with the MaterialInformationReduced-MatOnto ontology.
This class maps the source ontology MaterialInformationOntoOntology to the target ontology MatOntoOntology for the MaterialInformationReduced-MatOnto dataset.
- ontology_name: str = 'MaterialInformationReduced-MatOnto'
- source_ontology: Any = <ontoaligner.ontology.oaei.mse.MaterialInformationOntoOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.mse.MatOntoOntology object>
- track: str = 'mse'
- class ontoaligner.ontology.oaei.mse.MaterialInformationOntoOntology(language: str = 'en')[source]
Bases:
GenericOntologyA parser for the Material Information Ontology.
This class provides methods for handling ontology items such as labels, names, IRIs, parents, children, and more. It also provides functionality to load the ontology from a file.
- ontoaligner.ontology.oaei.mse.split_string(input_str)[source]
Splits an input string into meaningful components based on a predefined regular expression pattern.
The function looks for patterns in the input string and splits it into uppercase and lowercase parts, returning them as individual components. If the pattern is not found, it falls back to splitting the string based on uppercase and lowercase transitions.
- Parameters:
input_str (str) – The string to be split and formatted.
- Returns:
A formatted string with components separated by spaces.
- Return type:
str
OAEI: Disease and Phenotype Track¶
The Pistoia Alliance Ontologies Mapping project team organises and sponsors this track based on a real use case where it is required to find alignments between disease and phenotype ontologies. Specifically, the selected ontologies are the Human Phenotype (HP) Ontology, the Mammalian Phenotype (MP) Ontology, the Human Disease Ontology (DOID), and the Orphanet and Rare Diseases Ontology (ORDO).
This script defines ontology parsers for various disease-related ontologies, including DOID (Disease Ontology), ORDO (Orphanet Rare Disease Ontology), HP (Human Phenotype Ontology), and MP (Mammalian Phenotype Ontology). It also defines dataset classes that map between source and target ontologies for different phenotype-related datasets.
- class ontoaligner.ontology.oaei.phenotype.DoidOntology[source]
Bases:
BaseOntologyParserA parser for the DOID (Disease Ontology) ontology.
This class extracts comments, labels, and synonyms for ontology classes.
- get_comments(owl_class: Any) List
Retrieves the comments for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose comments are to be retrieved.
- Returns:
A list of comments for the given ontology class.
- Return type:
List
- get_label(owl_class: Any) str
Retrieves the label for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose label is to be retrieved.
- Returns:
The label of the ontology class.
- Return type:
str
- get_synonyms(owl_class: Any) List
Retrieves synonyms for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose synonyms are to be retrieved.
- Returns:
A list of synonyms for the given ontology class.
- Return type:
List
- class ontoaligner.ontology.oaei.phenotype.DoidOrdoOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class for mapping between the DOID and ORDO ontologies.
This class configures the source ontology as DoidOntology and the target ontology as OrdoOntology for the doid-ordo dataset. It specifies the working directory for the dataset.
- ontology_name: str = 'doid-ordo'
- source_ontology: Any = <ontoaligner.ontology.oaei.phenotype.DoidOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.phenotype.OrdoOntology object>
- track: str = 'phenotype'
- class ontoaligner.ontology.oaei.phenotype.HpMpOMDataset(**kwargs)[source]
Bases:
OMDatasetA dataset class for mapping between the HP and MP ontologies.
This class configures the source ontology as HpOntology and the target ontology as MpOntology for the hp-mp dataset. It specifies the working directory for the dataset.
- ontology_name: str = 'hp-mp'
- source_ontology: Any = <ontoaligner.ontology.oaei.phenotype.HpOntology object>
- target_ontology: Any = <ontoaligner.ontology.oaei.phenotype.MpOntology object>
- track: str = 'phenotype'
- class ontoaligner.ontology.oaei.phenotype.HpOntology[source]
Bases:
DoidOntologyA parser for the HP (Human Phenotype Ontology) ontology.
This class extends DoidOntology and provides additional functionality to check if the ontology class is related to HP by inspecting its IRI.
- is_contain_label(owl_class: Any) bool
Checks if the ontology class contains a label and is related to HP.
- Parameters:
owl_class (Any) – The ontology class to check.
- Returns:
True if the class has a label and is related to HP, otherwise False.
- Return type:
bool
- class ontoaligner.ontology.oaei.phenotype.MpOntology[source]
Bases:
DoidOntologyA parser for the MP (Mammalian Phenotype Ontology).
This class extends DoidOntology and provides additional functionality to check if the ontology class is related to MP by inspecting its IRI.
- is_contain_label(owl_class: Any) bool
Checks if the ontology class contains a label and is related to MP.
- Parameters:
owl_class (Any) – The ontology class to check.
- Returns:
True if the class has a label and is related to MP, otherwise False.
- Return type:
bool
- class ontoaligner.ontology.oaei.phenotype.OrdoOntology[source]
Bases:
BaseOntologyParserA parser for the ORDO (Orphanet Rare Disease Ontology).
This class extracts comments, labels, and synonyms for ontology classes.
- get_comments(owl_class: Any) List
Retrieves the comments for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose comments are to be retrieved.
- Returns:
A list of comments for the given ontology class.
- Return type:
List
- get_label(owl_class: Any) str
Retrieves the label for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose label is to be retrieved.
- Returns:
The label of the ontology class.
- Return type:
str
- get_synonyms(owl_class: Any) List
Retrieves synonyms for the given ontology class.
- Parameters:
owl_class (Any) – The ontology class whose synonyms are to be retrieved.
- Returns:
An empty list as no synonyms are implemented for this ontology class.
- Return type:
List