RMLio / rmlmapper-java

The RMLMapper executes RML rules to generate high quality Linked Data from multiple originally (semi-)structured data sources
http://rml.io
MIT License
144 stars 61 forks source link

Cannot invoke "be.ugent.rml.functions.SingleRecordFunctionExecutor.execute(be.ugent.rml.records.Record)" because "this.functionExecutor" is null #224

Open vchaudhri opened 8 months ago

vchaudhri commented 8 months ago

I will like to generate blank nodes as part of a subject map. I provided the following rule:

rr:subjectMap [ rr:column "Column_Name"; rr:termType "blankNode"; rr:class giam:Entitlement ]

I get the following error:

Cannot invoke "be.ugent.rml.functions.SingleRecordFunctionExecutor.execute(be.ugent.rml.records.Record)" because "this.functionExecutor" is null

How do I fix it? I am using rmlmapper-6.2.1-r368-all.jar

DylanVanAssche commented 8 months ago

It seems that your SubjectMap is not correct. You must use rr:BlankNode as rr:termType's object:

rr:subjectMap [
rr:column "Column_Name";
rr:termType rr:BlankNode;
rr:class giam:Entitlement
]
jaxley commented 8 months ago

Okay, I'm getting the same null pointer exception error.

I did some experimenting and it's being caused by attempting to add an rdf:comment that's an empty string

Use sample data file stuff.json:

{
   "stuff": [
        {"id":"12345", "value":"hi"}
   ]
}

This will cause an exception:

17:09:30.580 [main] DEBUG b.u.rml.records.JSONRecordFactory   .getRecords(40) - No document found for stuff.json. Creating new one
17:09:30.597 [main] DEBUG c.j.j.internal.path.CompiledPath    .evaluate(93) - Evaluating path: $['stuff'][*]
17:09:30.600 [main] DEBUG c.j.j.internal.path.CompiledPath    .evaluate(93) - Evaluating path: $['stuff'][0]['id']
17:09:30.601 [main] ERROR be.ugent.rml.cli.Main               .run(420) - Cannot invoke "be.ugent.rml.functions.SingleRecordFunctionExecutor.execute(be.ugent.rml.records.Record)" because "this.functionExecutor" is null
17:09:30.601 [main] ERROR be.ugent.rml.cli.Main               .run(457) - Cannot invoke "be.ugent.rml.functions.SingleRecordFunctionExecutor.execute(be.ugent.rml.records.Record)" because "this.functionExecutor" is null
java.lang.NullPointerException: Cannot invoke "be.ugent.rml.functions.SingleRecordFunctionExecutor.execute(be.ugent.rml.records.Record)" because "this.functionExecutor" is null
    at be.ugent.rml.termgenerator.LiteralGenerator.generate(LiteralGenerator.java:47)
    at be.ugent.rml.Executor.generatePredicateObjectGraphs(Executor.java:345)
    at be.ugent.rml.Executor.executeWithFunction(Executor.java:178)
    at be.ugent.rml.Executor.execute(Executor.java:132)
    at be.ugent.rml.cli.Main.run(Main.java:416)
    at be.ugent.rml.cli.Main.main(Main.java:49)
---
base: http://www.semanticweb.org/Broken#

prefixes:
  instance: http://www.semanticweb.org/Broken#
  rdfs: http://www.w3.org/2000/01/rdf-schema#
  idlab-fn: http://example.com/idlab/function/
  grel: http://users.ugent.be/~bjdmeest/function/grel.ttl#

sources:
  stuff:
    access: stuff.json
    referenceFormulation: jsonpath
    iterator: "$.stuff[*]"

mappings:
  threats:
    sources: stuff
    subjects: instance:$(id)
    predicateobjects:
      - [rdf:comment, ""]

But, this will process just fine. Only difference is a single character.

---
base: http://www.semanticweb.org/Broken#

prefixes:
  instance: http://www.semanticweb.org/Broken#
  rdfs: http://www.w3.org/2000/01/rdf-schema#
  idlab-fn: http://example.com/idlab/function/
  grel: http://users.ugent.be/~bjdmeest/function/grel.ttl#

sources:
  stuff:
    access: stuff.json
    referenceFormulation: jsonpath
    iterator: "$.stuff[*]"

mappings:
  threats:
    sources: stuff
    subjects: instance:$(id)
    predicateobjects:
      - [rdf:comment, " "]