RMLio / rmlmapper-java

The RMLMapper executes RML rules to generate high quality Linked Data from multiple originally (semi-)structured data sources
http://rml.io
MIT License
147 stars 61 forks source link

Getting started with functions: No mapping was found for the function with IRI ... #113

Closed paulakeen closed 3 years ago

paulakeen commented 3 years ago

Sorry for basic questions...I'm trying to sort out my way with very basic exercices using functions. I tried to run a basic example taken from https://fno.io/rml/, but I'm stuck with this error:

(b'', b'14:24:46.534 [main] ERROR be.ugent.rml.cli.Main .main(312) - No mapping was found for the function with IRI http://users.ugent.be/~bjdmeest/function/grel.ttl#toUpperCase in the function descriptions.\n')

I'm passing the functions.ttl file location to the rmlmapper jar via the -f parameter, I've check that the naming of the toUpperCase is correct in my code and inside the functions.ttl file... I have everything in one directory: the rmlmapper-4.9.2.jar, the functions.ttlm the GrelFunctions.jar, as well as my rml file and the csv I'm using for the LogicalSource.

The rml file I'm using is this one:

@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 transit: http://vocab.org/transit/terms/. @prefix xsd: http://www.w3.org/2001/XMLSchema#. @prefix wgs84_pos: http://www.w3.org/2003/01/geo/wgs84_pos#. @prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# . @prefix fnml: http://semweb.mmlab.be/ns/fnml# . @prefix fno: https://w3id.org/function/ontology# . @prefix grel: http://users.ugent.be/~bjdmeest/function/grel.ttl# . @prefix skos: http://www.w3.org/2004/02/skos/core# . @prefix foaf: http://xmlns.com/foaf/0.1/ . @prefix dct: http://purl.org/dc/terms/ . @base http://example.com/ns# .

<#PersonSource> rml:source "person.csv" ; rml:referenceFormulation ql:CSV .

<#PersonSubjectMap> a rr:SubjectMap ; rr:template "http://example.com/ns#{id}"; rr:class foaf:Person .

<#PersonMapping> a rr:TriplesMap ; rml:logicalSource <#PersonSource> ; rr:subjectMap <#PersonSubjectMap> ; rr:predicateObjectMap <#NameMapping> .

<#NameMapping> rr:predicate foaf:familyName ; rr:objectMap <#FunctionMap> .

<#FunctionMap> fnml:functionValue [ rml:logicalSource <#PersonSource> ; rr:predicateObjectMap [ rr:predicate fno:executes ; rr:objectMap [rr:constant grel:toUpperCase ] ]; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; # I've seen this in Issue #44

rr:predicate grel:inputString ;

        rr:objectMap  [rml:reference "name"]
    ]
] .
paulakeen commented 3 years ago

OK, I removed the -f parameter and now it works. I got to understand that the -f is when including new functions, and that the toUpperCase is already provided franco fabrica by RML, as very well explained in the GitHub doc (Is there a tutorial on how to use functions, with examples? couldn't find it in the RML tutorials).

Sorry for the disturbance. I'll close it.

bjdmeest commented 3 years ago

Great that you found a solution! For future reference, our test cases might be a good starting point to find all kinds of examples on how to use FnO in RML mappings :)