Skip to content

JSONPath mapping fails if mapped field is null #6

@der-bruemmer

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
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions