Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONPath mapping fails if mapped field is null #6

Open
der-bruemmer opened this issue Jul 6, 2015 · 0 comments
Open

JSONPath mapping fails if mapped field is null #6

der-bruemmer opened this issue Jul 6, 2015 · 0 comments

Comments

@der-bruemmer
Copy link

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
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant