Import RDF to MongoDB collection

Want to parse RDF file and save to MongoDB collection?

Try Withdata FileToMongo, a RDF to MongoDB converter for Windows, MacOS, and Linux, Import RDF to MongoDB, Easy and Fast.

Download Withdata FileToMongo Download FileToMongo

Import RDF file to MongoDB

Click “1 File To 1 Collection” at task dialog.

Import XML data from RDF file To MongoDB - task window

Select “Import File Type” with “XML”, and select “Source File From” with “File”.

import RDF file to MongoDB collection - select type

1. Open RDF file.

import RDF file to MongoDB - open RDF file

2. Config target MongoDB collection.

Load RDF file to MongoDB - config MongoDB collection

3. Preview data will be in MongoDB collection.

Transfer RDF file to MongoDB - summary

4. Import.

Convert RDF file to MongoDB - import to MongoDB

See importing results in MongoDB collection

Store RDF file to MongoDB - view  MongoDB collection

Import RDF to MongoDB in command line

Save “RDF to MongoDB” session, then you can:

Set scheduled tasks for importing RDF to MongoDB

You can schedule and automate this “RDF to MongoDB” conversion task by:

  1. Save session and create .bat (Windows) or .sh (Linux/macOS) file for “RDF to MongoDB” conversion.
  2. Set scheduled task for “RDF to MongoDB” conversion.

More about Withdata FileToMongo – RDF to MongoDB Converter

RDF → MongoDB reference

Type mapping

Value kindin RDFin MongoDB
Int"1234"^^xsd:intNumberInt / int32
Bigint"9007199254740993"^^xsd:longNumberLong / int64
Decimal"1234.56"^^xsd:decimalDecimal128
Float"1.234e10"^^xsd:doubleDouble
Textplain literal without a datatypeString
Long textplain literal; newlines allowed insideString
Date"2026-09-18"^^xsd:dateISODate
Datetime"2026-09-18T14:30:00Z"^^xsd:dateTimeISODate
Binary"base64..."^^xsd:base64BinaryBinData
Boolean"true"^^xsd:booleanBool
JSONa literal, or reified as its own sub-graphEmbedded document or array

Dialect differences

RDF is a file format and MongoDB 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 MongoDB
port—27017
identifiersXML attribute quoting; entities for reserved charactersNo identifier quoting - names are plain strings
row limit—.limit(n) / $limit aggregation stage
datesxsd:dateTime typed literalsISODate() / BSON date (millisecond epoch internally)
long text—String (BSON string, no length limit)
binaryxsd:base64Binary typed literalsBinData (BSON binary subtype)
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 columnsCollections of documents with optional nesting
ceilingWhole document is usually parsed into memory—

Command line

SideCommand
MongoDBmongoexport --collection=c --out=f.json
MongoDB (load)mongoimport --collection=c --file=f.json

FileToMongo without the manual work

For batch jobs, large files and scheduling use the FileToMongo converter — an offline desktop app for Windows, Linux and macOS. Free trial.

New to the format? Read what an RDF file is (and how it maps to rows and columns).