Skip to content

R2RML: triples maps without an explicit rr:TriplesMap type are dropped, and a mapping with zero maps reports "validated" #2038

Open

Description

@aaj3f

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:logicalTable and rr:subjectMap but 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::compile has no check for an empty result
    (loader/mod.rs L90–94).
  • RegisteredMapping::summary returns validated = true for any mapping that compiled, whatever its
    count (graph_source/r2rml.rs L1209–1214).
    The Iceberg, Delta and SQL graph sources all report through it.
  • The validate dry run (validate_r2rml) returns compiled_ok: true with 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

  1. Identify triples maps structurally, as §4.1 requires. Treat any subject, IRI or blank node,
    that has an rr:logicalTable and a subject map (rr:subjectMap or the rr:subject shortcut) as
    a triples map, with or without a type triple. Keep the existing duplicate guards.
  2. Make a mapping that yields zero triples maps an error, at registration and in the validate dry
    run. Materialization already refuses one
    (r2rml_materialize.rs L375–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

  1. added
    bug
    area:iceberg
    on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:icebergbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions