dice-group / Ontolearn

Ontolearn is an open-source software library for explainable structured machine learning in Python. It learns OWL class expressions from positive and negative examples.
https://ontolearn-docs-dice-group.netlify.app/index.html
MIT License
39 stars 9 forks source link

TripleStoreKnowledgeBase vs TripleStore #451

Open Demirrr opened 6 days ago

Demirrr commented 6 days ago

Shall we combine these classes into one ?

Demirrr commented 5 days ago

KnowledgeBase implements the following computation in the initialization

        self.ind_set = init_individuals_from_concepts(include_implicit_individuals,
                                                      reasoner=self.reasoner,
                                                      ontology=self.ontology,
                                                      individuals_per_concept=(self.individuals(i) for i in
                                                                               self.get_concepts()))

see here This implies that we compute individuals for each concepts. This leads to a bottleneck on large knowledge graph. Since TripleStoreKnowledgeBase inherits from KnowledgeBase, we cannot use it as it is on large knowledge graphs. Yet, TripleStore works like charm but it does not implement few functions that KnowledgeBase implements.

We need to think about bringing them together @alkidbaci @LckyLke

alkidbaci commented 5 days ago

Yes I do agree that a refactoring is needed here and we should have a single triple store KB class. The suggested combined class should ideally still inherit from KnowledgeBase so that we can use our CEL algos without any extra changes and it needs to be fast like TripleStore. Its been a while since we implemented this but there are some clear differences in their structure. I suggest evaluating the possible merging points first and try to come up with a merging solution that satisfies all objectives. I can have a better look on this after I finish some other tasks but @LckyLke please feel free to take this one if you think of a solution before me.

alkidbaci commented 5 days ago

Should consider finding a solution for #446 also

LckyLke commented 5 days ago

Is there any reason why the ind_set is not just simply initialized like this?:

self.ind_set = frozenset(self.ontology.individuals_in_signature())

Demirrr commented 5 days ago

Is there any reason why the ind_set is not just simply initialized like this?:

self.ind_set = frozenset(self.ontology.individuals_in_signature())

Not that I am aware of 😀