Open nishit26 opened 8 years ago
Try to use the next syntax
`bif:__rdf_long_from_batch_params(??,??,??)`
instead of
\"bif:__rdf_long_from_batch_params(??,??,??)\"
Thanks for the response. I have tried the same as you have mentioned. But this gibes below exception.
PreparedStatementCallback; bad SQL grammar [sparql PREFIX db: http://dbpedia.org/resource/ PREFIX owl: http://www.w3.org/2002/07/owl# select ?subject, ?label WHERE {?subject rdfs:label ?label . Filter(bif:contains(?label, bif:__rdf_long_from_batch_params(??,??,??)
)) .} limit 5]; nested exception is virtuoso.jdbc4.VirtuosoException: SQ074: Line 1: SP030: SPARQL compiler, line 1: syntax error at '`' before 'bif:__rdf_long_from_batch_params'
Caused by: virtuoso.jdbc4.VirtuosoException: SQ074: Line 1: SP030: SPARQL compiler, line 1: syntax error at '`' before 'bif:__rdf_long_from_batch_params'
I am trying to pass search string dynamically in bif:contains function as entered by the user and then search the pattern in DBPedia to get the result. But it is not working at all. The code & stack trace are mentioned in below. Thanks in advance for the help.
String sql = "sparql PREFIX db: http://dbpedia.org/resource/ PREFIX owl: http://www.w3.org/2002/07/owl# select ?subject, ?label WHERE {?subject rdfs:label ?label . Filter(bif:contains(?label, \"
bif:__rdf_long_from_batch_params(??,??,??)
\")) .} limit 5";Trace is as follows
Exception in thread "main" org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [sparql PREFIX db: http://dbpedia.org/resource/ PREFIX owl: http://www.w3.org/2002/07/owl# select ?subject, ?label WHERE {?subject rdfs:label ?label . Filter(bif:contains(?label, "
bif:__rdf_long_from_batch_params(??,??,??)
")) .} limit 5]; nested exception is virtuoso.jdbc4.VirtuosoException: Index 1 is not 1<n<0 at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:98) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:603) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666) at test.web.dao.impl.DbpediaDAOImpl.getDBPediaCategoryForEntity(DbpediaDAOImpl.java:53) at com.news.teststub.TestStub.main(TestStub.java:35) Caused by: virtuoso.jdbc4.VirtuosoException: Index 1 is not 1<n<0 at virtuoso.jdbc4.VirtuosoPreparedStatement.setInt(VirtuosoPreparedStatement.java:412) at test.web.dao.impl.DbpediaDAOImpl.bindValue(DbpediaDAOImpl.java:139) at test.web.dao.impl.DbpediaDAOImpl.access$0(DbpediaDAOImpl.java:119) at test.web.dao.impl.DbpediaDAOImpl$1.setValues(DbpediaDAOImpl.java:55) at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:642) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:587) ... 4 more