Configuration
The options of RdfRmlMapper.builder() and the methods that run a mapping. For the CLI, see the
CLI reference.
RdfRmlMapper mapper = RdfRmlMapper.builder()
.mapping(mapping)
// options
.build();
Builder options
Mapping
One of the two is required.
| Method |
Meaning |
mapping(Mapping) |
The triples maps and the location of the mapping file, which rml:MappingDirectory needs. Wins when both are set. |
triplesMaps(Set<TriplesMap>) |
Triples maps only, for example from RmlMappingLoader. |
Terms
| Method |
Default |
Meaning |
baseIri(String), baseIri(IRI) |
http://example.org/ |
The base for relative IRIs. rml:baseIRI on a triples map overrides it. |
iriUnicodeNormalization(Normalizer.Form) |
NFC |
Unicode normalization of generated IRIs. |
iriUpperCasePercentEncoding(boolean) |
true |
Upper-case hex digits in percent-encoding. |
valueFactorySupplier(Supplier<ValueFactory>) |
an interning factory |
The RDF4J value factory that creates the terms. |
CARML always rejects an invalid language tag, an IRI that is invalid even after the base IRI is applied, and an
rml:UnsafeIRI that contains <, >, ", \ or a control character. It does not check that a literal fits its
datatype. For that, pass RDF4J's ValidatingValueFactory::new as the value factory.
Sources
| Method |
Meaning |
fileResolver(Path) |
Resolve file sources against this directory. Overrides rml:root. |
classPathResolver(String) |
Resolve file sources on the classpath, under this path. Overrides rml:root. |
sourceResolver(SourceResolver<?>) |
Add your own source resolver. |
excludeLogicalSourceResolver(String) |
Leave out a resolver found on the classpath: CsvResolver, JsonPathResolver or XPathResolver. |
Execution
| Method |
Default |
Meaning |
dedupMode(DedupMode) |
AUTO |
See Deduplication. |
limit(long) |
no limit |
Process at most this many rows per view. |
allowMultipleSubjectMaps(boolean) |
false |
Accept a triples map with more than one subject map. |
strictMode(boolean) |
false |
Fail the run when a reference never produced a value across all records. Without it, a reference to a field that does not exist in a view still fails. |
byteChunkSize(int) |
65536 |
The chunk size of the byte methods. 0 gives one array per line. |
Evaluators
| Method |
Meaning |
logicalViewEvaluatorFactory(LogicalViewEvaluatorFactory) |
Register an evaluator. Repeatable. Switches classpath discovery off. |
joinExecutorFactory(JoinExecutorFactory) |
Replace the reactive evaluator's in-memory join. Switches classpath discovery off. |
Functions
See Functions.
| Method |
Meaning |
addFunctionDescriptions(InputStream, RDFFormat), addFunctionDescriptions(Model) |
Register FnO descriptions. |
function(String) |
Start defining a function with a lambda. |
addFunctions(Object...) |
Register objects with @RmlFunction methods. |
addFunctionClasses(String...) |
The same, by class name. |
functionRegistry(FunctionRegistry) |
Use your own registry. |
Output and observers
| Method |
Meaning |
targetRouter(TargetRouter) |
Write to logical targets. |
observer(MappingExecutionObserver) |
Add an observer. Repeatable. |
Running a mapping
| Method |
Returns |
Notes |
map() |
Flux<Statement> |
Streams. |
mapToModel() |
Model |
Blocks until the mapping completes and holds the whole result in memory. |
mapToNTriplesBytes(), mapToNQuadsBytes() |
Flux<byte[]> |
Serialized output in chunks. |
mapRecord(record, Class) |
Flux<Statement> |
Maps one record you pass in. The mapping must have a single source. |
tryMapDirectToFile(Path, OutputFormat) |
DirectSerializationOutcome |
See Direct serialization. |
map and mapToModel have overloads that take:
- an
InputStream for the unnamed stream source,
- a
Map<String, InputStream> for named stream sources,
- a
Set<TriplesMap> to run only those triples maps.