function returning multiple values

9 views
Skip to first unread message

D063520

unread,
Apr 23, 2021, 9:59:38 AM4/23/21
to RDF4J Users
Hello,

I hope this is the right place (if not, I'm happy to be redirected to the right one ; ) ). I want to implement a function like:


Spin is deprectated and I think my problem is more general: "how to I implement a function that returns multiple values" like the Split function. In the documentation:


this is not really described. I thought I should implement a TupleFunction instead of a Function and put the name in META-INF/services/org.eclipse.rdf4j.query.algebra.evaluation.function.TupleFunction. But the function is not seen. Not sure if this should work or maybe only work in combination with spin which is deprecated.

Any idea?

Merci!
D063520

Jeen Broekstra

unread,
Apr 23, 2021, 8:41:44 PM4/23/21
to RDF4J Users
This should work, except there is one extra bit needed, which is that you need to configure your backend SAIL to use a ExtendedEvaluationStrategy instead of the default evaluation strategy. For example, if you're using a MemoryStore, you can do something like this:

MemoryStoreConfig storeConfig = new MemoryStoreConfig();
storeConfig.setEvaluationStrategyFactoryClassName(ExtendedEvaluationStrategyFactory.class.getName());
RepositoryImplConfig repConfig = new SailRepositoryConfig(storeConfig);

SailRepositoryFactory factory = new SailRepositoryFactory();
Repository rep = factory.getRepository(repConfig);

This is a hassle, admittedly, and we're looking into simplifying it (see https://github.com/eclipse/rdf4j/issues/635).

As an aside, despite SPIN being deprecated, one of the things we do want to preserve is its set of custom (tuple) functions, because they can be useful even outside of a SPIN context. If you're interested in helping out, we welcome contributors!

Cheers,

Jeen
Reply all
Reply to author
Forward
0 new messages