Skip to content

JSONPath mapping fails if mapped field is null #6

Description

@der-bruemmer

When a JSONPath in an rr:predicateObjectMap maps to a JSON element that is null in a file, a NullPointerException is thrown. However, when mapping large datasets, JSON files will sometimes have null fields. The mapping should then just not be applied, instead of failing with a NullPointerException.

Example:

Mapping:

@prefix rr:     <http://www.w3.org/ns/r2rml#>.
@prefix rml:    <http://semweb.mmlab.be/ns/rml#> .
@prefix ql:     <http://semweb.mmlab.be/ns/ql#> .
@prefix ex: <http://example.org/> .

<#TestMapping>

    rml:logicalSource [
    rml:source "/media/Nasenbluten/freme/test.json";
        rml:referenceFormulation ql:JSONPath;
        rml:iterator "$"
    ];

    rr:subjectMap [
        rr:template "http://example.org/{Subject}" ;
        rr:class ex:Subject
    ];

    rr:predicateObjectMap [
        rr:predicate ex:pred;
        rr:objectMap [
            rml:reference "test.fails";
        ]
    ].

JSON:

{
  "Subject" : "subject",
  "test" : {
    "fails" : null
    }
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions