JsonLdEncoder constructor
- RdfNamespaceMappings? namespaceMappings,
- JsonLdEncoderOptions options = const JsonLdEncoderOptions(),
Creates a new JSON-LD serializer.
Implementation
JsonLdEncoder({
RdfNamespaceMappings? namespaceMappings,
JsonLdEncoderOptions options = const JsonLdEncoderOptions(),
}) : _options = options,
_namespaceMappings = namespaceMappings ?? const RdfNamespaceMappings() {
_iriCompaction = IriCompaction(
_namespaceMappings,
IriCompactionSettings(
generateMissingPrefixes: options.generateMissingPrefixes,
allowedCompactionTypes: {
...allowedCompactionTypesAll,
IriRole.predicate: {
IriCompactionType.full,
// relative IRIs are not allowed for predicates in jsonld
IriCompactionType.prefixed
}
},
specialPredicates: {
Rdf.type,
},
specialDatatypes: {
_booleanDatatype,
_decimalDatatype,
_doubleDatatype,
_integerDatatype,
_stringDatatype,
Rdf.langString,
}),
(String localPart) => RdfNamespaceMappings.isValidLocalPart(localPart,
allowNumericLocalNames: _useNumericLocalNames));
}