繁体   English   中英

如何以json-ld格式保存owl本体?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM