4

I want to find the path between two resource in DBpedia English SKOS thesaurus by using Jena! I am using the following code, but it returns null, even though nodes seem to have two "skos:broader" links between them! By the way, if there is only one "skos:broader" between some other nodes then it is able to find it.

    OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
    model.read(".../skos_categories_en.ttl", "N-TRIPLE");
    Resource rscResource=ResourceFactory.createResource("http://dbpedia.org/resource/Category:Sistine_Chapel");
    Resource rscResource2 =ResourceFactory.createResource("http://dbpedia.org/resource/Category:Paintings_in_Lazio");

    Path path = OntTools.findShortestPath(model, rscResource, rscResource2, Filter.any);

I have also tried this solution but since thesaurus is too big, it takes forever! Thanks in advance!

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
Erwarth
  • 547
  • 6
  • 18
  • 1
    The method in the `OntTools` that you refer to is not complete I guess. The other solution that you refer to is generic instead. To sum up, Jena is not a graph library - graph databases might have more efficient indexing and methods to solve the shortest path problem – UninformedUser Jun 08 '17 at 14:00
  • Thanks @AKSW! If I cannot find a solution, I consider trying some other triple stores! – Erwarth Jun 08 '17 at 16:05

0 Answers0