Skip to content

GH-3654 reverted removal of generalized rdf #4934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import static org.eclipse.rdf4j.model.util.Values.literal;
import static org.eclipse.rdf4j.repository.config.RepositoryConfigSchema.REPOSITORYTYPE;

import java.util.Arrays;
import java.util.Set;

import org.eclipse.rdf4j.model.BNode;
import org.eclipse.rdf4j.model.Literal;
import org.eclipse.rdf4j.model.Model;
Expand Down Expand Up @@ -112,7 +115,8 @@ public static RepositoryImplConfig create(Model model, Resource resource) throws
RepositoryFactory factory = RepositoryRegistry.getInstance()
.get(typeLit.getLabel())
.orElseThrow(() -> new RepositoryConfigException(
"Unsupported repository type: " + typeLit.getLabel()));
"Unsupported repository type: '" + typeLit.getLabel() + "' supported types are: "
+ Arrays.toString(RepositoryRegistry.getInstance().getKeys().toArray())));

RepositoryImplConfig implConfig = factory.getConfig();
implConfig.parse(model, resource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ public class JSONLDSettings {
public static final RioSetting<Boolean> HIERARCHICAL_VIEW = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.jsonld.hierarchical_view", "Hierarchical representation of the JSON", Boolean.FALSE);

/**
* If set to true, the JSON-LD processor may emit blank nodes for triple predicates, otherwise they will be omitted.
* <p>
* Note: the use of blank node identifiers to label properties is obsolete, and may be removed in a future version
* of JSON-LD,
* <p>
* Defaults to false.
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.produce_generalized_rdf}.
*
* @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
*/
public static final RioSetting<Boolean> PRODUCE_GENERALIZED_RDF = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.jsonld.produce_generalized_rdf", "Produce generalized RDF", Boolean.FALSE);

/**
* Private default constructor.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public void endRDF() throws RDFHandlerException {
opts.setCompactArrays(writerConfig.get(JSONLDSettings.COMPACT_ARRAYS));
opts.setUseRdfType(writerConfig.get(JSONLDSettings.USE_RDF_TYPE));
opts.setUseNativeTypes(writerConfig.get(JSONLDSettings.USE_NATIVE_TYPES));
opts.setProduceGeneralizedRdf(writerConfig.get(JSONLDSettings.PRODUCE_GENERALIZED_RDF));
opts.setUriValidation(false);
opts.setExceptionOnWarning(writerConfig.get(JSONLDSettings.EXCEPTION_ON_WARNING));

Expand Down Expand Up @@ -393,6 +394,7 @@ public Collection<RioSetting<?>> getSupportedSettings() {
result.add(JSONLDSettings.JSONLD_MODE);
result.add(JSONLDSettings.USE_RDF_TYPE);
result.add(JSONLDSettings.USE_NATIVE_TYPES);
result.add(JSONLDSettings.PRODUCE_GENERALIZED_RDF);
result.add(JSONLDSettings.EXCEPTION_ON_WARNING);

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
Expand Down Expand Up @@ -126,14 +127,6 @@ public RDFFormat getRDFFormat() {

@Override
public Collection<RioSetting<?>> getSupportedSettings() {
Collection<RioSetting<?>> result = new HashSet<>(Arrays.asList(
BasicWriterSettings.BASE_DIRECTIVE,
JSONLDSettings.COMPACT_ARRAYS,
JSONLDSettings.HIERARCHICAL_VIEW,
JSONLDSettings.JSONLD_MODE,
JSONLDSettings.USE_RDF_TYPE,
JSONLDSettings.USE_NATIVE_TYPES
));
return result;
return new JSONLDWriter(new StringWriter()).getSupportedSettings();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ protected RioSetting<?>[] getExpectedSupportedSettings() {
BasicWriterSettings.PRETTY_PRINT,
JSONLDSettings.COMPACT_ARRAYS,
JSONLDSettings.JSONLD_MODE,
JSONLDSettings.PRODUCE_GENERALIZED_RDF,
JSONLDSettings.USE_RDF_TYPE,
JSONLDSettings.USE_NATIVE_TYPES,
JSONLDSettings.EXCEPTION_ON_WARNING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ protected RioSetting<?>[] getExpectedSupportedSettings() {
BasicWriterSettings.PRETTY_PRINT,
JSONLDSettings.COMPACT_ARRAYS,
JSONLDSettings.JSONLD_MODE,
JSONLDSettings.PRODUCE_GENERALIZED_RDF,
JSONLDSettings.USE_RDF_TYPE,
JSONLDSettings.USE_NATIVE_TYPES,
JSONLDSettings.EXCEPTION_ON_WARNING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ protected void setupParserConfig(ParserConfig config) {
protected RioSetting<?>[] getExpectedSupportedSettings() {
return new RioSetting[] {
BasicWriterSettings.BASE_DIRECTIVE,
BasicWriterSettings.PRETTY_PRINT,
JSONLDSettings.COMPACT_ARRAYS,
JSONLDSettings.HIERARCHICAL_VIEW,
JSONLDSettings.JSONLD_MODE,
JSONLDSettings.PRODUCE_GENERALIZED_RDF,
JSONLDSettings.USE_RDF_TYPE,
JSONLDSettings.USE_NATIVE_TYPES
JSONLDSettings.USE_NATIVE_TYPES,
JSONLDSettings.EXCEPTION_ON_WARNING
};
}
}