Custom function example: Unrecognized function: tag:stardog:api:titleCase

I built the example in stardog-examples/examples/function as-is, then created a JAR file from the compiled code:

jar tvf mark.jar
0 Tue Mar 16 09:36:52 MST 2021 META-INF/
69 Tue Mar 16 09:36:52 MST 2021 META-INF/MANIFEST.MF
0 Tue Mar 16 09:03:34 MST 2021 META-INF/services/
53 Tue Mar 16 09:36:50 MST 2021 META-INF/services/com.complexible.stardog.plan.filter.functions.TitleCase
0 Tue Mar 16 08:48:24 MST 2021 com/
0 Tue Mar 16 08:48:24 MST 2021 com/complexible/
0 Tue Mar 16 08:48:24 MST 2021 com/complexible/stardog/
0 Tue Mar 16 08:48:24 MST 2021 com/complexible/stardog/examples/
0 Tue Mar 16 08:48:24 MST 2021 com/complexible/stardog/examples/functions/
2933 Tue Mar 16 09:09:12 MST 2021 com/complexible/stardog/examples/functions/TitleCase.class

The file main/resources/META-INF/services/com.complexible.stardog.plan.filter.functions.TitleCase looks like:

com.complexible.stardog.examples.functions.TitleCase

I have placed the resulting JAR in several places: directory pointed to by STARDOG_EXT, in server/dbms/ext, and server/pack. I always get the following error:

Unrecognized function: tag:stardog:api:titleCase

Any help will be appreciated.

The services file has to be named after the interface it implements: com.complexible.stardog.plan.filter.functions.Function

You might also want to look at the Google AutoService annotation Google AutoService | Baeldung . I've tried using it in the past but had a couple of times that it did strange things and just updating the service file was easy enough and reliable so it wasn't worth it but you might have a better experience with it.

I did change this back to com.complexible.stardog.plan.filter.functions.Function, as in the Stardog example, but my custom func tion is still not visible in queries.

It's probably some little thing. Did you restart Stardog? STARDOG_EXT should have worked as long as that env var is visible when Stardog is started but 'server/dbms/ext' should just be 'server/ext' and I'm not sure about 'server/pack'

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.