Skip to content

Extensions

CARML adds two things to RML, in the carml: namespace (http://carml.taxonic.com/carml/). The terms are defined in carml.ttl.

Named input streams

To map data from an InputStream instead of a file, use a carml:Stream source:

@prefix rml:   <http://w3id.org/rml/> .
@prefix carml: <http://carml.taxonic.com/carml/> .

:SomeLogicalSource a rml:LogicalSource ;
  rml:source [ a carml:Stream ; carml:streamName "stream-A" ] ;
  rml:referenceFormulation rml:JSONPath ;
  rml:iterator "$" .

Pass the streams by name when you run the mapping:

mapper.map(Map.of("stream-A", inputStreamA));

A carml:Stream without a carml:streamName is the unnamed stream. Pass it with mapper.map(inputStream), or under the name RmlMapper.DEFAULT_STREAM_NAME together with named streams.

Stream sources are read by the reactive evaluator only.

In the CLI, standard input is the unnamed stream. See the CLI page.

XML namespaces on a source

RML has its own way to declare namespaces for XPath, shown in Data sources. CARML's older carml:declaresNamespace still works, on a file source or a stream:

@prefix rml:   <http://w3id.org/rml/> .
@prefix carml: <http://carml.taxonic.com/carml/> .

rml:logicalSource [ a rml:LogicalSource ;
  rml:source [
    a carml:Stream ;
    carml:declaresNamespace [
      carml:namespacePrefix "ex" ;
      carml:namespaceName "http://www.example.com/books/1.0/" ] ] ;
  rml:referenceFormulation rml:XPath ;
  rml:iterator "/ex:bookstore/*" ] .