Package: ontolearn
OntolearnOntolearnis an open-source software library for description logic learning problem.
Find more in theDocumentation.Learning algorithms:Drill→Neuro-Symbolic Class Expression LearningEvoLearner→EvoLearner: Learning Description Logics with Evolutionary AlgorithmsNCES2→ (soon)Neural Class Expression Synthesis in ALCHIQ(D)NCES→Neural Class Expression SynthesisNERO→ (soon)Learning Permutation-Invariant Embeddings for Description Logic ConceptsCLIP→ (soon)Learning Concept Lengths Accelerates Concept Learning in ALCCELOE→Class Expression Learning for Ontology EngineeringOCEL→ A limited version of CELOEInstallationpipinstallontolearnorgitclonehttps://github.com/dice-group/Ontolearn.git&&condacreate--nameontopython=3.8.18&&condaactivateontopip3install-e.&&python-c"import ontolearn"wgethttps://files.dice-research.org/projects/Ontolearn/KGs.zip-O./KGs.zip&&unzipKGs.zippytest-pno:warnings-x# Running 158 tests takes ~ 3 minsDescription Logic Concept Learningfromontolearn.concept_learnerimportCELOEfromontolearn.knowledge_baseimportKnowledgeBasefromontolearn.learning_problemimportPosNegLPStandardfromontolearn.searchimportEvoLearnerNodefromowlapy.modelimportOWLClass,OWLClassAssertionAxiom,OWLNamedIndividual,IRI,OWLObjectProperty,OWLObjectPropertyAssertionAxiomfromowlapy.renderimportDLSyntaxObjectRenderer# (1) Load a knowledge graph.kb=KnowledgeBase(path='KGs/father.owl')# (2) Initialize a learner.model=CELOE(knowledge_base=kb)# (3) Define a description logic concept learning problem.lp=PosNegLPStandard(pos={OWLNamedIndividual(IRI.create("http://example.com/father#stefan")),OWLNamedIndividual(IRI.create("http://example.com/father#markus")),OWLNamedIndividual(IRI.create("http://example.com/father#martin"))},neg={OWLNamedIndividual(IRI.create("http://example.com/father#heinz")),OWLNamedIndividual(IRI.create("http://example.com/father#anna")),OWLNamedIndividual(IRI.create("http://example.com/father#michelle"))})# (4) Learn description logic concepts best fitting (3).dl_classifiers=model.fit(learning_problem=lp).best_hypotheses(2)# (5) Inference over unseen individualsnamespace='http://example.com/father#'# (6) New Individualsjulia=OWLNamedIndividual(IRI.create(namespace,'julia'))julian=OWLNamedIndividual(IRI.create(namespace,'julian'))thomas=OWLNamedIndividual(IRI.create(namespace,'thomas'))# (7) OWLClassAssertionAxiom  about (6)male=OWLClass(IRI.create(namespace,'male'))female=OWLClass(IRI.create(namespace,'female'))axiom1=OWLClassAssertionAxiom(individual=julia,class_expression=female)axiom2=OWLClassAssertionAxiom(individual=julian,class_expression=male)axiom3=OWLClassAssertionAxiom(individual=thomas,class_expression=male)# (8) OWLObjectPropertyAssertionAxiom about (6)has_child=OWLObjectProperty(IRI.create(namespace,'hasChild'))# Existing Individualsanna=OWLNamedIndividual(IRI.create(namespace,'anna'))markus=OWLNamedIndividual(IRI.create(namespace,'markus'))michelle=OWLNamedIndividual(IRI.create(namespace,'michelle'))axiom4=OWLObjectPropertyAssertionAxiom(subject=thomas,property_=has_child,object_=julian)axiom5=OWLObjectPropertyAssertionAxiom(subject=julia,property_=has_child,object_=julian)# 4. Use loaded class expressions for predictionspredictions=model.predict(individuals=[julia,julian,thomas,anna,markus,michelle],axioms=[axiom1,axiom2,axiom3,axiom4,axiom5],hypotheses=dl_classifiers)print(predictions)"""(¬female) ⊓ (∃ hasChild.⊤)  malejulia                            0.0   0.0julian                           0.0   1.0thomas                           1.0   1.0anna                             0.0   0.0markus                           1.0   1.0michelle                         0.0   0.0"""Fore more please refer to  theexamplesfolder.DeploymentpipinstallgradioTo deployEvoLearneron theFamilyknowledge graph. Available models to deploy:EvoLearner,NCES,CELOEandOCEL.pythondeploy_cl.py--modelevolearner--path_knowledge_baseKGs/Family/family-benchmark_rich_background.owlRun the help command to see the description on this script usage:pythondeploy_cl.py--helpCitingCurrently, we are working on our manuscript describing our framework.
If you find our work useful in your research, please consider citing the respective paper:# DRILL
@inproceedings{demir2023drill,
  author = {Demir, Caglar and Ngomo, Axel-Cyrille Ngonga},
  booktitle = {The 32nd International Joint Conference on Artificial Intelligence, IJCAI 2023},
  title = {Neuro-Symbolic Class Expression Learning},
  url = {https://www.ijcai.org/proceedings/2023/0403.pdf},
 year={2023}
}

# NCES2
@inproceedings{kouagou2023nces2,
author={Kouagou, N'Dah Jean and Heindorf, Stefan and Demir, Caglar and Ngonga Ngomo, Axel-Cyrille},
title={Neural Class Expression Synthesis in ALCHIQ(D)},
url = {https://papers.dice-research.org/2023/ECML_NCES2/NCES2_public.pdf},
booktitle={Machine Learning and Knowledge Discovery in Databases},
year={2023},
publisher={Springer Nature Switzerland},
address="Cham"
}

# NCES
@inproceedings{kouagou2023neural,
  title={Neural class expression synthesis},
  author={Kouagou, N’Dah Jean and Heindorf, Stefan and Demir, Caglar and Ngonga Ngomo, Axel-Cyrille},
  booktitle={European Semantic Web Conference},
  pages={209--226},
  year={2023},
  publisher={Springer Nature Switzerland}
}

# EvoLearner
@inproceedings{heindorf2022evolearner,
  title={Evolearner: Learning description logics with evolutionary algorithms},
  author={Heindorf, Stefan and Bl{\"u}baum, Lukas and D{\"u}sterhus, Nick and Werner, Till and Golani, Varun Nandkumar and Demir, Caglar and Ngonga Ngomo, Axel-Cyrille},
  booktitle={Proceedings of the ACM Web Conference 2022},
  pages={818--828},
  year={2022}
}


# CLIP
@inproceedings{kouagou2022learning,
  title={Learning Concept Lengths Accelerates Concept Learning in ALC},
  author={Kouagou, N’Dah Jean and Heindorf, Stefan and Demir, Caglar and Ngonga Ngomo, Axel-Cyrille},
  booktitle={European Semantic Web Conference},
  pages={236--252},
  year={2022},
  publisher={Springer Nature Switzerland}
}In case you have any question, please contact:onto-learn@lists.uni-paderborn.de