0

I'm looking to put RDF data from DBPedia Turtle (.ttl) files into Postgres. I don't really care how the data is modelled in Postgres as long as it is a complete mapping (it would also be nice if there were sensible indexes), I just want to get the data in Postgres and then I can transform it with SQL from there.

I tried using this StackOverflow solution that leverages Python and sqlalchemy, but it seems to be much too slow (would take days if not more at the pace I observed on my machine).

I expected there might have been some kind of ODBC/JDBC-level tool for this type of connection. I did the same thing with Neo4j in less than an hour using a plugin Neo4j provides.

Thanks to anyone that can provide help.

  • what kind of schema do you use for the triples? Just a single table with s,p,o columns? I mean, what about datatypes? do you care about those are all columns string/varchar? indeed it could be fast if you convert it to CSV and then use a bulk importer of Postgres - but still unclear how you handle the different datatypes properly – UninformedUser Jul 01 '21 at 08:10
  • @UninformedUser In Neo4j the non-trivial datatypes were kept as strings, with a separate attribute with the name of the datatype. That would suffice for me here, as well. So I suppose, s, s_type, p, o, o_type. You offer a solution within your question, which is to [first to write SparQL responses to CSV](https://etl.linkedpipes.com/tutorials/how-to/convert_rdf_to_csv#:~:text=RDF%20can%20be%20transformed%20to,Results%20CSV%20and%20TSV%20Formats.) and then load that CSV using something like `pgcsv`. That could work. I'm still surprised that something more direct does not already exist. – Sebastian Kazenbroot-Guppy Jul 03 '21 at 18:47
  • take a look at https://neo4j.com/labs/neosemantics/ – Tomaž Bratanič Jul 05 '21 at 12:13
  • @Tomaž Bratanič I linked that in the OP—perhaps looking at the source code could help, but I want something simpler than writing a completely bespoke solution. – Sebastian Kazenbroot-Guppy Jul 10 '21 at 17:25

0 Answers0