Hi Sanjeev,

the short answer is that you cannot use nested { ... } blocks in SWP, so the {# SELECT {= ... } } pattern is not supported. Assuming that ?test has the string of an URI as its value when called, you can simply reference the variable, e.g.

{# SELECT ?result WHERE { BIND (get:broader(IRI(?test)) AS ?result) }

In this case, ?test is passed into the query at execution time as a "pre-bound" variable that can be used like any other variable in the usual SPARQL syntax, only that it already has a value beforehand.

(While you are exploring the syntax of SWP, it might be more efficient to use the internal form editor of TBC instead of external .swp files, because you would see errors earlier).

Holger


On 30/08/2018 4:09 AM, Sanjeev Devireddy wrote:
Hi,
    By following the example given in the document, Defining SPARQL Functions with SWP(https://www.topquadrant.com/2013/06/18/defining-sparql-functions-with-swp/) we created a SPARQL function and trying to call it from SWP(.swp file). The function takes an URI of a concept/node of taxonomy as input and return it's children(space separated values).       If the input URI is hard coded in the caller(embedding SPARQL expression of SWP) then it works. But if we try to use a variable through the expression {= ?varaibleName} in the caller(embedding SPARQL expression of SWP) then the SWP file throws org.apache.jena.query.QueryParseException (please find the attachment).

{#
SELECT ?result
    WHERE {
        BIND(get:broader(<{= ?test }>) AS ?result)
    }
}


So we want to understand that what are different ways to call SPARQL functions from SWP and pass dynamic/run-time values as parameters.

Please find attachments for our SPARQL function(get.ui.ttlx) and SWP file(getBroaderConcepts.swp)



Thanks,
Sanjeev
--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "TopBraid 
Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to