Template must reference one or more variables: http://api.stardog.com/db_table/?c_id={?c_id}

Hi Team,

I am trying to generate virtual graph using command:
stardog-admin virtual add db.properties

and I am getting an error saying:
Template must reference one or more variables: http://api.stardog.com/db_table/?c_id={?c_id}

Also, as per the logs error says:
ERROR 2019-06-23 18:43:41,227 [stardog-user-28] com.complexible.stardog.virtual.DefaultVirtualGraphRegistry:createVirtualGraph(312): Cannot initialize virtual graph legal_db
java.lang.IllegalArgumentException: Template must reference one or more variables: http://api.stardog.com/db_table/c_id={c_id}
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:141) ~[guava-26.0-jre.jar:?]
at com.complexible.stardog.virtual.vega.mapping.UriTemplate.(UriTemplate.java:137) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.vega.mapping.TemplateTermMap.(TemplateTermMap.java:88) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.vega.mapping.MappingGenerator.getSubjectMap(MappingGenerator.java:126) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.vega.mapping.MappingGenerator.generateTriplesMap(MappingGenerator.java:205) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.vega.mapping.MappingGenerator.lambda$generateTriplesMaps$6(MappingGenerator.java:141) ~[stardog-virtual-core-6.1.2.jar:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_131]
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:1.8.0_131]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_131]
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_131]
at com.google.common.collect.CollectSpliterators$1WithCharacteristics.forEachRemaining(CollectSpliterators.java:64) ~[guava-26.0-jre.jar:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_131]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_131]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_131]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_131]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_131]
at com.complexible.stardog.virtual.vega.mapping.MappingGenerator.generateTriplesMaps(MappingGenerator.java:142) ~[stardog-virtual-core-6.1.2.jar:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_131]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) ~[?:1.8.0_131]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_131]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_131]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_131]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_131]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_131]
at com.complexible.stardog.virtual.vega.mapping.MappingGenerator.generateTriplesMaps(MappingGenerator.java:154) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.vega.rdbms.RdbmsMappings.generateMappings(RdbmsMappings.java:246) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.vega.rdbms.RdbmsMappings.parseOrGenerateMappings(RdbmsMappings.java:112) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.vega.rdbms.RdbmsMappings.parseOrGenerateMappings(RdbmsMappings.java:107) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.vega.rdbms.RdbmsMappings.parseOrGenerateMappings(RdbmsMappings.java:92) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraphFactory.create(RdbmsVirtualGraphFactory.java:76) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraphFactory.create(RdbmsVirtualGraphFactory.java:44) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.createVirtualGraph(DefaultVirtualGraphRegistry.java:309) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.createVirtualGraph(DefaultVirtualGraphRegistry.java:295) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.add(DefaultVirtualGraphRegistry.java:169) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.virtual.SecuredVirtualGraphRegistry.add(SecuredVirtualGraphRegistry.java:133) ~[stardog-virtual-core-6.1.2.jar:?]
at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.addVG(VirtualGraphHttpService.java:344) ~[stardog-virtual-protocols-http-server-6.1.2.jar:?]
at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.add(VirtualGraphHttpService.java:144) ~[stardog-virtual-protocols-http-server-6.1.2.jar:?]
at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-6.1.2.jar:?]
at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) [shiro-core-1.2.3.jar:1.2.3]
at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) [shiro-core-1.2.3.jar:1.2.3]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_131]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
ERROR 2019-06-23 18:43:41,229 [stardog-user-28] com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:accept(232): An exception was handled by the server: Template must reference one or more variables: http://api.stardog.com/db_table/c_id={c_id}

I went through some old topics and tried adding
query.translation=legacy
percent.encode=true
But it did not help.
Kindly help me with the same.

Can you share your mapping file?

I am not using any mapping file. I am adding the db using properties file:

jdbc.url=jdbc:mysql://localhost/db
jdbc.username=root
jdbc.password=*****
jdbc.driver=com.mysql.jdbc.Driver

When I copy/paste the template ( http://api.stardog.com/db_table/c_id={c_id} ) into an editor I see it is expanded to show that the c_id field name has a leading byte-order mark: ( http://api.stardog.com/db_table/\uFEFFc_id={\uFEFFc_id} ).

Could you share any details about the configuration of your MySQL database? DB version, driver version, schema default charset, server platform (Linux, Windows, etc), anything else that might affect character encoding / Unicode handling.

Thanks,
-Paul

I am using MySQL workbench 6.3 Community edition,
connector: mysql-connector-java-5.1.25 Later on moved to mysql-connector-java-8.0.8-dmr that also did not help
Platform: Windows 10
Collation - UTF-8 default

Thank you!

I saw your other message about CSV files with byte-order markers. Does that mean this issue is resolved as well?

Yes, the issue is resolved! I am sorry i had by mistake replied on some other post.
So i was creating the db using csv files which were of format WTF 8- BOM and changing them to UTF-8 resolved the issue.
Apologies for the miscommunication
Thank you!

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