You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Use MutliJson for parsing, allows adapter to be set in options, or the best available used automtaictally.
* Add some JRuby test workarounds, and README notification on feature.
* In context, keep query and fragment for base URI, and don't canonicalize unless the option indicates to do so.
* Add README entry on creating a custom documentLoader.
Copy file name to clipboardExpand all lines: README.md
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,9 @@ If the [jsonlint][] gem is installed, it will be used when validating an input d
16
16
17
17
Install with `gem install json-ld`
18
18
19
+
### MultiJson parser
20
+
The [MultiJson](https://rubygems.org/gems/multi_json) gem is used for parsing JSON; this defaults to the native JSON parser, but will use a more performant parser if one is available. A specific parser can be specified by adding the `:adapter` option to any API call. See [MultiJson](https://rubygems.org/gems/multi_json) for more information.
21
+
19
22
### JSON-LD Streaming Profile
20
23
This gem implements an optimized streaming writer used for generating JSON-LD from large repositories. Such documents result in the JSON-LD Streaming Profile:
21
24
@@ -219,6 +222,24 @@ This gem implements an optimized streaming writer used for generating JSON-LD fr
219
222
}
220
223
]
221
224
225
+
## Use a custom Document Loader
226
+
In some cases, the built-in document loader {JSON::LD::API.documentLoader} is inadequate; for example, when using `http://schema.org` as a remote context, it will be re-loaded every time.
227
+
228
+
All entries into the {JSON::LD::API} accept a `:documentLoader` option, which can be used to provide an alternative method to use when loading remote documents. For example:
229
+
230
+
def load_document_local(url, options={}, &block)
231
+
if RDF::URI(url, canonicalize: true) == RDF::URI('http://schema.org/')
0 commit comments