Ontolearn icon indicating copy to clipboard operation
Ontolearn copied to clipboard

Make use of a SPARQL endpoint for all CEL algorithms

Open MichaelRoeder opened this issue 10 months ago • 2 comments

User story

As a user of knowledge graphs, I already have my knowledge graph within a triple store with a SPARQL interface. However, for some of the CEL algorithms, it seems like I have to export my data into an OWL file to run them, just so that they load the file again into memory. Would it be possible to just provide a SPARQL endpoint as it is done in the tdl example?

MichaelRoeder avatar Apr 11 '24 15:04 MichaelRoeder

Hi Michael, as you already mentioned, like in the tdl example you just have to pass a TripleStoreKnowledgeBase instead of KnowledgeBase to any CEL algorithms and there is no need to have the knowledge graph locally. Currently, some bugs related to triple store implementation have emerged and there may be errors when executing concept learners. We will fix them soon.

alkidbaci avatar Apr 15 '24 14:04 alkidbaci

For the record, tDL and DRILL can be currently used with an endpoint of a triplestore, e.g.

ontolearn-webservice --endpoint_triple_store http://0.0.0.0:9080/sparql

import json
import requests
with open(f"LPs/Mutagenesis/lps.json") as json_file:
    learning_problems = json.load(json_file)["problems"]
for str_target_concept, examples in learning_problems.items():
    response = requests.get('http://0.0.0.0:8000/cel',
                            headers={'accept': 'application/json', 'Content-Type': 'application/json'},
                            json={"pos": examples['positive_examples'],
                                  "neg": examples['negative_examples'],
                                  "model": "TDL",
                                  })

Demirrr avatar May 08 '24 17:05 Demirrr