[英]How to save owl ontology in json-ld format?
OWLDocumentFormat ontologyFormat = new RDFJsonLDDocumentFormat();
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(inputstream);
manager.saveOntology( ontology, ontologyFormat, outputstream );
在上面的第四行代碼中,它不接受saveOntology方法並拋出此建議。請您幫忙為什么這樣做。 您在代碼中使用了相同的方法。
OWLOntologyManager類型的方法saveOntology(OWLOntology,OWLOntologyFormat,OutputStream)不適用於參數(OWLOntology,OWLDocumentFormat,OutputStream)
此代碼使用版本4和版本5進行編譯:
import java.io.InputStream;
import java.io.OutputStream;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.formats.RDFJsonLDDocumentFormat;
import org.semanticweb.owlapi.model.OWLDocumentFormat;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyManager;
public class Check {
public static void main(String[] args) throws Exception {
InputStream inputstream=null;
OutputStream outputstream=null;
OWLDocumentFormat ontologyFormat = new RDFJsonLDDocumentFormat();
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(inputstream);
manager.saveOntology( ontology, ontologyFormat, outputstream );
}
}
在類路徑中,您必須具有版本3以及版本4或版本5,並且OWLOntologyManager
接口聲明來自版本3。請確保您的類路徑中只有一個版本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.