Skip to content

Bulk import's TriG reader rejects [ … ], ( … ) and bare { … } blocks that insert accepts #1930

Open

Description

@bplatz

Problem

Bulk import refuses valid TriG that a TriG insert or /upsert of the same document accepts. Inside a GRAPH block it rejects an anonymous blank node [ … ] and a collection ( … ), and it rejects a bare { … } block. For example, importing

@prefix ex: <http://example.org/> .
GRAPH <urn:example:tools> {
  ex:search ex:name "search" ;
    ex:param [ ex:name "q" ; ex:required true ] .
}

fails with Parse error: expected object, found '['. The same triples load as plain Turtle, and since #2008 the transaction write paths (TriG insert, /upsert, graph sync, graph insert) load them inside a block too, so this issue is now about bulk import alone.

This matters for loading tool specs and ontologies exported by other RDF tools, which routinely use [ … ] and ( … ) inside graph blocks.

Cause

Bulk import still reads TriG with its own block parser, parse_trig_phase1 in fluree-db-transact/src/parse/trig_meta.rs. It has no arm for [ or (, and no bare-block case. The transaction write paths moved off it in #2008, onto the locator and segment parser in fluree-db-transact/src/parse/rdf_text/, which hands each block's tokens to the full Turtle parser.

Fix

Move bulk import onto the same rdf_text locator and segment parser, so a file imported and the same file inserted are read identically. That reader already handles what a ledger write needs: the <#txn-meta> block, graph names kept as written, and blank-node labels scoped to the whole document.

We chose it over the document reader Dialect::TriG (behind rdf::parse and fluree.parse, #2042) because import's job is to store what an insert of the file would store. The two readers share the Turtle parser and differ only in how they find blocks and what they refuse.

parse_trig_phase1 is also used by testsuite-sparql's result reader, so it may stay for that.

Related: #1849, #2008, #2042.

Activity

  1. added
    bug
    P2
    area:transact
    on Sep 25, 2026
  2. added a commit that references this issue on Oct 4, 2026
  3. changed the title [-]TriG GRAPH blocks reject anonymous blank nodes [ … ] on /upsert and import[/-] [+]Bulk import's TriG reader rejects [ … ], ( … ) and bare { … } blocks that insert accepts[/+] on Oct 13, 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

    P2area:transactbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions