Hi Lourens,

This problem in the JDBC Driver has been resolved:

$ /usr/bin/java -classpath "../../libsrc/JDBCDriverType4/virtjdbc4.jar:." 
TestRegex
##### exec query regex without i###############
Running query:
sparql PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
SELECT ?value from <gr> 
WHERE {<http://id> skos:prefLabel ?value. FILTER regex(str(?value),"test")}
 ============= < ROW > ============ 
VirtuosoRdfBox:[rdf=test eng1;type=null;lang=nl] ==> [test eng1]
got 1 results
##### exec query regex with i###################
Running query:
sparql PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
SELECT ?value from <gr> 
WHERE {<http://id> skos:prefLabel ?value. FILTER regex(str(?value),"test","i")}
 ============= < ROW > ============ 
VirtuosoRdfBox:[rdf=test eng1;type=null;lang=nl] ==> [test eng1]
got 1 results

You can download the patched drivers for JDBC 3 or 4 from the following 
locations to test:

        ftp://download.openlinksw.com/support/vos/virtjdbc4.jar
        ftp://download.openlinksw.com/support/vos/virtjdbc3.jar

Please let us know if this now provides the expected behaviour for you ...

Best Regards
Hugh Williams
Professional Services
OpenLink Software
Web: http://www.openlinksw.com
Support: http://support.openlinksw.com
Forums: http://boards.openlinksw.com/support
Twitter: http://twitter.com/OpenLink

On 17 Dec 2009, at 10:12, Lourens van der Meij wrote:

> Thanks, and especially thanks for the warning.
> 
> This does mean that I really do need the regex alternative, so having a 
> patch/solution for my
> problem of non-functioning filter regex(str(?l),"query","i") through 
> jdbc is still urgent to me.
> 
> (For later when I have time to switch to VPL, a function returning the 
> number of matching keywords in the text-index per
> query so given 'AB*' how many keywords are there would be useful e.g. 
> allowing to reformulate user queries containing
> multiple words.)
> 
> Lourens
> 
> Hugh Williams wrote:
>> Hi Lourens,
>> 
>> Note, this limit is hard coded as a define in ~/libsrc/Wi/text.h of the open 
>> source archive :
>> 
>> #define WST_WILDCARD_MAX 1000
>> 
>> So you would need to increase this to a suitable value and recompile the 
>> Virtuoso binary for it to take effect. Note setting this value too high will 
>> make the execution of free text queries inefficient, consider having words 
>> 'ABC', 'ABD', 'ABE' and wildcard 'AB*'  which in practice will be 
>> transformed to ABC OR ABD OR ABE , thus if  each of these returns a large 
>> number of matches the "OR"'ed list could become very long and thus rather 
>> inefficient/slow. We may consider making this a configurable option with an 
>> upper limit in the virtuoso.ini file in a future release.
>> 
>> Best Regards
>> Hugh Williams
>> Professional Services
>> OpenLink Software
>> Web: http://www.openlinksw.com
>> Support: http://support.openlinksw.com
>> Forums: http://boards.openlinksw.com/support
>> Twitter: http://twitter.com/OpenLink
>> 
>> On 15 Dec 2009, at 18:02, Lourens van der Meij wrote:
>> 
>> 
>>> Hugh Williams wrote:
>>> 
>>>> Hi Lourens,
>>>> 
>>>> This issue has not been resolved in the latest version, I have asked 
>>>> development to schedule to look into this. In terms of work arounds I am 
>>>> not sure how easily this can be done given the issue is only with case 
>>>> sensitive matches. Virtuoso does have its own bif:contains function for 
>>>> Free Text search, as detailed at:
>>>> 
>>>>    
>>>> http://docs.openlinksw.com/virtuoso/rdfsparqlrulefulltext.html#rdfsparqlrulefulltext
>>>> 
>>>> Which may be of use if you have not seen it already ?
>>>> 
>>>> 
>>> Thanks Hugh for your answer and for asking development to look at it.
>>> 
>>> I use bif:contains at other places,  but bif:contains has its own issue 
>>> that it cannot deal with result sets that match over 1000 keywords.
>>> (and I suppose it would be awkward from within sparql to determine that 
>>> the match is at the start of the literal)
>>> I  need a FILTER regex(?l, "^a","i")
>>> 
>>> ?l bif:contains "a*" would  return an error because there are more than
>>> 1000 keywords in the index set of "a*" in my database.
>>> 
>>> Lourens
>>> 
>>> 
>>>> Best Regards
>>>> Hugh Williams
>>>> Professional Services
>>>> OpenLink Software
>>>> Web: http://www.openlinksw.com
>>>> Support: http://support.openlinksw.com
>>>> Forums: http://boards.openlinksw.com/support
>>>> Twitter: http://twitter.com/OpenLink
>>>> 
>>>> On 15 Dec 2009, at 10:25, Lourens van der Meij wrote:
>>>> 
>>>> 
>>>> 
>>>>> The problem with regex "i" not working through JDBC is still giving me 
>>>>> problems. In the long run I hope
>>>>> we will be able to stop using JDBC, but now we really need the 
>>>>> functionality.
>>>>> Could it be that the problem has been solved in a recent version?
>>>>> I do notice that the problem does not occur when accessing Virtuoso 
>>>>> through VSP.
>>>>> 
>>>>> If the problem has not been solved could you point me to a work-around? I 
>>>>> am not fluent in
>>>>> the internals of Virtuoso, but I suspect that it should be possible to 
>>>>> define a stored procedure
>>>>> that does the sparql call and that I could call that procedure through 
>>>>> jdbc?
>>>>> I seem to remember that it should even be possible to call a user defined 
>>>>> stored procedure from within sparql.
>>>>> Then, would it be possible to define such a procedure that does the 
>>>>> regex(?l,String,"i") without the bug?
>>>>> 
>>>>> 
>>>>> Thanks,
>>>>> 
>>>>> Lourens
>>>>> 
>>>>> Hugh Williams wrote:
>>>>> 
>>>>> 
>>>>>> Hi Lourens,
>>>>>> 
>>>>>> We have been able to recreate this issue in-house with the sample 
>>>>>> program you provided and are looking into it.  I shall report back when 
>>>>>> an update is available ...
>>>>>> 
>>>>>> Best Regards
>>>>>> Hugh Williams
>>>>>> Professional Services
>>>>>> OpenLink Software
>>>>>> Web: http://www.openlinksw.com
>>>>>> Support: http://support.openlinksw.com
>>>>>> Forums: http://boards.openlinksw.com/support
>>>>>> Twitter: http://twitter.com/OpenLink
>>>>>> 
>>>>>> On 7 Nov 2009, at 19:11, Lourens van der Meij wrote:
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> Hi,
>>>>>>> I am having the following problem:
>>>>>>> Using the latest 5.0.12 version I do:
>>>>>>> sparql insert into graph <gr> { <http://id>
>>>>>>> <http://www.w3.org/2004/02/skos/core#prefLabel> 'test eng1'@nl .}
>>>>>>> sparql PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
>>>>>>> SELECT ?value from <gr>
>>>>>>> WHERE {<http://id> skos:prefLabel ?value. FILTER
>>>>>>> regex(str(?value),"test","i")}
>>>>>>> 
>>>>>>> through the jdbc4 driver from java and I get no results when expecting 
>>>>>>> them.
>>>>>>> 
>>>>>>> The query without the "i" argument does give the correct result.
>>>>>>> 
>>>>>>> I get the correct result with the "i" option when testing through isql
>>>>>>> and the 8890/sparql connection.
>>>>>>> 
>>>>>>> I add the java code illustrating this problem:
>>>>>>> 
>>>>>>> On my installation the first query gives 1 result.
>>>>>>> The second query gives 0 results.
>>>>>>> 
>>>>>>> Could you tell me what is wrong?
>>>>>>> 
>>>>>>> Thanks,
>>>>>>> 
>>>>>>> Lourens
>>>>>>> 
>>>>>>> ==============TestRegex.java========================
>>>>>>> import java.sql.*;
>>>>>>> import virtuoso.jdbc4.*;
>>>>>>> 
>>>>>>> public class TestRegex {
>>>>>>>     public static void main(String argv[]) {
>>>>>>>         try {
>>>>>>>             String urlDB =
>>>>>>> "jdbc:virtuoso://localhost:1111/charset=UTF-8";
>>>>>>>             Class.forName("virtuoso.jdbc4.Driver");
>>>>>>>             Connection conn =
>>>>>>> DriverManager.getConnection(urlDB,"dba","dba");
>>>>>>> 
>>>>>>>             Statement st = conn.createStatement();
>>>>>>>             st.execute("sparql clear graph <gr>");
>>>>>>>             st.execute("sparql insert into graph <gr> { <http://id>
>>>>>>> <http://www.w3.org/2004/02/skos/core#prefLabel> 'test eng1'@nl .}");
>>>>>>>             System.out.println("##### exec query regex without
>>>>>>> i###############");
>>>>>>>             String query1 = "sparql PREFIX skos:
>>>>>>> <http://www.w3.org/2004/02/skos/core#> \nSELECT ?value from <gr> \nWHERE
>>>>>>> {<http://id> skos:prefLabel ?value. FILTER 
>>>>>>> regex(str(?value),\"test\")}";
>>>>>>>             System.out.println("Running query:\n"+query1);
>>>>>>>             execQuery(st,query1);
>>>>>>>             System.out.println("##### exec query regex with
>>>>>>> i###################");
>>>>>>>             String query2 = "sparql PREFIX skos:
>>>>>>> <http://www.w3.org/2004/02/skos/core#> \nSELECT ?value from <gr> \nWHERE
>>>>>>> {<http://id> skos:prefLabel ?value. FILTER
>>>>>>> regex(str(?value),\"test\",\"i\")}";
>>>>>>>             System.out.println("Running query:\n"+query2);
>>>>>>>             execQuery(st,query2);
>>>>>>>             conn.close();
>>>>>>>         } catch (Exception e) {
>>>>>>>             System.out.println(e);
>>>>>>> 
>>>>>>> System.out.println("===========================================================");
>>>>>>>  
>>>>>>>             e.printStackTrace();
>>>>>>>         }
>>>>>>>     }
>>>>>>> 
>>>>>>> 
>>>>>>>   public static void execQuery(Statement st, String query) throws
>>>>>>> SQLException
>>>>>>>   {
>>>>>>>       ResultSet rs;
>>>>>>>       ResultSetMetaData rsmd;
>>>>>>> 
>>>>>>>       rs = st.executeQuery(query);
>>>>>>>       rsmd = rs.getMetaData();
>>>>>>>       if (rsmd == null) System.out.println("getMetaData() == NULL");
>>>>>>>       int results = 0;
>>>>>>>       while(rs.next()) {
>>>>>>>           Object o;
>>>>>>> 
>>>>>>>           System.out.println(" ============= < ROW > ============ ");
>>>>>>>           for (int i = 1; i <= rsmd.getColumnCount(); i++) {
>>>>>>>               results++;
>>>>>>>               String s = rs.getString(i);
>>>>>>>               o = rs.getObject(i);
>>>>>>>               if (rs.wasNull())
>>>>>>>                   System.out.println(i+" ==> NULL");
>>>>>>>               else
>>>>>>>               {
>>>>>>>                   if (o instanceof VirtuosoExtendedString)
>>>>>>>                   {
>>>>>>>                       VirtuosoExtendedString vs =
>>>>>>> (VirtuosoExtendedString)o;
>>>>>>>                       System.out.print("VirtuosoExtendedString:
>>>>>>> [iri="+vs.iriType+"]");
>>>>>>>                   }
>>>>>>>                   else if (o instanceof VirtuosoRdfBox)
>>>>>>>                   {
>>>>>>>                       VirtuosoRdfBox rb = (VirtuosoRdfBox)o;
>>>>>>>                       System.out.print("VirtuosoRdfBox:[rdf="+rb+";
>>>>>>> type="+rb.getType()+";lang="+rb.getLang()+"]");
>>>>>>>                   }
>>>>>>>                   else
>>>>>>>                   {
>>>>>>>                       System.out.print("      |");
>>>>>>>                       System.out.print(""+o.getClass()+"|");
>>>>>>>                   }
>>>>>>>                   System.out.println(" ==> ["+ o + "]");
>>>>>>>               }
>>>>>>>           }
>>>>>>>       }
>>>>>>>       System.out.println("got "+results + " results");
>>>>>>>   }
>>>>>>> }
>>>>>>> 
>>>>>>> ------------------------------------------------------------------------------
>>>>>>>  
>>>>>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 
>>>>>>> 30-Day
>>>>>>> trial. Simplify your report design, integration and deployment - and 
>>>>>>> focus on
>>>>>>> what you do best, core application coding. Discover what's new with
>>>>>>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>>>>>> _______________________________________________
>>>>>>> Virtuoso-users mailing list
>>>>>>> Virtuoso-users@lists.sourceforge.net
>>>>>>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>>>>>>> 
>>>>>>> 
>>>> 
>>> ------------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Verizon Developer Community
>>> Take advantage of Verizon's best-in-class app development support
>>> A streamlined, 14 day to market process makes app distribution fast and easy
>>> Join now and get one step closer to millions of Verizon customers
>>> http://p.sf.net/sfu/verizon-dev2dev 
>>> _______________________________________________
>>> Virtuoso-users mailing list
>>> Virtuoso-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>>> 
>> 
>> 
> 
> 
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> _______________________________________________
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users


Reply via email to