YARRRML¶
YARRRML is a YAML-friendly syntax for RML mappings.
Note
Minimal generator. JSON-first. Good starting point for hand-tuning.
Example Output¶
Given a simple schema:
classes:
Person:
attributes:
id: {identifier: true}
name: {}
The generator produces YARRRML like:
mappings:
Person:
sources:
- - data.json~jsonpath
- $.items[*]
s: ex:$(id)
po:
- p: rdf:type
o: ex:Person
- p: ex:name
o: $(name)
Overview¶
one mapping per LinkML class
prefixes come from the schema
subject from identifier slot (else key; else safe fallback)
po
for class-induced slots (slot aliases respected)emits
rdf:type
as a CURIE (e.g.,ex:Person
)JSON by default:
sources: [[data.json~jsonpath, $.items[*]]]
Command Line¶
linkml generate yarrrml path/to/schema.yaml > mappings.yml
# CSV instead of JSON:
linkml generate yarrrml path/to/schema.yaml --source data.csv~csv
# class-based arrays:
linkml generate yarrrml path/to/schema.yaml --iterator-template "$.{Class}[*]"
Docs¶
CLI¶
gen-yarrrml¶
Generate YARRRML mappings from a LinkML schema.
gen-yarrrml [OPTIONS] YAMLFILE
Options
- --source <source>¶
YARRRML source shorthand, e.g., data.json~jsonpath or data.csv~csv
- --iterator-template <iterator_template>¶
JSONPath iterator template; supports {Class}, default: “$.items[*]”
- -V, --version¶
Show the version and exit.
- -f, --format <format>¶
Output format
- Default:
'yml'
- Options:
yml | yaml
- --metadata, --no-metadata¶
Include metadata in output
- Default:
True
- --useuris, --metauris¶
Use class and slot URIs over model uris
- Default:
True
- -im, --importmap <importmap>¶
Import mapping file
- --log_level <log_level>¶
Logging level
- Default:
'WARNING'
- Options:
CRITICAL | ERROR | WARNING | INFO | DEBUG
- -v, --verbose¶
Verbosity. Takes precedence over –log_level.
- --mergeimports, --no-mergeimports¶
Merge imports into source file (default=mergeimports)
- --stacktrace, --no-stacktrace¶
Print a stack trace when an error occurs
- Default:
False
Arguments
- YAMLFILE¶
Required argument
Code¶
Limitations¶
JSON-first by default
One source per mapping
Classes without an identifier are skipped
Object slots:
inlined: false
→ IRI;inlined: true
→ not materializedIterators not derived from JSON Schema
No per-slot JSONPath overrides
CSV supported via –source