# R2RML VirtualGraphIterator

**URL:** https://community.stardog.com/t/r2rml-virtualgraphiterator/742
**Category:** Bug
**Created:** [December 21, 2017, 9:39am UTC](https://community.stardog.com/t/r2rml-virtualgraphiterator/742 "2017-12-21T09:39:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![timmisset](https://avatars.discourse-cdn.com/v4/letter/t/f08c70/32.png) [@timmisset](https://community.stardog.com/u/timmisset)
#### Post date: [December 21, 2017, 9:39am UTC](https://community.stardog.com/t/r2rml-virtualgraphiterator/742/1 "2017-12-21T09:39:08Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)
#### Post date: [December 21, 2017, 5:04pm UTC](https://community.stardog.com/t/r2rml-virtualgraphiterator/742/2 "2017-12-21T17:04:40Z")

</div>

> [@timmisset](#):
>
> 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.

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!

---

<div class="post-metadata">

### Author: ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)
#### Post date: [December 21, 2017, 9:31pm UTC](https://community.stardog.com/t/r2rml-virtualgraphiterator/742/3 "2017-12-21T21:31:30Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![timmisset](https://avatars.discourse-cdn.com/v4/letter/t/f08c70/32.png) [@timmisset](https://community.stardog.com/u/timmisset)
#### Post date: [December 22, 2017, 10:20am UTC](https://community.stardog.com/t/r2rml-virtualgraphiterator/742/4 "2017-12-22T10:20:01Z")

</div>

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
