data wrangling, context: virtual graph from csv

0 views
Skip to first unread message

PaulZH

unread,
Mar 17, 2016, 4:27:36 AM3/17/16
to Stardog
When my input is a csv file, can I implement similar logic as with rdbms input along the lines of

emp:{"empno"} a emp:Employee ; emp:name "{\"ename\"}" ; emp:role emp:{ROLE} ; emp:department dept:{"deptno"} ; sm:map [ sm:query """ SELECT \"empno\", \"ename\", \"deptno\", (CASE \"job\" WHEN 'CLERK' THEN 'general-office' WHEN 'NIGHTGUARD' THEN 'security' WHEN 'ENGINEER' THEN 'engineering' END) AS ROLE FROM \"EMP\" """ ; ] .

Zachary Whitley

unread,
Mar 17, 2016, 6:45:30 AM3/17/16
to sta...@clarkparsia.com


On Mar 17, 2016, at 4:27 AM, PaulZH <pa...@proxml.be> wrote:

When my input is a csv file, can I implement similar logic as with rdbms input along the lines of

emp:{"empno"} a emp:Employee ; emp:name "{\"ename\"}" ; emp:role emp:{ROLE} ; emp:department dept:{"deptno"} ; sm:map [ sm:query """ SELECT \"empno\", \"ename\", \"deptno\", (CASE \"job\" WHEN 'CLERK' THEN 'general-office' WHEN 'NIGHTGUARD' THEN 'security' WHEN 'ENGINEER' THEN 'engineering' END) AS ROLE FROM \"EMP\" """ ; ] .

I don't believe that you can do that with the Stardog csv mapping but you could easily do it yourself by simply importing the csv into your RDBMS (MySQL has the LOAD DATA INFILE command [1]) and then applying the mapping.

If they did support that I'm guessing this is basically what they'd be doing but I'm guessing that for large files it's much more efficient to stream the input. 

You might want to try importing with a simple mapping then applying your transformations with SPARQL instead of SQL. 

[1] http://dev.mysql.com/doc/refman/5.7/en/load-data.html


--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en
---
You received this message because you are subscribed to the Google Groups "Stardog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.
Reply all
Reply to author
Forward
0 new messages