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 6 forks source link

🐛 Mapping error- missing square brackets #12

Closed jatoledo closed 3 years ago

jatoledo commented 3 years ago

mappings:
   agency:
    sources:
      - [/data/csv/1/AGENCY.csv~csv]
    s: http://transport.linkeddata.es/madrid/agency/$(agency_id)
    po:
      - [a, gtfs:Agency]
      - [foaf:page, $(agency_url)~iri]
      - [foaf:name,$(agency_name)]
<#agency_0> a rr:TriplesMap;

        rml:logicalSource [
                a rml:logicalSource;
                rml:source "/data/csv/1/AGENCY.csv";
                rml:referenceFormulation ql:csv
        ];
        rr:subjectMap [
                a rr:SubjectMap;
                rr:template "http://transport.linkeddata.es/madrid/agency/{agency_id}"
        ];

        rr:predicateObjectMap [
                a rr:PredicateObjectMap;
                rr:predicate rdf:type;
                rr:objectMap [
                        a rr:ObjectMap;
                        rml:reference gtfs:Agency
                ]
        ];

        rr:predicateObjectMap [
                a rr:PredicateObjectMap;
                rr:predicate foaf:page;
                rr:objectMap [
                        a rr:ObjectMap;
                        rml:reference "agency_url";
                        rr:TermType rr:IRI
                ];
                               <-----------------------------------  ****************** HERE ******************
        rr:predicateObjectMap [
                a rr:PredicateObjectMap;
                rr:predicate foaf:name;
                rr:objectMap [
                        a rr:ObjectMap;
                        rml:reference "agency_name"
                ]
        ].
dachafra commented 3 years ago

@LuisLopezPi could be really interesting, in order to validate that the RDF you are creating in RML is valid, to load the output using RDFlib, so these small bugs will be identified faster (are two lines of code)

LuisLopezPi commented 3 years ago

The bug is fixed!

LuisLopezPi commented 3 years ago

But if I'm not wrong, I should have an input file to get the output right? @dachafra

jatoledo commented 3 years ago

@LuisLopezPi tries to validate with RDFlib. I have the same error but in this case with quotes.


@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix rev: <http://purl.org/stuff/rev#>.
@prefix gtfs: <http://vocab.gtfs.org/terms#>.
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>.
@prefix schema: <http://schema.org/>.
@prefix dct: <http://purl.org/dc/terms/>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.

<#agency_0> a rr:TriplesMap;

        rml:logicalSource [
                a rml:logicalSource;
                rml:source "/data/AGENCY.csv";
                rml:referenceFormulation ql:csv
        ];
        rr:subjectMap [
                a rr:SubjectMap;
                rr:template  "http://transport.linkeddata.es/madrid/agency/{agency_id}"
        ];

        rr:predicateObjectMap [
                a rr:PredicateObjectMap;
                rr:predicate a;
                rr:objectMap [
                        a rr:ObjectMap;
                        rr:constant gtfs:Agency
                ]
        ];

        rr:predicateObjectMap [
                a rr:PredicateObjectMap;
                rr:predicate foaf:page;
                rr:objectMap [
                        a rr:ObjectMap;
                        rml:reference agency_url"; <---------------------- HERE-----------
                        rr:TermType rr:IRI
                ]
        ];

        rr:predicateObjectMap [
                a rr:PredicateObjectMap;
                rr:predicate foaf:name;
                rr:objectMap [
                        a rr:ObjectMap;
                        rml:reference "agency_name"
                ]
        ].
dachafra commented 3 years ago

But if I'm not wrong, I should have an input file to get the output right? @dachafra

RML uses Turtle, you can validate if the rules you are generating are well-formed in RDF