You are right, the query is passed to D2RQ for processing, so it treats the 
property function just like any other predicate.

I have now setup an in memory dataset to test the functions, but the custom 
property functions still do not appear to get registered or used.

I have now added the public static void init()" method around the static block 
and changed debug to use log4j, I have the default log level set to DEBUG and 
my logging is set at INFO, but still no output.

In my configuration file, do I need to initialise the factory after loading the 
class?

On starting Fuseki I see the following:

symbol:http://jena.hpl.hp.cpm/ARQ#enablePropertyFunctions = true

So it looks like property functions are enabled by default.



Andy

On 29 Aug 2013, at 18:09, Andy Seaborne <[email protected]> wrote:

> On 29/08/13 14:28, Andrew Reslan wrote:
>> I have three custom property functions, that I have been using in Jena for 
>> some time.
>> 
>> I have been using these through Java code, and manually register the 
>> function factory before queries are processed.
>> 
>> I want to use these property functions via Fuseki, but at the moment it 
>> looks as though they are being bypassed and the query gets send through to 
>> the backing store (in this case D2RQ).
>> 
>> I have added the following line to my config file in the server definition 
>> to load a class that registers the property functions in a static block.
>> 
>> [] ja:loadClass "foo.bar.MyClass"
>> 
>> If I use the wrong class name then I see a ClassNotFoundError, so it appears 
>> that the class is correctly located.
>> 
>> In the class I have added a static block:
>> 
>> {
>>      PropertyFunctionRegistry.get().put("FUNCTION1 URI", new 
>> FunctionFactory());
>>      PropertyFunctionRegistry.get().put("FUNCTION2 URI", new 
>> FunctionFactory());
>>      PropertyFunctionRegistry.get().put("FUNCTION3 URI", new 
>> FunctionFactory());
>> }
>> 
>> I have added System.err debug messages to the static block and the function 
>> classes, but I see none of these, does fuseki redirect System.err?
> 
> Depends how you run fuseki.  I think the script 'fuseki' send output to 
> log/stderrout.log, 'fuseki-server' does not -- where does your normal output 
> go?
> 
> Does the class have a "public static void init()" method?  That is what is 
> called by  [] ja:loadClass "foo.bar.MyClass"  No init() and the class is only 
> loaded which I think means no calling static blocks.
> 
> (can't remember how D2RQ works)
> 
> It's the particular query engine that provides property functions.  If the 
> query goes to D2RQ, then property functions will only work if D2RQ provides 
> then.
> 
> If it's a single graph in a general dataset then the query engine is the 
> general one and they will work.
> 
>       Andy
> 
> 
> 
>> 
>> Andy
>> 
>> 
> 

Reply via email to