我正在使用 OWL API 以便从本体中获取信息。我需要检索加载的本体中使用的所有导入本体的列表。
OWL API 中是否有方法可以完成此任务?
我加载本体的代码是:
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAnnotationProperty;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLDataProperty;
import org.semanticweb.owlapi.model.OWLImportsDeclaration;
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
public class NSExtractor {
@SuppressWarnings("deprecation")
public static void main(String[] args) throws FileNotFoundException, OWLOntologyCreationException {
@SuppressWarnings("resource")
File testFile= new File("C:\\acco.n3");
OWLOntologyManager m = OWLManager.createOWLOntologyManager();
OWLDataFactory f = OWLManager.getOWLDataFactory();
OWLOntology o;
o = m.loadOntologyFromOntologyDocument(testFile);
jeck猫
慕后森
相关分类