'Can anyone explain the working of jsonld.compact() ? Wasn't able to find detailed documentation or examples for the compact() method
def process_all_imdb(cursor, imdb):
for i, mid in enumerate(get_movies_to_process(cursor)):
print "// %d movies processed." % i
movie = get_jsonld_from_imdb(imdb, mid)
movie = jsonld.compact(movie, 'http://schema.org/')
print json.dumps(movie, indent=4)
Couldn't understand how jsonld.compact() here was working.
Solution 1:[1]
The general form of Compacted JSON-LD is described here, with several examples.
The operation of the algorithm, is described here, although details of Context Processing are pertinent.
There is a complete test-suite contains many examples of compacting expanded JSON-LD documents.
All implementations of JSON-LD 1.1 conform to these algorithms. The document you referenced uses pyld, which is highly conformant.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gregg Kellogg |
