Repository navigation
Description
What happens
The loader recognizes a triples map only through an explicit rdf:type rr:TriplesMap triple on an
IRI subject (extractor.rs L42–76).
Two kinds of valid triples map are therefore dropped:
- a map with
rr:logicalTableandrr:subjectMapbut no type triple; - a typed map whose subject is a blank node (
[] a rr:TriplesMap ; …).
R2RML allows both. §4.1: "Explicit typing of the resources in a mapping graph with R2RML classes is
OPTIONAL and has no effect on the behaviour of an R2RML processor", and mapping components may be
given "IRIs or blank node identifiers".
Nothing reports the loss. A mapping that compiles to zero triples maps is reported as validated:
R2rmlLoader::compilehas no check for an empty result
(loader/mod.rsL90–94).RegisteredMapping::summaryreturnsvalidated = truefor any mapping that compiled, whatever its
count (graph_source/r2rml.rsL1209–1214).
The Iceberg, Delta and SQL graph sources all report through it.- The validate dry run (
validate_r2rml) returnscompiled_ok: truewith no diagnostic; there is
no diagnostic code for an empty mapping. - Queries return 0 rows. The only trace is an INFO log line,
triples_maps=0.
$ fluree iceberg map src --mode direct --table-location s3://… --r2rml untyped.ttl …
Tables: 0
Mapping: validated
$ fluree -v query src 'SELECT * WHERE { ?s ?p ?o } LIMIT 5'
INFO … Loaded, compiled, and cached R2RML mapping … triples_maps=0
(0 rows)
Adding a rr:TriplesMap ; to the same map gives Tables: 1 and the expected rows.
Minimal mapping
@base <http://example.org/mapping/> .
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix ex: <http://example.org/> .
<#Customers> rr:logicalTable [ rr:tableName "demo.customers" ] ; # no `a rr:TriplesMap`
rr:subjectMap [ rr:template "http://example.org/customer/{customer_id}" ; rr:class ex:Customer ] .Why it matters
Hand-written mappings, and mappings produced by other tools, often omit type triples, as the spec
allows. The failure looks like missing data, not like an ignored mapping. Fluree's own emitter always
writes a rr:TriplesMap
(emit/render.rs L60),
and every fixture in the repo types its maps, which is likely why no test has caught this.
Proposal
- Identify triples maps structurally, as §4.1 requires. Treat any subject, IRI or blank node,
that has anrr:logicalTableand a subject map (rr:subjectMapor therr:subjectshortcut) as
a triples map, with or without a type triple. Keep the existing duplicate guards. - Make a mapping that yields zero triples maps an error, at registration and in the validate dry
run. Materialization already refuses one
(r2rml_materialize.rsL375–379:
"has no R2RML triples maps").
Seen on v4.2.3. The code is unchanged on main (745736a) and next (0163f78).
Related: #1401 added the Tables: N line and the collision guard, still keyed on the type triple;
#1395 touched the same discovery loop.
See also #2039, the other R2RML loader defect found with the same harness.
Activity