R2RML VirtualGraphIterator

I receive a nullpointer exception when I run virtual import on a SQLServer database. Using the exact same configuration I can run virtual add and query all the data without any problems.

I run both commands using --format r2rml

I actually discovered what caused the behavior. One of the columns used to create a predicateobject map was called [column] (its a grid position so that name made sense and by using [column] instead of column this works fine in T-SQL and apparently also in the Virtual Add interpreter. I changed the alias to _column and now it can be parsed without problems by the Virtual Import.

java.lang.NullPointerException
at com.complexible.stardog.virtual.VirtualGraphIterator$MaterializationContext.getColumnIndex(VirtualGraphIterator.java:268)
at com.complexible.stardog.virtual.ValueGeneratorFactory.getTermString(ValueGeneratorFactory.java:109)
at com.complexible.stardog.virtual.ValueGeneratorFactory.createValueGenerator(ValueGeneratorFactory.java:47)
at com.complexible.stardog.virtual.VirtualGraphIterator.createValueGenerator(VirtualGraphIterator.java:198)
at com.complexible.stardog.virtual.VirtualGraphIterator.nextMapping(VirtualGraphIterator.java:143)
at com.complexible.stardog.virtual.VirtualGraphIterator.computeNext(VirtualGraphIterator.java:209)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)

Quoting the answer since it's sort of hidden within the question.

Thanks for the report; we'll look into making this better. Glad you were able to figure it out!

Thanks for the bug report. Can you provide a snippet of the query? Which version of Stardog are you using? I’m unable to reproduce the error.

I’m using 5.0.2

Line(s) that caused the error:
rr:predicateObjectMap [ rr:predicate arrayItem:hasColumn; rr:objectMap [rr:column “[column]”]; ];
rr:predicateObjectMap [ rr:predicate arrayItem:hasRow; rr:objectMap [rr:column “[row]”]; ];

Fixed by:
rr:predicateObjectMap [ rr:predicate arrayItem:hasColumn; rr:objectMap [rr:column “_column”]; ];
rr:predicateObjectMap [ rr:predicate arrayItem:hasRow; rr:objectMap [rr:column “_row”]; ];
And of course by changing the SQL view to output _column and _row