Edmond,

I don't see any use of Fuseki modules here.

ja:loadClass -> init calling PropertyFunctionRegistry is working for me with Fuseki 5.3.0

How are you running the server?

    Andy

On 10/02/2025 03:32, Edmond Chuc wrote:
Hi,

I'd like to add that I am also experiencing this issue except with registering 
custom property functions with Fuseki main server. The module is added to the 
classpath when I start Fuseki Server, and I load the class in the global 
assembler config.ttl file.

[] rdf:type fuseki:Server ;
     ja:loadClass "com.example.jena.myFunc" ;
.

With my custom property function, Fuseki used to previously call the static 
void init method on my class. But now, it no longer calls it and I can't 
register the custom property function with my own IRI.

class getParts : PFuncSimpleAndList() {
     companion object {
         @JvmStatic
         fun init() {
             println("Initializing getParts property function")

             // Register the property function with the IRI
             PropertyFunctionRegistry.get().put(
                 "https://linked.data.gov.au/def/cn/func/getParts";,
                 GetPartsPropertyFunctionFactory(),
             )
         }
     }

The above is in Kotlin, but hopefully you get the idea.

Note that I can still use the custom property function in my SPARQL queries if I use 
the <java:...> syntax but I'd prefer it if I can continue to use the init hook 
to register my function with an IRI.

Cheers,

Edmond


On Monday, 10 February 2025 at 03:12, Andy Seaborne <[email protected]> wrote:

Hi Mikhail,

There wasn't an intentional change but there has been a signficant
amount of change in the area.

I have a question below:


On 08/02/2025 17:39, Mikhail Komyshev wrote:

Hi!

I have an application that uses Fuseki Main server and tried updating
the jena-fuseki-server-X.X.X.jar binary from 5.2.0 to 5.3.0 from 1.
But from some reason, auto modules stopped loading.

Unfortuantely, I haven't found any notices about changes in this regard.
Sorry if I missed something. Did the behaviour change or is this a bug?

The minimal example is as follows (suppose compiled against
org.apache.jena/jena-fuseki-main from Maven version 5.3.0):
```
package com.example;

import java.util.Set;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.fuseki.main.sys.FusekiAutoModule;
import org.apache.jena.fuseki.main.FusekiServer;

public class MyModule implements FusekiAutoModule {
public MyModule() {}

public String name() {
return "My Module";
}

public void prepare(
FusekiServer.Builder builder,
Set<String> datasetNames,
Model configModel
) {
System.out.println("Hello world!");
}
}
```

Then, in the file `META-INF/services/ 
org.apache.jena.fuseki.main.sys.FusekiAutoModule` on the classpath, you
put this line:
`com.example.MyModule`

When running the following shell command, you can see the info message
about the module being loaded and the Hello world message in the
standard output:
`java -cp jena-fuseki-server-5.2.0.jar:src/java:resources \\ 
org.apache.jena.fuseki.main.cmds.FusekiMainCmd --mem --modules=true \\ '/test'`


How is the file com/example/MyModule.class getting onto the classpath?

Yet, running the same command with the 5.3.0 binary doesn't seem to load
the module and therefore doesn't produce the two messages.

Thanks in advance!

server/5.3.0/jena-fuseki-server-5.3.0.jar

Cheers,
Mikhail

Reply via email to