Skip to content

Commit

Permalink
added return test case 0010
Browse files Browse the repository at this point in the history
  • Loading branch information
bjdmeest committed Mar 26, 2024
1 parent ace4bf3 commit 1f54270
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test-cases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| 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 |
41 changes: 41 additions & 0 deletions test-cases/RMLFNOTC0010-CSV/mapping.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ex: <http://example.com/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rml: <http://w3id.org/rml/> .
@prefix fno: <https://w3id.org/function/ontology#> .
@prefix morph-kgc: <https://github.com/morph-kgc/morph-kgc/function/built-in.ttl#> .
@prefix grel: <http://users.ugent.be/~bjdmeest/function/grel.ttl#> .
@prefix idlab-fn: <http://example.com/idlab/function/> .

@base <http://example.com/base/> .

<TriplesMap1>
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" ;
]
] .
1 change: 1 addition & 0 deletions test-cases/RMLFNOTC0010-CSV/output.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://example.com/Venus> <http://xmlns.com/foaf/0.1/name> "example.com" .
2 changes: 2 additions & 0 deletions test-cases/RMLFNOTC0010-CSV/student.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Id,Name,Comment,Class,url
1,Venus,A&B,A,http://example.com/venus
21 changes: 21 additions & 0 deletions test-cases/functions.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -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 .

0 comments on commit 1f54270

Please sign in to comment.