pyld
pyld copied to clipboard
JSON-LD processor written in Python
```python from pprint import pprint ctx = {'@vocab': 'http://ex.org/#', 'path': {'@type': '@id'}} data = { 'http://ex.org/#maxCount': 1, 'http://ex.org/#path': 'http://ex.org/#shortname' } pprint(jsonld.compact(data, ctx)) # { # '@context': {'@vocab': 'http://ex.org/#', 'path': {'@type':...
```python print(jsonld.compact( {'name': 'Bob'}, {"@vocab": "http://example.org#"} )) ``` I would expect this to return ```json { "@context": { "@vocab": "http://example.org#" }, "name": "Bob" } ``` But instead i got just...
I suggest to add some caching because if the library is called many times it's painfully slow
An empty dict is not truthy in python, so cannot just check for "if options['link']" Fixes #64
Framing with "@embed": "@link" has been proposed as one way to create an in-memory representation of a graph (as discussed in json-ld/json-ld.org#140 ). jsonld.js does this in a way that...
I running into the issue where I'm calling `jsonld.compact` with `'compactArrays': False`, and the result I'm getting always returns a graph and convert string value to list. The json structure...
Fixes #59 In cases where @type was set, but not @language, one or the other would end up being an empty dictionary. I have not run any tests on this,...
The tests that access https://json-ld.org/ have "SSL: CERTIFICATE_VERIFY_FAILED" failures. Perhaps due to the local VerifiedHTTPSHandler not supporting SNI?
For the ld+json on this page: http://io9.gizmodo.com/war-for-the-planet-of-the-apes-is-expanding-its-world-b-1789898134 Compaction fails with exception "argument of type 'bool' is not iterable" compacted = jsonld.compact(doc, "http://schema.org") The ld+json is copied below. It works fone...
Consider the following code: ``` python CTX={ "foo": "http://example.com/foo"} expanded = jsonld.expand({"fooo":"bar"}, {'expandContext': CTX}) ``` The result is an empty list, because "fooo" is not recognized by CTX. The fact...