Data Format Parsing

Stream RDF and mapped tabular data into verified, portable Q42 volumes.

The RDF → Q42 path

The current RDF importer streams a source directly into a Q42 v3 volume. It can emit machine-readable progress, segment a large result, and use a durable job directory for attested restart and publication.

Open the end-to-end demo
qualia-cli import ./data/example.ttl ./data/example.q42 --job-dir ./jobs/example --progress json
qualia-cli ingest-job status ./jobs/example
qualia-cli q42 verify ./data/example.q42 --level full

CSV Parsing

Ingest writes a unified Q42 v3 volume (Q42\0 header, embedded Q42LEX / BIDX / FIDX / PIDX, LZ4 SuperBlocks). There is no sibling .c.q42 or .q42.lex — compression and lexicon live inside the single .q42.

QualiaDB can ingest CSV files and convert them to semantic triples. Here's how to parse a CSV with person data:

Input CSV (people.csv)

name,age,city
Alice Smith,30,New York
Bob Jones,35,Los Angeles
Carol White,28,Chicago

Conversion Command

qualia-cli ingest csv people.csv --map people-shape.ttl
# writes people.q42 alongside people.csv

Resulting Triples (Turtle)

@prefix ex: <http://example.org/> .

_:row1 a ex:Person ;
    ex:name "Alice Smith" ;
    ex:age 30 ;
    ex:city "New York" .

_:row2 a ex:Person ;
    ex:name "Bob Jones" ;
    ex:age 35 ;
    ex:city "Los Angeles" .

_:row3 a ex:Person ;
    ex:name "Carol White" ;
    ex:age 28 ;
    ex:city "Chicago" .

JSON / JSON-LD Parsing

JSON-LD is the preferred JSON format for semantic data. QualiaDB supports both plain JSON and JSON-LD:

Input JSON-LD (data.jsonld)

{
  "@context": {
    "name": "http://example.org/name",
    "age": "http://example.org/age",
    "knows": "http://example.org/knows"
  },
  "@graph": [
    {
      "@id": "http://example.org/alice",
      "@type": "Person",
      "name": "Alice Smith",
      "age": 30,
      "knows": "http://example.org/bob"
    },
    {
      "@id": "http://example.org/bob",
      "@type": "Person",
      "name": "Bob Jones",
      "age": 35
    }
  ]
}

Conversion Command

qualia-cli import data.jsonld data.q42 --progress text

Plain JSON with Schema

For plain JSON, provide a JSON-LD context to map keys to predicates:

{
  "context": {
    "name": "http://example.org/name",
    "age": "http://example.org/age"
  },
  "data": [
    {"name": "Alice", "age": 30},
    {"name": "Bob", "age": 35}
  ]
}

RDF Format Parsing

QualiaDB supports multiple RDF serializations:

Turtle (.ttl)

@prefix ex: <http://example.org/> .

ex:alice a ex:Person ;
    ex:name "Alice" ;
    ex:age 30 .

N-Triples (.nt)

<http://example.org/alice> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Person> .
<http://example.org/alice> <http://example.org/name> "Alice" .
<http://example.org/alice> <http://example.org/age> "30"^^<http://www.w3.org/2001/XMLSchema#integer> .

RDF/XML (.rdf)

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ex="http://example.org/">
  <rdf:Description rdf:about="http://example.org/alice">
    <rdf:type rdf:resource="http://example.org/Person"/>
    <ex:name>Alice</ex:name>
    <ex:age>30</ex:age>
  </rdf:Description>
</rdf:RDF>

N-Quads (.nq)

<http://example.org/alice> <http://example.org/name> "Alice" <http://example.org/graph1> .
<http://example.org/alice> <http://example.org/age> "30"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/graph1> .

Ingest Commands

# Turtle
qualia-cli import data.ttl data.q42

# N-Triples
qualia-cli import data.nt data.q42

# RDF/XML
qualia-cli import data.rdf data.q42

# N-Quads (with named graphs)
qualia-cli import data.nq data.q42

# remote, resumable, attested import
qualia-cli import data.q42 --url https://example.org/catalog.ttl --job-dir ./jobs/catalog
qualia-cli ingest-job continue ./jobs/catalog

CBOR-LD (Native Format)

CBOR-LD is QualiaDB's native binary format. It provides the most efficient storage and zero-allocation parsing:

Why CBOR-LD?

Import from CBOR-LD

qualia-cli import data.cborld data.q42 --progress json

Q42 is the native durable volume format. Use the Q42 inspection and verification commands below to establish what was written.

Reproducibility and verification

An ingest result is useful only when it can be checked. Keep the input and output together, then use the bounded encoded-set proof rather than treating a size or a legacy XOR result as equivalence.

# inspect the physical Q42 v3 volume
qualia-cli q42 inspect data.q42
qualia-cli q42 verify data.q42 --level full

# prove that the encoded graph agrees with the input within explicit bounds
qualia-cli verify-graph --input data.ttl --dataset data.q42 --memory-mib 32 --temp-gib 24

Publish benchmark figures only with the command, input version, hardware, and raw result artifact. This keeps performance claims comparable and auditable.