Comprehensive examples of parsing CSV, JSON, RDF, and other formats into QualiaDB
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:
name,age,city
Alice Smith,30,New York
Bob Jones,35,Los Angeles
Carol White,28,Chicago
qualia ingest --format csv people.csv people.q42 --mapping "name=ex:name,age=ex:age,city=ex:city"
@prefix ex: .
_: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-LD is the preferred JSON format for semantic data. QualiaDB supports both plain JSON and JSON-LD:
{
"@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
}
]
}
qualia ingest data.jsonld data.q42
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}
]
}
QualiaDB supports multiple RDF serializations:
@prefix ex: .
ex:alice a ex:Person ;
ex:name "Alice" ;
ex:age 30 .
.
"Alice" .
"30"^^ .
Alice
30
"Alice" .
"30"^^ .
# Turtle
qualia ingest data.ttl data.q42
# N-Triples
qualia ingest data.nt data.q42
# RDF/XML
qualia ingest data.rdf data.q42
# N-Quads (with named graphs)
qualia ingest data.nq data.q42
CBOR-LD is QualiaDB's native binary format. It provides the most efficient storage and zero-allocation parsing:
qualia export --format cbor-ld data.q42 data.cborld
qualia ingest data.cborld data.q42
Benchmark results for ingesting a 100K triple dataset (WordNet subset):
| Format | File Size | Ingest Time | Memory Usage |
|---|---|---|---|
| Turtle | 15.2 MB | 2.3s | 45 MB |
| N-Triples | 18.7 MB | 1.8s | 38 MB |
| JSON-LD | 22.1 MB | 3.1s | 52 MB |
| CBOR-LD | 8.4 MB | 0.9s | 28 MB |
| .q42 (Native) | 2.1 MB | 0.0s (mmap) | 12 MB |
* Benchmarks run on 512 MB constraint, measured with native CLI