You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@any23.apache.org by "Mattmann, Chris A (3980)" <ch...@jpl.nasa.gov> on 2015/01/31 20:45:27 UTC

Re: a question on CSV to RDF conversion

Dear Cevahir,

Thanks for sending this email I am bringing this to the Any23 list
where I think we will find some answers to the questions below.

Cheers,
Chris

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Chris Mattmann, Ph.D.
Chief Architect
Instrument Software and Science Data Systems Section (398)
NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 168-519, Mailstop: 168-527
Email: chris.a.mattmann@nasa.gov
WWW:  http://sunset.usc.edu/~mattmann/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjunct Associate Professor, Computer Science Department
University of Southern California, Los Angeles, CA 90089 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++






-----Original Message-----
From: Cevahir Demirkiran <ce...@gmail.com>
Date: Friday, January 30, 2015 at 11:36 AM
To: Chris Mattmann <ma...@apache.org>, "dpalmisano@apache.org"
<dp...@apache.org>, "ansell@apache.org" <an...@apache.org>,
"giovanni@apache.org" <gi...@apache.org>, "mostarda@apache.org"
<mo...@apache.org>
Subject: a question on CSV to RDF conversion

>Dear all; 
>
>
>I am writing this email in order to get help concerning conversion of CSV
>to RDF using any23 APIs.
>
>
>First I copy and paste a few lines of code where I am doing the
>conversion and below that I ask some questions.
>
>
>Here is the code I have written for CSV conversion:
>
>
>        String csvUri = "file://ProduceTriples/sample.csv";
>        CSVExtractor extractor =
>                new CSVExtractor();
>
>
>        ExtractionParameters extractionParameters =
>ExtractionParameters.newDefault();
>
>
>        ValueFactoryImpl vf = new ValueFactoryImpl();
>        URI uri = vf.createURI(csvUri);
>        ExtractionContext extractionContext = new
>ExtractionContext("extractor", uri);
>        
>        File file = new File("/ProduceTriples/sample.csv");
>        DataInputStream inpStream = new DataInputStream(new
>BufferedInputStream(new FileInputStream(file)));
>        
>        
>        File file2 = new File("/ProduceTriples/sample.rdf");
>        file2.createNewFile();
>        DataOutputStream outStream = new DataOutputStream(new
>BufferedOutputStream(new FileOutputStream(file2)));
>        NTriplesWriter writer =  new NTriplesWriter(outStream);
>
>
>        ExtractionResultImpl res = new
>ExtractionResultImpl(extractionContext, extractor, writer);
>        extractor.run(extractionParameters, extractionContext, inpStream,
>res);
>        res.close();
>
>
>
>Upon running the above code using the sample input provided in the link:
>http://any23.apache.org/dev-csv-extractor.html
>
>
>I get no output, I mean the outputfile sample.rdf is empty.
>I checked whether there are any issues however I couldn't see anything.
>
>
>I would be extremely thankful in case you could inform me: I have been
>searching the web for some info, however all I can get is the javadoc,
>finally I decided to send an email:
>
>
>1. What is an ExtractionContext? Do I define it above correctly?
>2. Where is the error?
>3. I would actually like to convert entities for example such as :
>
>
>first name, last name, age, address, ...
>Davide; Palmisano; 30; ...
>
>
>
>or 
>
>
>
>
>according to schema.org <http://schema.org> definitions.
>
>
>How am I going to introduce schema.org <http://schema.org> vocabulary
>into conversion configuration? What are the relevant APIs?
>
>
>Is it the URI I put inside the extractionContext? (or this URI is for
>introducing the
>schema.org <http://schema.org> - so context comes from there )
>
>
>
>
>Thank you for your time and your valuable help.
>Once the issue is going to be resolved, I also hope to post it in the
>internet so that more people can get help concerning this.
>
>
>Best Regards;
>Cevahir Demirkiran
>
>
>
>
>
>
>