用于创建本体文档的python包
ontodocs的Python项目详细描述
OnToDocs
ontodocs是一个python命令行应用程序,旨在帮助为rdf/owl编码的本体创建文档。
链接
示例
- Schema.org文档。
- FOAF文档。
这就是ontodocs可以开箱即用的文档类型。对于更多示例,take a look at this page。
安装
pip install ontodocs -U
说明
ontodocs允许为rdf词汇表生成文档,使用可视化算法创建简单的html页面、标记文件或基于d3.js的更复杂的javascript交互图表。
> Ontodocs -h
Usage: ontodocs [OPTIONS] [SOURCE]...
Ontodocs allows to create documentation for ontologies encoded in
RDF/OWL.
E.g.:
> ontodocs http://www.w3.org/2008/05/skos# --theme random -o
~/Desktop/skos
==> generates html docs for the SKOS ontology and save it to your desktop
Options:
-o, --outputpath TEXT Output path (default: home folder).
-t, --title TEXT Title for the visualization (default=graph uri).
--theme TEXT CSS Theme for the html-complex visualization
(random=use a random theme).
--showthemes Show the available CSS theme choices.
-v, --verbose Verbose mode.
-h, --help Show this message and exit.
这个库实际上并不打算以编程方式使用,但我确信其中有一些结构可以重用。
简言之,所有可视化都继承自一个VizFactory类,该类抽象了呈现dataviz时涉及的最常见操作。
这是从脚本调用可视化的方法:
import ontospy
from ontodocs.viz.viz_html_single import *
g = ontospy.Ontospy("http://cohere.open.ac.uk/ontology/cohere.owl#")
v = HTMLVisualizer(g) # => instantiate the visualization object
v.build() # => render visualization. You can pass an 'output_path' parameter too
v.preview() # => open in browser
依赖关系
ontodocs依赖于OntoSpy库,它本身依赖于Rdflib。
note: the functionalities of Ontodocs used to be part of OntoSpy until v1.8.