Virtual Graph CSV Import

I'd really appreciate some help with this please. I'm trying to load a CSV into a Virtual Graph, and failing with this error message: Invalid variable: "ID"

My CSV, named Person.csv, is:

Type,ID,Title,First Name,Last Name,Job Title,Organization
Person,121627870,Mr,Tony,McTony,Data Scientist,
Person,155342734,,John,Smith,Data architect,

My mapping file, named person_csv_VG.ttl, is:

@prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# .
@prefix xsd: http://www.w3.org/2001/XMLSchema# .
@prefix person: http://example.com/person/ .
@prefix sm: tag:stardog:api:mapping: .

person:{"ID"} a person:Person ;
person:title "{"Title"}" ;
person:firstName "{"First Name"}" ;
person:lastName "{"Last Name"}" ;
person:jobTitle "{"Job Title"}" ;
person:organization "{"Organization"}" ;
sm:map [
sm:table "Person" ;
] .

My run command is:

stardog-admin virtual import py_VG1_DB C:\stardog-5.3.0\person_csv_VG.ttl C:\stardog-5.3.0\Person.csv

Many thanks for any guidance on what I'm doing wrong.

Hi,

For CSV imports I do not believe you need to quote your headings (unless the heading in the CSV itself is quoted), so your mapping file would look like:

person:{ID} a person:Person ;
  person:title "{Title}" ;
  ...
1 Like

Bang on. Thanks very much indeed. My mapping file now looks like this and it works:

@prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# .
@prefix xsd: http://www.w3.org/2001/XMLSchema# .
@prefix person: http://example.com/person/ .
@prefix sm: tag:stardog:api:mapping: .

person:{ID} a person:Person ;
person:title "{Title}" ;
person:firstName "{First Name}" ;
person:lastName "{Last Name}" ;
person:jobTitle "{Job Title}" ;
person:organization "{Organization}" ;
sm:map [
sm:table "Person" ;
] .

Thanks Stephen.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.