Search code examples
graphdbrdf4j

Implement custom RDF4J function for GraphDB


I found in the RDF4J documentation here http://docs.rdf4j.org/custom-sparql-functions/ that it supports creating custom functions with Java.

I attempted to implement this palindrome example and run the example query against GraphDB. I am using the RDF4J java libraries to execute my queries against GraphDB. When executing the query, I get no obvious errors but no results were returned.

Does GraphDB support running custom RDF4J functions? The documentation for RDF4J custom functions states you must place the JAR on your classpath and it will work. What classpath? Can I build it into my project that is executing queries via RDF4J libraries or do I place the custom function JAR on the classpath of GraphDB before I start the server?


Solution

  • In case the graphdb comes as a platform dependent embedded launcher, e.g. .exe, .deb etc. you'll need an additional step.

    Under the installation folder (say GrapDBFree), there is a folder named app. First, place the jar with the custom function within app/lib folder and then, edit the app/GraphDBFree.cfg file by adding the jar to the app.classpath= entry declared there.