SQL to RDF Converter
Transform SQL database dumps into RDF (Resource Description Framework) format for semantic web, knowledge graphs, and linked data applications
SQL Input
Convert SQL to other formats
RDF Output
Convert other formats to RDF
Related Tools
SQL to reStructuredText
Convert SQL CREATE TABLE and INSERT statements to reStructuredText table format for Sphinx documentation
SQL to Ruby
Convert SQL CREATE TABLE and INSERT statements to Ruby arrays, hashes, and Struct objects for Rails and Ruby applications
SQL to SQL
Reformat and convert SQL between MySQL, PostgreSQL, SQLite, and SQL Server dialects with batch insert optimization
SQL to Textile
Convert SQL CREATE TABLE and INSERT statements to Textile table markup for Redmine and Textpattern
SQL to TOML
Convert SQL CREATE TABLE and INSERT statements to TOML configuration format for Rust and Python
SQL to TracWiki
Convert SQL CREATE TABLE and INSERT statements to Trac Wiki table markup for project management
About SQL to RDF Converter
Convert SQL database dumps (CREATE TABLE and INSERT statements) to RDF (Resource Description Framework) format with support for Turtle, RDF/XML, and N-Triples serializations. Perfect for semantic web applications, knowledge graphs, and linked data.
Key Features
- Multiple RDF Formats: Turtle (.ttl), RDF/XML (.rdf), N-Triples (.nt)
- Automatic Type Detection: Numeric values → xsd:decimal, URIs → resource references
- Custom Base URI: Configure the base URI for your RDF resources
- W3C Compliant: Generates valid RDF according to W3C standards
- Property Sanitization: Converts column names to valid RDF property names
- Smart Parsing: Extracts column names and data from SQL dumps
- File Download: Save as .ttl, .rdf, or .nt file
How to Use
- Input SQL Data: Paste your SQL CREATE TABLE and INSERT statements or upload a .sql file
- Select RDF Format: Choose between Turtle, RDF/XML, or N-Triples
- Configure Base URI: Set the base URI for your RDF resources
- Copy or Download: Use the Copy or Download button to save your RDF data
RDF Format Options
- Turtle (.ttl): Human-readable, compact syntax with prefixes
- RDF/XML (.rdf): XML-based format for maximum compatibility
- N-Triples (.nt): Simple line-based format, easy to parse
Example Conversion
SQL Input:
CREATE TABLE products ( id INT, name VARCHAR(100), price DECIMAL(10,2) ); INSERT INTO products VALUES (1, 'Laptop', 999.99); INSERT INTO products VALUES (2, 'Mouse', 24.99);
Turtle Output:
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ex: <http://example.org/vocab/> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://example.org/data/record1> ex:id "1"^^xsd:decimal ; ex:name "Laptop" ; ex:price "999.99"^^xsd:decimal . <http://example.org/data/record2> ex:id "2"^^xsd:decimal ; ex:name "Mouse" ; ex:price "24.99"^^xsd:decimal .
Common Use Cases
- Knowledge Graphs: Build semantic knowledge graphs from relational data
- Linked Data: Publish linked open data on the web
- Semantic Web: Create machine-readable data for AI applications
- Triple Stores: Import data into RDF databases (Virtuoso, Jena, Blazegraph)
- SPARQL Queries: Enable semantic queries on your data
- Data Integration: Integrate data from multiple sources
- Ontology Development: Create ontologies from database schemas
Type Detection
The converter automatically determines the appropriate RDF datatype:
- Numeric Values: Converted to xsd:decimal literals
- URIs: Values starting with http:// or https:// become resource references
- Strings: All other values become string literals
- NULL Values: Omitted from RDF output (no triple generated)
RDF Triple Stores
The generated RDF can be imported into:
- Apache Jena: Java-based RDF framework and triple store
- Virtuoso: High-performance RDF database
- Blazegraph: GPU-accelerated graph database
- GraphDB: Enterprise semantic graph database
- Stardog: Knowledge graph platform
- Amazon Neptune: Managed graph database service
Supported SQL Syntax
- CREATE TABLE: Extracts column names for RDF properties
- INSERT INTO: Parses data values for RDF triples
- Data Types: Handles all SQL data types (VARCHAR, INT, DECIMAL, etc.)
- Quoted Strings: Handles single and double quotes with proper escaping
- NULL Values: Skipped in RDF output
Privacy & Security
All conversions happen locally in your browser. Your SQL data is never uploaded to any server, ensuring complete privacy and security.
FAQ
Does this tool publish data to a triple store or SPARQL endpoint?
No. The converter only generates RDF text (Turtle, RDF/XML, or N-Triples) in your browser. You can then copy or download it and manually load it into your preferred triple store or SPARQL endpoint.
How are IRIs for records constructed?
Each row becomes a resource with a URI based on the configured base URI plus a simple suffix like record1, record2, and so on. You can adjust the base URI to match your own namespace.
What RDF datatypes are used?
Numeric-looking values are emitted as xsd:decimal literals, HTTP/HTTPS values are treated as resource IRIs, and everything else becomes a plain string literal.
Can I change property names or vocabularies?
Yes. The generated properties use a simple ex: vocabulary with sanitized column names. You can post-process the output to map them to your own ontology (for example, schema.org, FOAF, or a custom vocabulary).
Is any of my SQL or RDF data sent to a server?
No. All parsing and RDF generation runs locally in your browser. Neither the SQL input nor the generated RDF is transmitted to any remote server.
