Clear Filters
Clear Filters

Importing OWL API in Matlab

2 views (last 30 days)
Meh
Meh on 29 Jan 2021
Answered: Kautuk Raj on 26 Feb 2024
Hi... I'm trying to import OWL API to load an ontology file in Matlab, but I'm stuck with the error that says "Unable to resolve the name OWLManager.createOWLOntologyManager." My initial part of the code goes here.
% ========== OWL API Integration Code (Start) ==========
import org.semanticweb.owlapi.apibinding.OWLManager.*;
import org.semanticweb.owlapi.model.OWLOntologyManager.*;
import org.semanticweb.owlapi.model.IRI.*;
import java.io.File;
import java.io.IOException;
% Create Ontology Manager
manager = OWLManager.createOWLOntologyManager();
file = File('D:\Ran-Code\Affective_Computing_Prototype\0. Ontology\DECAF_Affective_Computing.owl');
localOntology = manager.loadOntologyFromOntologyDocument(file);
sprintf('Loaded ontology: %s', localOntology)
Any help is highly appreciated.

Answers (1)

Kautuk Raj
Kautuk Raj on 26 Feb 2024
From your question, I can understand that you are experiencing difficulties integrating the OWL API with MATLAB to load an ontology file and are encountering an error related to MATLAB's inability to recognize the "OWLManager.createOWLOntologyManager" method. I assume that you are using MATLAB R2023b.
This issue is likely because the OWL API JAR files are not on the Java class path in MATLAB. To fix this, you need to make sure that the OWL API JAR files and any other required dependencies are included on the MATLAB Java class path. More details can be found on the documentation page of the OWL API: https://github.com/owlcs/owlapi/wiki/Documentation

Categories

Find more on Denoising and Compression in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!