Trouble creating virtual graph mappings

I'm trying to learn Stardog. I have a toy example with a CSV file. The headers of the CSV are:

  • account_id
  • balance
  • apr
  • credit_limit
  • start_date

I started the Stardog server and created a DB as follows:

stardog-admin db create -n sandboxDB

I added the CSV using:

stardog-admin virtual import sandboxDB accounts.sms accounts.csv

I got the following error:

TEMPLATE() function only allowed in virtual graph mappings.

Here is my SMS file:

prefix account: <>

from CSV {
TO {
    ?account_id a account:Accounts;
        account:balance ?balance;
        account:apr ?apr;
        account:credit_limit ?credit_limit;
        account:start_date ?start_date.
    BIND (template("{account_id}") AS ?account_id)

What am I missing?


Thanks for posting the question. If account_id is a field in the CSV file, you shouldn't also try to BIND() it as a variable in the mapping. Try changing the subject to ?account_iri and your BIND() to bind ?account_iri instead of ?account_id, ie. BIND (template("{account_id}") AS ?account_iri).

The error message is admittedly not very helpful here. We'll log a bug and get that fixed.


Thanks. That seems to have worked. What exactly is the BIND statement doing? Is there some documentation on the Stardog site that explains the templating options available?


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