Java で owl api を使用してフクロウ ファイルをインポートする際に問題があります。2 つのフクロウ ファイルを正常にインポートできます。しかし、相互に統合された 3 つ以上の owl ファイルをインポートしようとすると、問題が発生します。例えば
Base.owl -- base ontology
Electronics.owl -- electronics ontology which imports Base.owl
Telephone.owl -- telephone ontology which imports Base.owl and Electronics.owl
Base.owl をインポートして Electronics.owl を実行すると、スムーズに動作します。コードを以下に示します。
File fileBase = new File("filepath/Base.owl");
File fileElectronic = new File("filePath/Electronic.owl");
SimpleIRIMapper iriMapper = new SimpleIRIMapper(IRI.create("url/Base.owl"),
IRI.create(fileBase));
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
manager.addIRIMapper(iriMapper);
OWLOntology ont = manager.loadOntologyFromOntologyDocument(fileElectronic);
ただし、Telephone.owl をロードする場合は、追加の iriMapper を作成してマネージャーに追加するだけです。追加のコードは ** で示されます。
File fileBase = new File("filepath/Base.owl");
File fileElectronic = new File("filePath/Electronic.owl");
**File fileTelephone = new File("filePath/Telephone.owl");**
SimpleIRIMapper iriMapper = new SimpleIRIMapper(IRI.create("url/Base.owl"),
IRI.create(fileBase));
**SimpleIRIMapper iriMapper2 = new SimpleIRIMapper(IRI.create("url/Electronic.owl"),
IRI.create(fileElectronic));**
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
manager.addIRIMapper(iriMapper);
**manager.addIRIMapper(iriMapper2);**
OWLOntology ont = manager.loadOntologyFromOntologyDocument(**fileTelephone**);
上記のコードでは、次のエラーが発生します。
Could not load import:
Import(url/Electronic.owl>)
Reason: Could not loaded imported ontology:
<url/Base.owl> Cause: null
誰かが私に手を差し伸べてくれれば、本当にありがたいです...よろしくお願いします...