Withdata Software

Parse RDF file and save to PostgreSQL

Want to parse RDF file and save to PostgreSQL ? Want to schedule and automate this importing task?

To import Xml format RDF file (.rdf, .owl) to PostgreSQL, https://www.withdata.com/blog/rdftopostgres/postgresql-import-rdf.html

To import RDF Turtle file (.ttl, .n3) to PostgreSQL, https://www.withdata.com/blog/rdftopostgres/ttl-to-postgresql.html

To import RDF N-Triples file (.nt, .ntriples) to PostgreSQL, https://www.withdata.com/blog/rdftopostgres/n-triples-to-postgresql.html

To import RDF N-Quads file (.nq, .nquads) to PostgreSQL, https://www.withdata.com/blog/rdftopostgres/n-quads-to-postgresql.html

RDF → PostgreSQL reference

Type mapping

Value kindin RDFin PostgreSQL
Int"1234"^^xsd:intinteger
Bigint"9007199254740993"^^xsd:longbigint
Decimal"1234.56"^^xsd:decimalnumeric(p,s)
Float"1.234e10"^^xsd:doubledouble precision
Textplain literal without a datatypevarchar(n)
Long textplain literal; newlines allowed insidetext
Date"2026-09-18"^^xsd:datedate
Datetime"2026-09-18T14:30:00Z"^^xsd:dateTimetimestamp
Binary"base64..."^^xsd:base64Binarybytea
Boolean"true"^^xsd:booleanboolean
JSONa literal, or reified as its own sub-graphjsonb

Dialect differences

RDF is a file format and PostgreSQL is a database server, so the target has to be told the types the file never carried - the rows below are where the two sides diverge.

Propertyin RDFin PostgreSQL
port—5432
identifiersXML attribute quoting; entities for reserved characters"double quotes"
row limit—LIMIT n
datesxsd:dateTime typed literalstimestamp, timestamptz, date, time
long text—TEXT
binaryxsd:base64Binary typed literalsBYTEA
separatorXML elements (rdf:Description / rdf:resource)—
encodingDeclared in the XML declaration—
typingEvery value is a resource or a typed literal—
shapeGraph of triples; there are no rows or columnsTables of rows and columns
ceilingWhole document is usually parsed into memory—

Command line

SideCommand
PostgreSQLpg_dump or COPY ... TO
PostgreSQL (load)COPY ... FROM

Convert your data online, free

Free in-browser converters for CSV, Excel, JSON, XML and SQL: Withdata Online Data Conversion. Large files, batch conversion or scheduling? See the offline desktop apps, or browse all data conversion tools.