我試圖做一個OWL本體的可視化。我已將其轉換爲JSON-LD,但現在需要將其轉換爲D3的節點/鏈接格式?僅供參考格式如下:將JSON-LD轉換爲d3.js節點/鏈接格式?
{
"nodes": [
{"x": 469, "y": 410},
{"x": 493, "y": 364},
{"x": 442, "y": 365},
{"x": 467, "y": 314},
{"x": 477, "y": 248},
{"x": 425, "y": 207},
{"x": 402, "y": 155},
{"x": 369, "y": 196},
{"x": 350, "y": 148},
{"x": 539, "y": 222},
{"x": 594, "y": 235},
{"x": 582, "y": 185},
{"x": 633, "y": 200}
],
"links": [
{"source": 0, "target": 1},
{"source": 1, "target": 2},
{"source": 2, "target": 0},
{"source": 1, "target": 3},
{"source": 3, "target": 2},
{"source": 3, "target": 4},
{"source": 4, "target": 5},
{"source": 5, "target": 6},
{"source": 5, "target": 7},
{"source": 6, "target": 7},
{"source": 6, "target": 8},
{"source": 7, "target": 8},
{"source": 9, "target": 4},
{"source": 9, "target": 11},
{"source": 9, "target": 10},
{"source": 10, "target": 11},
{"source": 11, "target": 12},
{"source": 12, "target": 10}
]
}
我知道我可以打開使用d3.json一個JSON文件,但我對究竟如何我可以從JSON-LD去上述格式不確定。任何解決方案謝謝。
編輯:
我OWL本體可以用引擎收錄這裏(JSON-LD格式):http://pastebin.com/g7ggDyFX。如果你在上下文中看到一個高峯,你可以看到我正在通過「isSubClass」屬性對本體進行建模。
我知道,要讀取D3中的json文件我可以使用d3.json。我不確定如何轉換爲上面的格式。
我發現這個github存儲庫https://github.com/uf6/ottograf,說它應該能夠轉換爲格式,但我有很多麻煩運行它,我也想保留在JavaScript中。任何提示/解決方案?謝謝!
您能否以JSON-LD格式共享您的數據樣本? –
可以爲您的JSON-LD數據的這個子集:「@type」:「schema:Person」, 「@type」:「owl:Class」, 「subClassOf」:{ 「@id」:「 gr:BusinessEntity「 } }'被翻譯爲兩個節點之間的一條邊'schema:Person'和'gr:BusinessEntity'? –