Search code examples
sparqlrdfsemantic-webowl

sql to rdf according ot a specific class


I have a database and i want to change it to rdf

for now I just want to change the data from one table to rdf (later I will do the same with the whole database)

i have an access to that table from sql developer, it is an oracle sql table

it has many columns but mainly i am interested in

ID column and name column

so the data is like this:

ID   name
1     oneNameSomething
2     anotherDicName

but the table has 34000 row

is it possible to do sometihng like:

prefix:idValueFromTable    a              SpecificClass .
prefix:idValueFromTable   prefix:hasName  prefix:NameFromTable

i know i can build a tool to do that, but giving a quick search on internet https://www.w3.org/wiki/ConverterToRdf#SQL sound like there are already tools, but i don't know which one works in my case, i thought i ask you first

This page doesn't have the tool https://www.w3.org/TR/r2rml/#overview


Solution

  • For a "one-off" translation, you could just execute an SQL query, and then get the resulting rows, and write output as Turtle or N-Triples. That would probably be the quickest way to get some RDF.

    If you need a more principled approach, and for more than just one table (and with cross referencing between tables), I'd look into some of the tools for mapping relational databases to RDF, such as D2RQ. The mapping schemes are relatively flexible, you can get RDF back without a whole lot of setup.

    To get the data back out, you could use a SPARQL construct query, if you want to precisely control what you get, or (as I just learned from your comment), you can use the dump-rdf tool to get an RDF dump of the database.