Can we write our own custom function in SPARQL? If yes, please give one example.

asked 30 Jan '13, 10:45

CHANDAN's gravatar image

accept rate: 0%

edited 30 Jan '13, 15:04

Signified's gravatar image

Signified ♦

There is no standard way to write custom functions in SPARQL.

SPARQL does support the invocation of custom functions (named by URI), however, and many SPARQL implementations, however, provide a way to extend the set of functions that they include.

My company's semantic platform, Anzo, for example, lets you write new SPARQL functions in Java, JavaScript, or by using Excel-like formulas.

permanent link

answered 30 Jan '13, 11:07

lee's gravatar image

accept rate: 37%

SPARQL Inferencing Notation, or SPIN (not a standard, but a W3C member submission) lets you define your own SPARQL functions in SPARQL. describes how to do this with TopQuadrant's TopBraid Composer. (Disclaimer: I work for TopQuadrant.)

permanent link

answered 30 Jan '13, 12:51

bobdc's gravatar image

accept rate: 15%

As lee said, there's no standard way to do this, but many tools have their own way to support creation of custom functions. Sesame, for example, allows you to add custom functions in Java - here's an article that explains how (ObDisclosure: I am on the Sesame development team).

permanent link

answered 30 Jan '13, 13:54

Jeen%20Broekstra's gravatar image

Jeen Broekstra ♦
accept rate: 37%

As others have said SPARQL supports the notion of identifying custom functions with URIs - see Extensible Value Testing in the SPARQL specification

Again echoing others answers how you do this differs from implementation to implementation:

Disclaimer - I am a developer on both the above projects

permanent link

answered 31 Jan '13, 05:45

Rob%20Vesse's gravatar image

Rob Vesse ♦
accept rate: 29%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 30 Jan '13, 10:45

question was seen: 1,914 times

last updated: 31 Jan '13, 05:45