Hi Hoan,
You need to bypass the Jena parser which does not understand the Virtuoso
specific "bif:xxx" functions in your query and pass directly to Virtuoso for
execution as detailed in our Jena Provider documentation at:
http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtJenaProvider#Compiling%20Jena%20Sample%20Programs
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 20 Jan 2011, at 08:09, Nguyen Mau Quoc Hoan wrote:
> I was successfully creating RDF Views in Virtuoso,but there are some problem
> when I queried from Java,problem about some spatial function (but It work
> when I query from virtuoso sparql end point)
>
> public class IntersectsExample {
>
> public static void main(String[] args) {
> // TODO Auto-generated method stub
> String url;
> if(args.length==0)
> url="jdbc:virtuoso://localhost:1111";
> else url = args[0];
> VirtGraph graph = new VirtGraph("http://shanghai.com#",url,"dba","dba");
> System.out.println(" define graph.getCount():= " + graph.getCount());
> String qry = "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "+
> "prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> " +
> "prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n "+
> "select ?label ?lat ?long <bif:st_distance>(?geo,?geo_x) as ?distance "+
> "where {"+
> "?x rdfs:label ?label_x."+
> "?x geo:geometry ?geo_x. "+
> "filter regex(?label_x,\"Clybaun\",\"i\"). "+
> "?y rdfs:label ?label. "+
> "?y geo:geometry ?geo;geo:lat ?lat;geo:long ?long "+
> "filter (<bif:st_intersects>(?geo,?geo_x,20))." +
> "} order by ?lat";
> Query sparql = QueryFactory.create(qry);
> VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create(sparql,
> graph);
> ResultSet results = vqe.execSelect();
> ResultSetFormatter.out(System.out, results, sparql);
> }
> }
> The error is: Exception in thread "main"
> com.hp.hpl.jena.query.QueryParseException: Encountered " <IRIref>
> "<bif:st_distance> "" at line 2, column 27.
> Anybody know what error is this?how could I fix it?
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl_______________________________________________
> Virtuoso-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users