I accidentally posted this in the discussions section, moving it to Q/A.
Hi guys,
I'm doing an internship where I'm tasked with working with RDF/OWL ontologies. I've converted an OWL document to JSON-LD, which then I've used to make a tree diagram which wasn't too difficult since there are resources on the net which helped quite a bit.
What I want to do now is convert the JSON-LD data to a format with I can use with the force graph layout in D3. It looks something like this:
Hide Expand Copy Code
{
"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}
]
}
My owl ontology is available on pastebin here (in json-ld format):
http://pastebin.com/g7ggDyFX[
^]. If you take a peak at the context you can see that I'm modelling the ontology by the "isSubClass" property.
I know that to read json files in D3 I can use d3.json. I'm unsure how exactly to convert to the format above though.
I found this github repository https://github.com/uf6/ottograf[^] that says it should be able to convert to the format, but I'm having a lot of trouble running it, and I also want to keep it in javascript. Any tips/solutions? Thanks!