I need to take a large JSON-LD file as input for an algorithm that I am writing in Java. Therefore, I intend to use JSONLD-JAVA for that.
The JSONLD-JAVA page shows an example for reading a JSON-LD file, but not for navigating or traversing it, or accessing individual objects in it. Instead, it refers to the JSON-LD and JSON-LD API specifications for details on specific possible operations.
However, the JSON-LD specification simply defines the syntax and semantics of a JSON-LD, and does not say anything about how to access them, and of course neither should it, being just a specification of the format. I was expecting that kind of operation to be described in the JSON-LD API specification, but it only describes operations that convert the entire JSON-LD file into different forms (compact, expanded, flattening, and conversion to RDF). It does not seem to include operations for accessing the objects (for example, accessing the key-value pairs of an object).
So I am guessing we are supposed to read the JSON-LD file and expand or flatten it, and then access it as pure JSON. But JSONLD-JAVA methods only return instances of Object
, so it's not clear to me how I can use these object to obtain the JSON key-value pairs. The only exception seems to be the method frame
, which returns a Map, but it is not very clear to me what a frame is. The JSON-LD specification does not include the word "frame", and the JSON-LD API specification has a very terse explanation which does not seem to help in understanding how to access an object's key-value pairs.
The fact that I only have Object instances from JSONLD-JAVA methods also makes it look like it would be hard to use some JSON library to use them, unless I use some JSON library that knows about the internal format of these objects as formed by JSONLD-JAVA, but the page of JSONLD-Java does not mention any such library.
I was expecting to be able to read a JSON-LD file and then programmatically accessing or manipulating it within Java, and to have Java classes that correspond to the main concepts, something like a JSONLDObject
with methods for providing its key-value pairs.
As I read the above pages, I get the feeling that they are meant for people that already know something that I don't. So perhaps I am missing something. Otherwise, is there a tutorial on using JSONLD-JAVA or even just the JSONLD API in order to traverse the objects?