
CARML¶
CARML turns JSON, XML and CSV files and relational databases into RDF, following an RML mapping. It is a Java library, and carml-jar is a command-line tool that runs the same engine.
-
Add CARML to a project, or run a mapping from the shell.
-
How RML works, and how CARML evaluates a mapping.
-
Sources, logical views, functions, targets, and large inputs.
-
Builder options, CLI options, namespaces, Javadoc.
What CARML does¶
- It implements the RML modules Core, LV, IO, FNML and CC. Mappings written in legacy RML or R2RML still load. See Conformance.
map()returns a Project ReactorFlux<Statement>, so statements stream with backpressure and the result never has to fit in memory.- Every mapping is evaluated as a logical view. Per view, CARML picks one of three evaluators: the reactive evaluator, which streams records, one that sends SQL to MySQL or PostgreSQL, and one that runs the view in an in-process DuckDB database.
- Source resolvers, evaluators, functions and serializers are found through Java's
ServiceLoader. You add a capability by adding its module to the classpath.
Example¶
A mapping:
@prefix rml: <http://w3id.org/rml/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<TriplesMap1> a rml:TriplesMap ;
rml:logicalSource [ a rml:LogicalSource ;
rml:source [ a rml:RelativePathSource ; rml:path "student.json" ] ;
rml:referenceFormulation rml:JSONPath ;
rml:iterator "$.students[*]" ] ;
rml:subjectMap [ rml:template "http://example.com/{$.Name}" ] ;
rml:predicateObjectMap [
rml:predicate foaf:name ;
rml:objectMap [ rml:reference "$.Name" ] ] .
Running it from Java:
Mapping mapping = Mapping.of(RDFFormat.TURTLE, Paths.get("mapping.ttl"));
RdfRmlMapper mapper = RdfRmlMapper.builder()
.mapping(mapping)
.build();
Model result = mapper.mapToModel();
Or from the shell:
New to RML? Read RML in a nutshell. Questions about the language itself are best asked at kg-construct/rml-questions.