Error with direct mapping

I'm trying to generate a direct mapping and it's throwing an IllegalArgument exception. "Template must reference one or more variables: geometry_dump"

I don't believe I've got a column named geometry_dump so I'm assuming it's an internally generated variable. For now I'll just exclude tables until I figure out which one is causing the problem. I'm not really interested in mapping the geom at this point.

ERROR 2019-10-05 09:04:43,219 [stardog-user-1] com.complexible.stardog.virtual.DefaultVirtualGraphRegistry:createVirtualGraph(354): Cannot initialize virtual graph geonames
java.lang.IllegalArgumentException: Template must reference one or more variables: geometry_dump
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:141) ~[guava-26.0-jre.jar:?]
        at com.complexible.stardog.virtual.vega.mapping.UriTemplate.<init>(UriTemplate.java:137) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.vega.mapping.TemplateTermMap.<init>(TemplateTermMap.java:88) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.vega.mapping.MappingGenerator.getSubjectMap(MappingGenerator.java:119) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.vega.mapping.MappingGenerator.generateTriplesMap(MappingGenerator.java:215) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.vega.mapping.MappingGenerator.lambda$generateTriplesMaps$6(MappingGenerator.java:147) ~[stardog-virtual-core-7.0.2.jar:?]
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_222]
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:1.8.0_222]
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_222]
        at com.google.common.collect.CollectSpliterators$1WithCharacteristics.lambda$forEachRemaining$1(CollectSpliterators.java:64) ~[guava-26.0-jre.jar:?]
        at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110) ~[?:1.8.0_222]
        at com.google.common.collect.CollectSpliterators$1WithCharacteristics.forEachRemaining(CollectSpliterators.java:64) ~[guava-26.0-jre.jar:?]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_222]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_222]
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_222]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_222]
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566) ~[?:1.8.0_222]
        at com.complexible.stardog.virtual.vega.mapping.MappingGenerator.generateTriplesMaps(MappingGenerator.java:148) ~[stardog-virtual-core-7.0.2.jar:?]
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_222]
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) ~[?:1.8.0_222]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_222]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_222]
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_222]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_222]
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566) ~[?:1.8.0_222]
        at com.complexible.stardog.virtual.vega.mapping.MappingGenerator.generateTriplesMaps(MappingGenerator.java:160) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsMappings.generateMappings(RdbmsMappings.java:248) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsMappings.parseOrGenerateMappings(RdbmsMappings.java:112) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsMappings.parseOrGenerateMappings(RdbmsMappings.java:107) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsMappings.parseOrGenerateMappings(RdbmsMappings.java:92) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraphFactory.create(RdbmsVirtualGraphFactory.java:80) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraphFactory.create(RdbmsVirtualGraphFactory.java:49) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.createVirtualGraph(DefaultVirtualGraphRegistry.java:351) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.createVirtualGraph(DefaultVirtualGraphRegistry.java:337) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.add(DefaultVirtualGraphRegistry.java:196) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.virtual.SecuredVirtualGraphRegistry.add(SecuredVirtualGraphRegistry.java:146) ~[stardog-virtual-core-7.0.2.jar:?]
        at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.addVG(VirtualGraphHttpService.java:391) ~[stardog-virtual-protocols-http-server-7.0.2.jar:?]
        at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.update(VirtualGraphHttpService.java:202) ~[stardog-virtual-protocols-http-server-7.0.2.jar:?]
        at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-7.0.2.jar:?]
        at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) [shiro-core-1.3.0.jar:1.3.0]
        at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) [shiro-core-1.3.0.jar:1.3.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
ERROR 2019-10-05 09:04:43,230 [stardog-user-1] com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:accept(228): An exception was handled by the server: Template must reference one or more variables: geometry_dump

Are you able to export/share the schema for this db?

Sure can. Some of the tables were creaed by importing some geojson with ogr2ogr tool.

schema.zip (2.1 KB)

Looks like we're picking up types when introspecting the metadata:

\d geometry_dump
        Composite type "public.geometry_dump"
 Column |   Type    | Collation | Nullable | Default 
--------+-----------+-----------+----------+---------
 path   | integer[] |           |          | 
 geom   | geometry  |           |          | 

We ignore other types like sequences, but this is a TYPE. We'll get this fixed. I've created issue #7935.

As a workaround, you can set default.mapping.exclude.tables in your VG config file. The list of PostGIS types is addbandarg,agg_count,agg_samealignment,geometry_dump,geomval,rastbandarg,reclassarg,summarystats,unionarg,valid_detail. Hope this helps.

Jess

Thanks. Another thing I've noticed is that when you export mappings all projections are checked for nullability ie. ...AND field1 IS NOT NULL AND field2 IS NOT NULL ...

It makes it appear as though a mapping with a single NULL field but I don't recall it actually working that way when actually querying a virtual graph for a row containing a filed with a null column.

Thanks, we found that bug and fixed it already. It will be included in the November release.

oh and one last thing, I generated a default mapping without a base specified and it produced resources as if

BASE http://api.stardog.com

and I think I remember the documentation said that it would be virtual://myGraph

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