11/*******************************************************************************
2- * Copyright (c) 2022 Eclipse RDF4J contributors.
2+ * Copyright (c) 2015 Eclipse RDF4J contributors, Aduna, and others .
33 *
44 * All rights reserved. This program and the accompanying materials
55 * are made available under the terms of the Eclipse Distribution License v1.0
88 *
99 * SPDX-License-Identifier: BSD-3-Clause
1010 *******************************************************************************/
11- package org .eclipse .rdf4j .rio .jsonld ;
11+ package org .eclipse .rdf4j .rio .helpers ;
1212
1313import org .eclipse .rdf4j .rio .RioSetting ;
14- import org .eclipse .rdf4j .rio .helpers .BooleanRioSetting ;
15- import org .eclipse .rdf4j .rio .helpers .ClassRioSetting ;
16- import org .eclipse .rdf4j .rio .helpers .RioSettingImpl ;
14+
15+ import com .github .jsonldjava .core .DocumentLoader ;
1716
1817import no .hasmac .jsonld .document .Document ;
1918
2221 *
2322 * @author Peter Ansell
2423 * @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
25- *
26- * @since 4.3.0
2724 */
2825public class JSONLDSettings {
2926
@@ -36,10 +33,19 @@ public class JSONLDSettings {
3633 * Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.compact_arrays}.
3734 *
3835 * @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
36+ *
3937 */
4038 public static final RioSetting <Boolean > COMPACT_ARRAYS = new BooleanRioSetting (
4139 "org.eclipse.rdf4j.rio.jsonld.compact_arrays" , "Compact arrays" , Boolean .TRUE );
4240
41+ /**
42+ * If specified, it is used to retrieve remote documents and contexts; otherwise the processor's built-in loader is
43+ * used.
44+ *
45+ */
46+ public static final RioSetting <DocumentLoader > DOCUMENT_LOADER = new ClassRioSetting <>(
47+ "org.eclipse.rdf4j.rio.jsonld.document_loader" , "Document loader" , null );
48+
4349 /**
4450 * The JSON-LD context to use when expanding JSON-LD
4551 *
@@ -65,6 +71,37 @@ public class JSONLDSettings {
6571 "Throw an exception when logging a warning." ,
6672 Boolean .FALSE );
6773
74+ /**
75+ * If set to true, the JSON-LD processor is allowed to optimize the output of the
76+ * <a href= "http://json-ld.org/spec/latest/json-ld-api/#compaction-algorithm" >Compaction algorithm</a> to produce
77+ * even compacter representations.
78+ * <p>
79+ * Defaults to false.
80+ * <p>
81+ * Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.optimize}.
82+ *
83+ * @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
84+ *
85+ */
86+ public static final RioSetting <Boolean > OPTIMIZE = new BooleanRioSetting ("org.eclipse.rdf4j.rio.jsonld.optimize" ,
87+ "Optimize output" , Boolean .FALSE );
88+
89+ /**
90+ * If set to true, the JSON-LD processor may emit blank nodes for triple predicates, otherwise they will be omitted.
91+ * <p>
92+ * Note: the use of blank node identifiers to label properties is obsolete, and may be removed in a future version
93+ * of JSON-LD,
94+ * <p>
95+ * Defaults to false.
96+ * <p>
97+ * Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.produce_generalized_rdf}.
98+ *
99+ * @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
100+ *
101+ */
102+ public static final RioSetting <Boolean > PRODUCE_GENERALIZED_RDF = new BooleanRioSetting (
103+ "org.eclipse.rdf4j.rio.jsonld.produce_generalized_rdf" , "Produce generalized RDF" , Boolean .FALSE );
104+
68105 /**
69106 * If set to true, the JSON-LD processor will try to convert typed values to JSON native types instead of using the
70107 * expanded object form when converting from RDF. xsd:boolean values will be converted to true or false. xsd:integer
@@ -75,6 +112,7 @@ public class JSONLDSettings {
75112 * Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.use_native_types}.
76113 *
77114 * @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
115+ *
78116 */
79117 public static final RioSetting <Boolean > USE_NATIVE_TYPES = new BooleanRioSetting (
80118 "org.eclipse.rdf4j.rio.jsonld.use_native_types" , "Use Native JSON Types" , Boolean .FALSE );
@@ -88,6 +126,7 @@ public class JSONLDSettings {
88126 * Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.use_rdf_type}.
89127 *
90128 * @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
129+ *
91130 */
92131 public static final RioSetting <Boolean > USE_RDF_TYPE = new BooleanRioSetting (
93132 "org.eclipse.rdf4j.rio.jsonld.use_rdf_type" , "Use RDF Type" , Boolean .FALSE );
@@ -98,6 +137,7 @@ public class JSONLDSettings {
98137 * Defaults to {@link JSONLDMode#EXPAND} to provide maximum RDF compatibility.
99138 *
100139 * @see <a href="http://json-ld.org/spec/latest/json-ld-api/#features">JSONLD Features</a>
140+ *
101141 */
102142 public static final RioSetting <JSONLDMode > JSONLD_MODE = new RioSettingImpl <>(
103143 "org.eclipse.rdf4j.rio.jsonld_mode" , "JSONLD Mode" , JSONLDMode .EXPAND );
@@ -108,25 +148,11 @@ public class JSONLDSettings {
108148 * Default to false
109149 * <p>
110150 * Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.hierarchical_view}.
151+ *
111152 */
112153 public static final RioSetting <Boolean > HIERARCHICAL_VIEW = new BooleanRioSetting (
113154 "org.eclipse.rdf4j.rio.jsonld.hierarchical_view" , "Hierarchical representation of the JSON" , Boolean .FALSE );
114155
115- /**
116- * If set to true, the JSON-LD processor may emit blank nodes for triple predicates, otherwise they will be omitted.
117- * <p>
118- * Note: the use of blank node identifiers to label properties is obsolete, and may be removed in a future version
119- * of JSON-LD,
120- * <p>
121- * Defaults to false.
122- * <p>
123- * Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.produce_generalized_rdf}.
124- *
125- * @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
126- */
127- public static final RioSetting <Boolean > PRODUCE_GENERALIZED_RDF = new BooleanRioSetting (
128- "org.eclipse.rdf4j.rio.jsonld.produce_generalized_rdf" , "Produce generalized RDF" , Boolean .FALSE );
129-
130156 /**
131157 * Private default constructor.
132158 */
0 commit comments