Framing and @reverse

Hello,

I am looking at using JSON-LD for a project I'm working on but am running into some difficulties. The data can be represented as a collection of directed acyclic graphs, and it needs to go through a topological sort. I'm trying to first transform the collection from the form "A-dependsOn-B, B-dependsOn-C" to the reverse, compacted form "C-hasDependencies-[A, B]" so I can use an algorithm like <https://github.com/davidstutz/d3-topological>. I think this transformation should be possible with JSON-LD, but I'm having difficulty making it happen. Here's a non-working code sample on the JSON-LD playground:

http://json-ld.org/playground/index.html?json-ld=%7B%22%40context%22%3A%7B%22dc%22%3A%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2C%22ex%22%3A%22http%3A%2F%2Fexample.org%2Fvocab%23%22%2C%22xsd%22%3A%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%22%2C%22ex%3AdependsOn%22%3A%7B%22%40type%22%3A%22%40id%22%7D%2C%22ex%3AhasDependency%22%3A%7B%22%40reverse%22%3A%22ex%3AdependsOn%22%7D%7D%2C%22%40graph%22%3A%5B%7B%22%40id%22%3A%22http%3A%2F%2Fexample.org%2FwakeUp%22%2C%22%40type%22%3A%22ex%3AEvent%22%2C%22dc%3Atitle%22%3A%22Wake%20Up%22%7D%2C%7B%22%40id%22%3A%22http%3A%2F%2Fexample.org%2FmakeCoffee%22%2C%22%40type%22%3A%22ex%3AEvent%22%2C%22dc%3Atitle%22%3A%22Make%20Coffee%22%2C%22ex%3AdependsOn%22%3A%22http%3A%2F%2Fexample.org%2FwakeUp%22%7D%2C%7B%22%40id%22%3A%22http%3A%2F%2Fexample.org%2FmakeToast%22%2C%22%40type%22%3A%22ex%3AEvent%22%2C%22dc%3Atitle%22%3A%22Make%20Toast%22%2C%22ex%3AdependsOn%22%3A%22http%3A%2F%2Fexample.org%2FwakeUp%22%7D%2C%7B%22%40id%22%3A%22http%3A%2F%2Fexample.org%2FhaveBreakfast%22%2C%22%40type%22%3A%22ex%3AEvent%22%2C%22dc%3Atitle%22%3A%22Have%20Breakfast%22%2C%22ex%3AdependsOn%22%3A%5B%22http%3A%2F%2Fexample.org%2FmakeCoffee%22%2C%22http%3A%2F%2Fexample.org%2FmakeToast%22%5D%7D%5D%7D&frame=%7B%0A%20%20%22%40context%22%3A%20%7B%0A%20%20%20%20%22dc%22%3A%20%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2C%0A%20%20%20%20%22ex%22%3A%20%22http%3A%2F%2Fexample.org%2Fvocab%23%22%0A%20%20%7D%2C%0A%20%20%22%40type%22%3A%20%22ex%3AEvent%22%2C%0A%20%20%22ex%3AhasDependency%22%3A%20%7B%0A%20%20%20%20%22%40type%22%3A%20%22ex%3AEvent%22%0A%20%20%7D%0A%7D&context=%7B%0A%20%20%22%40context%22%3A%20%7B%0A%20%20%20%20%22dc%22%3A%20%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2C%0A%20%20%20%20%22ex%22%3A%20%22http%3A%2F%2Fexample.org%2Fvocab%23%22%2C%0A%20%20%20%20%22xsd%22%3A%20%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%22%2C%0A%20%20%20%20%22ex%3Acontains%22%3A%20%7B%0A%20%20%20%20%20%20%22%40type%22%3A%20%22%40id%22%0A%20%20%20%20%7D%0A%20%20%7D%0A

Thanks for any suggestions!
Anders

Received on Thursday, 21 November 2013 09:43:21 UTC