Re: [Virtuoso-users] VSP and Sparql use VPL variables in query.

2009-11-30 Thread Ivan Mikhailov
Lourens > 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. } ?

Re: [Virtuoso-users] VSP and Sparql use VPL variables in query.

2009-11-30 Thread Lourens van der Meij
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

Re: [Virtuoso-users] VSP and Sparql use VPL variables in query.

2009-11-30 Thread Ivan Mikhailov
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() con

[Virtuoso-users] VSP and Sparql use VPL variables in query.

2009-11-29 Thread Lourens van der Meij
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 {

Re: [Virtuoso-users] VSP and Sparql

2009-11-28 Thread Ivan Mikhailov
Hello Lourens, > FOR (sparql select ?labl (lang(?labl)) where {$:subject > skos:prefLabel ?labl}) DO { >^^ HOW DO I GET THE > lang(?labl) VALUE? The syntax is FOR (sparql select ?labl (lang(?labl)) as ?lang_of_labl where ... ) DO and

Re: [Virtuoso-users] VSP and Sparql

2009-11-28 Thread Aldo Bucchi
Hi Lourens, In general, when you run any sort of function ( aggregate, built-in, etc ) in the projection part of the query you should also define an alias for the variable using AS {varName} select count(?s) as ?count_s ... select ?s lang(?label) as ?lang ?p ?o for example: select ?s ?label

[Virtuoso-users] VSP and Sparql

2009-11-28 Thread Lourens van der Meij
I am trying to get the hang of VSP and am currently a bit stuck on getting info from sparql queries in FOR constructs. Named variables are ok, but how do I get select (lang(?label)) count(..) ... values? A part of my VSP code(I got '$:subject' from a surrounding "FOR (sparql select .."): http: