%META:TOPICPARENT{name="VirtTipsAndTricksGuide"}% ---+ Are custom SPARQL extension functions supported? How can I use them? Virtuoso supports two ways to write one's own custom [[http://www.w3.org/TR/rdf-sparql-query/#extensionFunctions][SPARQL extension functions]]: %TOC% ---++ Use a Stored Procedure You can create a SQL stored procedure in Virtuoso PL and, call it using the sql: prefix: SQL> CREATE PROCEDURE testfunc() { -- your code here } ; Done; SQL> SPARQL SELECT * WHERE { ?s ?p `sql:testfunc(?o)` }; For more details see [[http://docs.openlinksw.com/virtuoso/rdfsparql.html#rdfsqlfromsparql][Calling SQL from SPARQL]] Virtuoso Documentation. ---++ Create a built-in function You can also make a built-in function, which is basically a C function that can be called from both SQL and SPARQL, as in the example from below, using the bif: prefix. In this SPARQL example, we use the CONTAINS function to do a freetext search on all ?o that contain words starting with "Timo". SELECT * FROM WHERE { ?s ?p ?o . ?o bif:contains '"Timo*"' } For more details see [[http://docs.openlinksw.com/virtuoso/sparqlextensions.html#rdfsparqlrulefulltext][Using Full Text Search in SPARQL]] Virtuoso Documentation. This feature also allows you to use relevant functions from the [[http://docs.openlinksw.com/virtuoso/functions.html][Virtuoso SQL Functions Guide]] inside a SPARQL query. ---++ Related * [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]] * [[http://docs.openlinksw.com/virtuoso/sparqlextensions.html][Virtuoso Documentation]]