acoli-repo / fintan-doc

Documentation of Fintan - Flexible INtegrated Transformation and Annotation eNgineering
0 stars 0 forks source link

RDFUpdater graph parameter is not optional although it's described as such #1

Open glaserL opened 1 year ago

glaserL commented 1 year ago

The documentation for the RDFUpdater states that the graph parameter is optional:

https://github.com/acoli-repo/fintan-doc/blob/46e795e1fc078d5904519711de06e93cc9afb464/3a-core-components.md?plain=1#L118C148-L118C148

However when omitted, a NullPointerException occurs:

Exception in thread "main" java.lang.NullPointerException
        at org.acoli.fintan.rdf.RDFUpdaterFactory.buildFromJsonConf(RDFUpdaterFactory.java:114)
        at org.acoli.fintan.rdf.RDFUpdaterFactory.buildFromJsonConf(RDFUpdaterFactory.java:34)
        at org.acoli.fintan.core.FintanManager.buildComponent(FintanManager.java:423)
        at org.acoli.fintan.core.FintanManager.buildDefaultPipeline(FintanManager.java:243)
        at org.acoli.fintan.core.FintanManager.buildComponentStack(FintanManager.java:157)
        at org.acoli.fintan.core.FintanManager.main(FintanManager.java:110)
        at org.acoli.fintan.FintanCLIManager.main(FintanCLIManager.java:27)

Used Configuration

{
      "class": "RDFUpdater",
      "models": [
        {
          "source": "file:///some_graph.nt",
        }
      ],
      "updates": [{ "path": "script.sparql", "iter": "1" }]
    }
cfaeth commented 1 year ago

Hi, this is indeed a small bug, probably due to a minimal change in the jackson API. Currently the UpdaterFactory checks whether the textual representation of "graph" in the config file equals an empty string. However this seems to return null instead of an empty string when "graph" is not included in the file.

As a workaround, you could adjust your config file as follows:

{
      "class": "RDFUpdater",
      "models": [
        {
          "source": "file:///some_graph.nt",
          "graph": ""
        }
      ],
      "updates": [{ "path": "script.sparql", "iter": "1" }]
    }

It should work like that. I will make sure to include a fix in the next release.