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



Reply via email to