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

CHANDAN
1213
accept rate: 0%

edited 30 Jan '13, 15:04

Signified's gravatar image

Signified ♦
23.1k623


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.

link

answered 30 Jan '13, 11:07

lee's gravatar image

lee
3.2k39
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. http://www.topquadrant.com/docs/tbc/AppDevQuickstartGuide/howtospinfunctions.html describes how to do this with TopQuadrant's TopBraid Composer. (Disclaimer: I work for TopQuadrant.)

link

answered 30 Jan '13, 12:51

bobdc's gravatar image

bobdc
3.8k7
accept rate: 14%

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).

link

answered 30 Jan '13, 13:54

Jeen%20Broekstra's gravatar image

Jeen Broekstra ♦
11.3k412
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

link

answered 31 Jan '13, 05:45

Rob%20Vesse's gravatar image

Rob Vesse ♦
13.5k715
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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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

Tags:

×1,159
×95
×5

Asked: 30 Jan '13, 10:45

Seen: 636 times

Last updated: 31 Jan '13, 05:45