OWL到JSON转换器

cdmah0mi  于 5个月前  发布在  其他
关注(0)|答案(3)|浏览(74)

我需要将此OWL本体文件转换为JSON,以便将其集成到HTML5网页中进行可视化:
this is the OWL ontology file in question

eqqqjvef

eqqqjvef1#

我使用的WebVOWL工具,http://vowl.visualdataweb.org/webvowl/owl2vowl_0.1.4.zip的工作相当不错。
该命令为java -jar owl2vowl.jar -file yourfile.owl
祝你好运

yvt65v4c

yvt65v4c2#

OWL API版本4.0.1可以保存为两个JSON变体:RDFJsonDocumentFormatRDFJsonLDDocumentFormat
为了使用它们,需要将它们指定为OWLOntologyManager::save()的参数。
例如,https://github.com/owlcs/owlapi/wiki/Documentation

5n0oy7gb

5n0oy7gb3#

下面是Ignazio提到的方法的工作示例:

OWLOntologyManager m = OWLManager.createOWLOntologyManager();
    OWLOntology o = m.loadOntologyFromOntologyDocument(new File("my/path/file.owl"));
    StringDocumentTarget target = new StringDocumentTarget();

    org.semanticweb.owlapi.formats.RDFJsonDocumentFormat documentFormat = new RDFJsonDocumentFormat();
    m.saveOntology(o, documentFormat, target);

    FileWriter writer = new FileWriter(new File("thesaurus.json"));
    writer.write(target.toString());
    writer.close();

字符串

相关问题