Importing OWL API in Matlab

5 次查看(过去 30 天)
Meh
Meh 2021-1-29
回答: Kautuk Raj 2024-2-26
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.

回答(1 个)

Kautuk Raj
Kautuk Raj 2024-2-26
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

类别

Help CenterFile Exchange 中查找有关 Call Java from MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by