Hi, actually we have the same issue on 5.0.11.
5.0.9 is ok. Alexandre. 2009/7/6 Alexandre Bertails <[email protected]>: > Hi all, > > we managed to try this snapshot : > ftp://download.openlinksw.com/support/vos/virtuoso-opensource-20090701.tar.gz > > We have some issues with the REGEX function in SPARQL context. Here is > a example: > > ----------------------------------- > > import java.sql.DriverManager; > > import virtuoso.jena.driver.VirtGraph; > import virtuoso.jena.driver.VirtuosoQueryExecutionFactory; > > import com.hp.hpl.jena.query.QueryExecution; > import com.hp.hpl.jena.query.ResultSet; > > public class Main2 { > > public static void main(String[] args) throws Exception { > testVirtGraph("foobar", "oo"); > testVirtGraph("foobar", "ooo"); > testVirtGraph("foobar", ".oo"); > testJDBC("foobar", "oo"); > testJDBC("foobar", "ooo"); > testJDBC("foobar", ".oo"); > } > > public static void testVirtGraph(String value, String regex) { > try { > String query = String.format("SELECT DISTINCT * WHERE { ?s > ?p ?o FILTER regex('%s', '%s') }", value, regex); > System.out.println(query); > VirtGraph graph = new VirtGraph( > "jdbc:virtuoso://localhost:1111", "dba", "dba"); > QueryExecution qe = > VirtuosoQueryExecutionFactory.create(query, graph); > ResultSet rs = qe.execSelect(); > System.out.println("testVirtGraph: " + rs.next()); > } catch (Exception e) { > e.printStackTrace(System.out); > } > System.out.flush(); > } > > public static void testJDBC(String value, String regex) { > String query = String.format("select DB.DBA.RDF_REGEX('%s', > '%s')", value, regex); > System.out.println(query); > try { > java.sql.Connection conn = DriverManager.getConnection( > "jdbc:virtuoso://localhost:1111", "dba", "dba"); > java.sql.ResultSet result = > conn.createStatement().executeQuery(query); > result.next(); > System.out.println("testJDBC: " + result.getString(1)); > } catch (Exception e) { > e.printStackTrace(System.out); > } > System.out.flush(); > } > > } > > ----------------------------------- > > Here is what is printed: > > ----------------------------------- > > SELECT DISTINCT * WHERE { ?s ?p ?o FILTER regex('foobar', 'oo') } > testVirtGraph: ( ?p = > <http://www.openlinksw.com/schemas/virtrdf#qmfShortOfLongTmpl> ) ( ?s > = <http://www.openlinksw.com/virtrdf-data-formats#sql-varchar-uri-fn> > ) ( ?o = < ^{custom-verbatim-1}^_INVERSE (__id2in (^{tree}^))> ) -> > [Root] > SELECT DISTINCT * WHERE { ?s ?p ?o FILTER regex('foobar', 'ooo') } > java.util.NoSuchElementException: class > com.hp.hpl.jena.sparql.engine.ResultSetStream.next > at > com.hp.hpl.jena.sparql.engine.ResultSetStream.nextSolution(ResultSetStream.java:88) > at > com.hp.hpl.jena.sparql.engine.ResultSetStream.next(ResultSetStream.java:98) > at fr.bnf.spar.init.Main2.testVirtGraph(Main2.java:30) > at fr.bnf.spar.init.Main2.main(Main2.java:15) > SELECT DISTINCT * WHERE { ?s ?p ?o FILTER regex('foobar', '.oo') } > java.util.NoSuchElementException: class > com.hp.hpl.jena.sparql.engine.ResultSetStream.next > at > com.hp.hpl.jena.sparql.engine.ResultSetStream.nextSolution(ResultSetStream.java:88) > at > com.hp.hpl.jena.sparql.engine.ResultSetStream.next(ResultSetStream.java:98) > at fr.bnf.spar.init.Main2.testVirtGraph(Main2.java:30) > at fr.bnf.spar.init.Main2.main(Main2.java:16) > select DB.DBA.RDF_REGEX('foobar', 'oo') > testJDBC: 1 > select DB.DBA.RDF_REGEX('foobar', 'ooo') > testJDBC: 0 > select DB.DBA.RDF_REGEX('foobar', '.oo') > testJDBC: 1 > > ----------------------------------- > > Regards, > > Alexandre. >
