|
10 | 10 | *******************************************************************************/
|
11 | 11 | package org.eclipse.rdf4j.rio.helpers;
|
12 | 12 |
|
| 13 | +import java.util.List; |
| 14 | +import java.util.Set; |
| 15 | + |
13 | 16 | import org.eclipse.rdf4j.rio.RioSetting;
|
14 | 17 |
|
15 | 18 | import com.github.jsonldjava.core.DocumentLoader;
|
@@ -153,6 +156,66 @@ public class JSONLDSettings {
|
153 | 156 | public static final RioSetting<Boolean> HIERARCHICAL_VIEW = new BooleanRioSetting(
|
154 | 157 | "org.eclipse.rdf4j.rio.jsonld.hierarchical_view", "Hierarchical representation of the JSON", Boolean.FALSE);
|
155 | 158 |
|
| 159 | + /** |
| 160 | + * Whitelist of remote/local resources that the JSON-LD parser can retrieve. Set of URIs as strings. |
| 161 | + * <p> |
| 162 | + * Default: |
| 163 | + * {@code Set.of("http://www.w3.org/ns/anno.jsonld", "http://www.w3.org/ns/activitystreams.jsonld", "http://www.w3.org/ns/ldp.jsonld", "http://www.w3.org/ns/oa.jsonld", "http://www.w3.org/ns/hydra/context.jsonld", "http://schema.org/", "https://w3id.org/security/v1", "https://w3c.github.io/json-ld-rc/context.jsonld", "https://www.w3.org/2018/credentials/v1", "https://health-lifesci.schema.org/", "https://auto.schema.org/", "https://bib.schema.org/", "http://xmlns.com/foaf/spec/index.jsonld", "https://pending.schema.org/", "https://schema.org/", "https://schema.org/docs/jsonldcontext.jsonld", "https://schema.org/version/latest/schemaorg-current-https.jsonld", "https://schema.org/version/latest/schemaorg-all-http.jsonld", "https://schema.org/version/latest/schemaorg-all-https.jsonld", "https://schema.org/version/latest/schemaorg-current-http.jsonld", "https://schema.org/version/latest/schemaorg-all.jsonld", "https://schema.org/version/latest/schemaorg-current.jsonld", "https://project-open-data.cio.gov/v1.1/schema/catalog.jsonld", "https://geojson.org/geojson-ld/geojson-context.jsonld", "https://www.w3.org/2019/wot/td/v1"); |
| 164 | + * |
| 165 | + */ |
| 166 | + public static final RioSetting<Set<String>> WHITELIST = new RioSettingImpl<>( |
| 167 | + "org.eclipse.rdf4j.rio.jsonld_whitelist", |
| 168 | + "Whitelist of remote/local resources that the JSON-LD parser can retrieve. Set of URIs as strings.", |
| 169 | + Set.of( |
| 170 | + "http://www.w3.org/ns/anno.jsonld", |
| 171 | + "http://www.w3.org/ns/activitystreams.jsonld", |
| 172 | + "http://www.w3.org/ns/ldp.jsonld", |
| 173 | + "http://www.w3.org/ns/oa.jsonld", |
| 174 | + "http://www.w3.org/ns/hydra/context.jsonld", |
| 175 | + "http://schema.org/", |
| 176 | + "https://w3id.org/security/v1", |
| 177 | + "https://w3c.github.io/json-ld-rc/context.jsonld", |
| 178 | + "https://www.w3.org/2018/credentials/v1", |
| 179 | + "https://health-lifesci.schema.org/", |
| 180 | + "https://auto.schema.org/", |
| 181 | + "https://bib.schema.org/", |
| 182 | + "http://xmlns.com/foaf/spec/index.jsonld", |
| 183 | + "https://pending.schema.org/", |
| 184 | + "https://schema.org/", |
| 185 | + "https://schema.org/docs/jsonldcontext.jsonld", |
| 186 | + "https://schema.org/version/latest/schemaorg-current-https.jsonld", |
| 187 | + "https://schema.org/version/latest/schemaorg-all-http.jsonld", |
| 188 | + "https://schema.org/version/latest/schemaorg-all-https.jsonld", |
| 189 | + "https://schema.org/version/latest/schemaorg-current-http.jsonld", |
| 190 | + "https://schema.org/version/latest/schemaorg-all.jsonld", |
| 191 | + "https://schema.org/version/latest/schemaorg-current.jsonld", |
| 192 | + "https://project-open-data.cio.gov/v1.1/schema/catalog.jsonld", |
| 193 | + "https://geojson.org/geojson-ld/geojson-context.jsonld", |
| 194 | + "https://www.w3.org/2019/wot/td/v1" |
| 195 | + )); |
| 196 | + |
| 197 | + /** |
| 198 | + * Secure mode only allows loading remote/local resources (ex. context from url) that are whitelisted. |
| 199 | + * <p> |
| 200 | + * Default: true |
| 201 | + */ |
| 202 | + public static final RioSetting<Boolean> SECURE_MODE = new RioSettingImpl<>( |
| 203 | + "org.eclipse.rdf4j.rio.jsonld_secure_mode", |
| 204 | + "Secure mode only allows loading remote/local resources (ex. context from url) that are whitelisted.", |
| 205 | + Boolean.TRUE); |
| 206 | + |
| 207 | + /** |
| 208 | + * The document loader cache is enabled by default. All loaded documents, such as remote contexts, are cached for 1 |
| 209 | + * hour, or until the cache is full. The cache holds up to 1000 documents. The cache is shared between all |
| 210 | + * JSONLDParsers. The cache can be disabled by setting this value to false. |
| 211 | + * <p> |
| 212 | + * Default: true |
| 213 | + */ |
| 214 | + public static final RioSetting<Boolean> DOCUMENT_LOADER_CACHE = new RioSettingImpl<>( |
| 215 | + "org.eclipse.rdf4j.rio.jsonld_document_loader_cache", |
| 216 | + "The document loader cache is enabled by default. All loaded documents, such as remote contexts, are cached for 1 hour, or until the cache is full. The cache holds up to 1000 documents. The cache is shared between all JSONLDParsers. The cache can be disabled by setting this value to false.", |
| 217 | + Boolean.TRUE); |
| 218 | + |
156 | 219 | /**
|
157 | 220 | * Private default constructor.
|
158 | 221 | */
|
|
0 commit comments