From 1f54270a41db44b81ae53a7d2a6df65e7d9ee439 Mon Sep 17 00:00:00 2001 From: Ben De Meester Date: Tue, 26 Mar 2024 16:34:02 +0100 Subject: [PATCH 1/3] added return test case 0010 --- test-cases/README.md | 3 +- test-cases/RMLFNOTC0010-CSV/mapping.ttl | 41 +++++++++++++++++++++++++ test-cases/RMLFNOTC0010-CSV/output.nq | 1 + test-cases/RMLFNOTC0010-CSV/student.csv | 2 ++ test-cases/functions.ttl | 21 +++++++++++++ 5 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 test-cases/RMLFNOTC0010-CSV/mapping.ttl create mode 100644 test-cases/RMLFNOTC0010-CSV/output.nq create mode 100644 test-cases/RMLFNOTC0010-CSV/student.csv diff --git a/test-cases/README.md b/test-cases/README.md index 982b909..ecf3132 100644 --- a/test-cases/README.md +++ b/test-cases/README.md @@ -50,4 +50,5 @@ Some test cases are under discussion, proposed alternatives are noted via a suff | 0006 | Function on object, the output termType is IRI | Tests if the output of the function is assigned the correct termType | | | | | 0006b | Function on object, the output termType is IRI (replaces 0006) | Tests if the output of the function is assigned the correct termType | | | | | 0008 | Function on object, 1 template parameter | Tests if a function with a template parameter can be used | CSV | FALSE | student.csv | -| 0009 | Nested function - Test A | Tests if a composite function of form f(g(x1),x2) works (i.e., the inner function is only one argument of the outer function) | CSV | FALSE | student.csv | \ No newline at end of file +| 0009 | Nested function - Test A | Tests if a composite function of form f(g(x1),x2) works (i.e., the inner function is only one argument of the outer function) | CSV | FALSE | student.csv | +| 0010 | Function on object, specified return output | Tests if a specific return output can be used | CSV | TRUE | student.csv | diff --git a/test-cases/RMLFNOTC0010-CSV/mapping.ttl b/test-cases/RMLFNOTC0010-CSV/mapping.ttl new file mode 100644 index 0000000..c1c33e1 --- /dev/null +++ b/test-cases/RMLFNOTC0010-CSV/mapping.ttl @@ -0,0 +1,41 @@ +@prefix foaf: . +@prefix ex: . +@prefix xsd: . +@prefix rml: . +@prefix fno: . +@prefix morph-kgc: . +@prefix grel: . +@prefix idlab-fn: . + +@base . + + + rml:logicalSource [ + rml:source [ a rml:RelativePathSource; + rml:root rml:MappingDirectory; + rml:path "student.csv" + ]; + rml:referenceFormulation rml:CSV + ]; + rml:subjectMap [ + rml:template "http://example.com/{Name}" + ]; + rml:predicateObjectMap [ + rml:predicate foaf:name; + rml:objectMap [ + rml:functionExecution <#Execution> ; + rml:returnMap [ + rr:constant fns:domainOutput + ] + ] + ] . + +<#Execution> + rml:function fns:parseURL ; + rml:input + [ + rml:parameter fns:stringParameter ; + rml:inputValueMap [ + rml:reference "url" ; + ] + ] . diff --git a/test-cases/RMLFNOTC0010-CSV/output.nq b/test-cases/RMLFNOTC0010-CSV/output.nq new file mode 100644 index 0000000..3c0e8a7 --- /dev/null +++ b/test-cases/RMLFNOTC0010-CSV/output.nq @@ -0,0 +1 @@ + "example.com" . diff --git a/test-cases/RMLFNOTC0010-CSV/student.csv b/test-cases/RMLFNOTC0010-CSV/student.csv new file mode 100644 index 0000000..5c20b3c --- /dev/null +++ b/test-cases/RMLFNOTC0010-CSV/student.csv @@ -0,0 +1,2 @@ +Id,Name,Comment,Class,url +1,Venus,A&B,A,http://example.com/venus diff --git a/test-cases/functions.ttl b/test-cases/functions.ttl index 7ea5648..d3ddd8b 100644 --- a/test-cases/functions.ttl +++ b/test-cases/functions.ttl @@ -79,3 +79,24 @@ fns:stringParameter rdfs:label "input string" ; fno:predicate fns:hasStringParameter ; fno:type xsd:string . + +fns:parseURL + a fno:Function ; + fno:name "parse URL" ; + dcterms:description "The parse URL function returns the protocol, domain, and path as strings of a URL of the form '{protocolOutput}://{domainOutput}/{stringOutput}'" ; + fno:expects ( fns:stringParameter ) ; + fno:returns ( fns:protocolOutput fns:domainOutput fns:stringOutput ) . + +fns:protocolOutput + a fno:Output ; + fno:name "protocol output string" ; + rdfs:label "protocol output string" ; + fno:predicate fns:hasProtocolOutput ; + fno:type xsd:string . + +fns:domainOutput + a fno:Output ; + fno:name "domain output string" ; + rdfs:label "domain output string" ; + fno:predicate fns:hasDomainOutput ; + fno:type xsd:string . From 493e55e9e695459e8f1b925c678c89e5000fa3ec Mon Sep 17 00:00:00 2001 From: Ben De Meester Date: Tue, 26 Mar 2024 16:35:43 +0100 Subject: [PATCH 2/3] prefix fix --- test-cases/RMLFNOTC0010-CSV/mapping.ttl | 1 + 1 file changed, 1 insertion(+) diff --git a/test-cases/RMLFNOTC0010-CSV/mapping.ttl b/test-cases/RMLFNOTC0010-CSV/mapping.ttl index c1c33e1..b224685 100644 --- a/test-cases/RMLFNOTC0010-CSV/mapping.ttl +++ b/test-cases/RMLFNOTC0010-CSV/mapping.ttl @@ -3,6 +3,7 @@ @prefix xsd: . @prefix rml: . @prefix fno: . +@prefix fns: . @prefix morph-kgc: . @prefix grel: . @prefix idlab-fn: . From 10cc01aaa0edce579b81a37747792c879586c6df Mon Sep 17 00:00:00 2001 From: Ben De Meester Date: Tue, 26 Mar 2024 16:36:59 +0100 Subject: [PATCH 3/3] prefix fix --- test-cases/RMLFNOTC0010-CSV/mapping.ttl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-cases/RMLFNOTC0010-CSV/mapping.ttl b/test-cases/RMLFNOTC0010-CSV/mapping.ttl index b224685..17d75d7 100644 --- a/test-cases/RMLFNOTC0010-CSV/mapping.ttl +++ b/test-cases/RMLFNOTC0010-CSV/mapping.ttl @@ -26,7 +26,7 @@ rml:objectMap [ rml:functionExecution <#Execution> ; rml:returnMap [ - rr:constant fns:domainOutput + rml:constant fns:domainOutput ] ] ] .