oeg-upm / yatter

Translate YARRRML into easy-to-read [R2]RML mappings
https://doi.org/10.5281/zenodo.7024500
Apache License 2.0
22 stars 7 forks source link

Does not support json as a source #20

Closed jatoledo closed 3 years ago

jatoledo commented 3 years ago

Does not support JSON format as a source


prefixes:
  ex: "http://example.com/"

mappings:
  person:
    sources:
      - ['data.json~jsonpath', '$.persons[*]']
    s: http://example.com/$(firstname)
    po:
      - [a, foaf:Person]
      - [ex:name, $(firstname)]

Output:


@prefix ex: <http://example.com/>.
@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
dachafra commented 3 years ago
@prefix ex: <http://example.com/>.
@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.

<#person_0> a rr:TriplesMap;

    rml:LogicalSource [
        a rml:logicalSource;
        rml:source "data.json";
        rml:referenceFormulation ql:JSONpath;
        rml:iterator"$.persons[*]";
    ];
    rr:subjectMap [
        a rr:SubjectMap;
        rr:template "http://example.com/{firstname}";
    ];
    rr:predicateObjectMap [
        rr:predicateMap [
            a rr:PredicateMap;
            rr:constant rdf:type;
        ];
        rr:objectMap [
            a rr:ObjectMap;
            rr:constant foaf:Person;
        ];
    ];
    rr:predicateObjectMap [
        rr:predicateMap [
            a rr:PredicateMap;
            rr:constant ex:name;
        ];
        rr:objectMap [
            a rr:ObjectMap;
            rml:reference "firstname";
        ];
    ].