小编Mad*_*mer的帖子

在 Python 中可视化 RDFLIB 图形

我是 Python RDFLIB 的新手。我在这里找到了这个创建图表的例子。可视化此代码创建的图形的最简单方法是什么?

import rdflib
# Now we create a graph, a representaiton of the ontology
g = rdflib.Graph()

# Now define the key words that we will use (the edge weights of the graph)
has_border_with = rdflib.URIRef('http://www.example.org/has_border_with')
located_in = rdflib.URIRef('http://www.example.org/located_in')

# define the things - base level objects that will be the nodes
# In this case first we have countries
germany = rdflib.URIRef('http://www.example.org/country1')
france = rdflib.URIRef('http://www.example.org/country2')
china = rdflib.URIRef('http://www.example.org/country3')
mongolia = rdflib.URIRef('http://www.example.org/country4')

# then we have continents …
Run Code Online (Sandbox Code Playgroud)

python plot rdflib

3
推荐指数
2
解决办法
6111
查看次数

标签 统计

plot ×1

python ×1

rdflib ×1