Thanks, Ivan.

My first intuition would say that a sparql query containing

{ _:hidden_bnode skos:prefLabel ?v1_lab .
 FILTER (_:hidden_bnode = iri(?:_uri)) }

could be inefficient. Will Virtuoso internally optimize this into a query
equivalent to { $:some_uri skos:prefLabel ?v1_lab. } ?

Lourens

Ivan Mikhailov wrote:
Lourens,

I gues that this will work:

CREATE PROCEDURE VAS_PROPERTY_LABEL (in _uri varchar) {
for (sparql select ?v1_lab where { `iri(?:_uri)` skos:prefLabel ?v1_lab}) do {
           RETURN "v1_lab";
        }
    RETURN _uri;
}

Colon in ?:_uri indicates an external variable, iri() converts a string
(that is a literal) into an IRI reference, backquotes around iri(...)
are syntax syntax so
{ `iri(?:_uri)` skos:prefLabel ?v1_lab}
is equivalent to
{ _:hidden_bnode skos:prefLabel ?v1_lab .
  FILTER (_:hidden_bnode = iri(?:_uri)) }

Best Regards,

Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com

On Sun, 2009-11-29 at 20:29 +0100, Lourens van der Meij wrote:
Thanks for solving my previous problem. Next, I am looking at creating procedures.
I somehow do not manage to use VPL variables in sparql queries:
CREATE PROCEDURE VAS_PROPERTY_LABEL (in _uri varchar) {
for (sparql select ?v1_lab where { _uri skos:prefLabel ?v1_lab}) do {
                                                          ^^^^^
           RETURN "v1_lab";
        }
    RETURN _uri;
}
Can I use VPL variables in sparql queries in procedures?
(I know how to include "sql"-variables using $: but that does not seem to be working here)

Are there  examples specific to sparql VPL mixing available somewhere?

Thanks,

Lourens


------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/virtuoso-users



Reply via email to