Skip to content

r2rml: subject, predicate and object maps accept several value sources and silently pick one #1799

Open

Description

@bplatz

Discovered during the review of #1581, which added the exactly-one-value-source check for graph maps only; kept out of that PR to keep it scoped.

R2RML: a term map MUST be exactly one of constant-valued, column-valued, or template-valued. The extractor (fluree-db-r2rml/src/loader/extractor.rs) does not enforce this for subject, predicate, or object maps, so a mapping that states more than one is accepted and one source is chosen silently:

term map what the extractor does who picks
subject map sets template, column, constant independently materializer materialize_subject_from_batch: constant, then column, then template; the query path reads subject_map.template first (rewrite.rs, operator.rs)
predicate map first match wins extractor order: constant, template, column
object map first match wins extractor order: column, constant, template

The subject-map row is the one with teeth: with both rr:template and rr:column present, the materializer mints subjects from the column while the virtual path plans against the template, so the same mapping can yield different subjects on the two lanes. The other two are silent first-wins on a malformed mapping.

Fix sketch

  • Count the value sources per term map and refuse more than one with R2rmlError::InvalidValue naming the property, the same shape as extract_graph_map after feat(r2rml): refuse the graph-map constructs the materializer cannot honor #1581.
  • One message-asserting test per term map, plus an accepted-shape test, and delete each guard once to confirm its test catches it.
  • Check the repo's own fixtures and docs examples load under the stricter rule before merging.

Activity

  1. added
    bug
    P3
    area:iceberg
    on Sep 6, 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

    P3area:icebergbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions